p2ps.imp.pipe
Class InputPipeImp

java.lang.Object
  extended byp2ps.imp.pipe.InputPipeImp
All Implemented Interfaces:
EndpointMessageListener, InputPipe

public class InputPipeImp
extends java.lang.Object
implements InputPipe, EndpointMessageListener

The implementation of a pipe for broadcasting and receiving discovery adverts

Version:
$Revision: 295 $
Author:
Ian Wang

Constructor Summary
InputPipeImp(PipeAdvertisement pipead, Endpoint[] endpoints)
           
 
Method Summary
 void addMessageListener(MessageListener listener)
          Adds a listener to be notified when messages are received
 void close()
          Closes the pipe
 void dataMessageReceived(DataMessageEvent event)
          Called when the endpoint receives a data message
 Endpoint[] getEndpoints()
           
 java.lang.String getPipeID()
           
 java.lang.String getPipeName()
           
 java.net.URI getPipeURI()
           
 boolean isClosed()
           
 void removeMessageListener(MessageListener listener)
          Removes a listener from being notified when messages are received
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputPipeImp

public InputPipeImp(PipeAdvertisement pipead,
                    Endpoint[] endpoints)
Method Detail

addMessageListener

public void addMessageListener(MessageListener listener)
Adds a listener to be notified when messages are received

Specified by:
addMessageListener in interface InputPipe

removeMessageListener

public void removeMessageListener(MessageListener listener)
Removes a listener from being notified when messages are received

Specified by:
removeMessageListener in interface InputPipe

getPipeURI

public java.net.URI getPipeURI()
Specified by:
getPipeURI in interface InputPipe
Returns:
the uri of the pipe

getPipeID

public java.lang.String getPipeID()
Specified by:
getPipeID in interface InputPipe
Returns:
the id of the pipe

getPipeName

public java.lang.String getPipeName()
Specified by:
getPipeName in interface InputPipe
Returns:
the name of the pipe

getEndpoints

public Endpoint[] getEndpoints()
Specified by:
getEndpoints in interface InputPipe
Returns:
the endpoints for the pipe

dataMessageReceived

public void dataMessageReceived(DataMessageEvent event)
Description copied from interface: EndpointMessageListener
Called when the endpoint receives a data message

Specified by:
dataMessageReceived in interface EndpointMessageListener

close

public void close()
           throws java.io.IOException
Description copied from interface: InputPipe
Closes the pipe

Specified by:
close in interface InputPipe
Throws:
java.io.IOException

isClosed

public boolean isClosed()
Specified by:
isClosed in interface InputPipe
Returns:
true if the pipe is closed (i.e. all its underlying socket are closed)