JXTA

net.jxta.impl.pipe
Class WirePipeImpl

java.lang.Object
  extended by net.jxta.impl.pipe.WirePipeImpl
All Implemented Interfaces:
EndpointListener

public class WirePipeImpl
extends Object
implements EndpointListener

The Wire (Propagated) Pipe Service.


Field Summary
(package private) static String WIRE_HEADER_ELEMENT_NAME
          The Message Element name we use for passing the wire header.
(package private) static String WIRE_HEADER_ELEMENT_NAMESPACE
          The Message namespace we use for passing the wire header.
(package private) static String WIRE_SERVICE_NAME
          Service name we register our listener with.
 
Constructor Summary
WirePipeImpl(PeerGroup group, PipeResolver pipeResolver)
           
 
Method Summary
(package private)  InputPipe createInputPipe(PipeAdvertisement adv, PipeMsgListener listener)
          create an InputPipe from a pipe Advertisement
(package private)  NonBlockingWireOutputPipe createOutputPipe(PipeAdvertisement adv, Set<? extends ID> peers)
          create an OutputPipe from the pipe Advertisement giving a PeerId(s) where the corresponding InputPipe is supposed to be.
(package private)  boolean forgetWirePipe(ID pipeID)
          Remove a wire pipe from our collection of wire pipes.
 String getServiceParameter()
          To support WirePipe.send(Message, Enumeration)
 void processIncomingMessage(Message message, EndpointAddress srcAddr, EndpointAddress dstAddr)
          This method is invoked by the EndpointService for each incoming message which is addressed to this listener.
 int startApp(String[] arg)
          Supply arguments and starts this service if it hadn't started by itself.
 void stopApp()
          Ask this service to stop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIRE_SERVICE_NAME

static final String WIRE_SERVICE_NAME
Service name we register our listener with.

See Also:
Constant Field Values

WIRE_HEADER_ELEMENT_NAMESPACE

static final String WIRE_HEADER_ELEMENT_NAMESPACE
The Message namespace we use for passing the wire header.

See Also:
Constant Field Values

WIRE_HEADER_ELEMENT_NAME

static final String WIRE_HEADER_ELEMENT_NAME
The Message Element name we use for passing the wire header.

See Also:
Constant Field Values
Constructor Detail

WirePipeImpl

WirePipeImpl(PeerGroup group,
             PipeResolver pipeResolver)
Parameters:
group - Description of the Parameter
pipeResolver - Description of the Parameter
Method Detail

getServiceParameter

public String getServiceParameter()
To support WirePipe.send(Message, Enumeration)

Returns:
The serviceParameter value

startApp

public int startApp(String[] arg)
Supply arguments and starts this service if it hadn't started by itself.

Currently this service does not expect arguments.

Parameters:
arg - A table of strings arguments.
Returns:
int status indication.

stopApp

public void stopApp()
Ask this service to stop.


createInputPipe

InputPipe createInputPipe(PipeAdvertisement adv,
                          PipeMsgListener listener)
                    throws IOException
create an InputPipe from a pipe Advertisement

Parameters:
adv - is the advertisement of the PipeServiceImpl.
listener - PipeMsgListener to receive msgs.
Returns:
InputPipe InputPipe object created
Throws:
IOException - error creating input pipe

createOutputPipe

NonBlockingWireOutputPipe createOutputPipe(PipeAdvertisement adv,
                                           Set<? extends ID> peers)
create an OutputPipe from the pipe Advertisement giving a PeerId(s) where the corresponding InputPipe is supposed to be.

Parameters:
adv - is the advertisement of the NetPipe.
peers - is a set of the PeerId of the peers where to look for the corresponding Pipes
Returns:
OuputPipe corresponding OutputPipe

forgetWirePipe

boolean forgetWirePipe(ID pipeID)
Remove a wire pipe from our collection of wire pipes.

Parameters:
pipeID - The ID of the wire pipe to forget.
Returns:
true if the wire pipe had been registered otherwise false.

processIncomingMessage

public void processIncomingMessage(Message message,
                                   EndpointAddress srcAddr,
                                   EndpointAddress dstAddr)
This method is invoked by the EndpointService for each incoming message which is addressed to this listener.

Listener for "jxta.service.wirepipe" / <null>

Specified by:
processIncomingMessage in interface EndpointListener
Parameters:
message - Incoming message
srcAddr - Endpoint Address of the source of the message.
dstAddr - Endpoint Address of the destination of the message.

JXSE