JXTA

net.jxta.pipe
Interface PipeService

All Superinterfaces:
Module, Service

public interface PipeService
extends Service

Pipes are the core mechanism for exchanging messages between JXTA applications or services.

Pipes are uniquely identified by a PipeAdvertisement which is associated with each pipe.

Several types of Pipe can currently be used:

The type of a Pipe is defined when creating its PipeAdvertisement.

See Also:
PipeAdvertisement, InputPipe, OutputPipe, Message, JXTA Protocols Specification : Pipes, JXTA Protocols Specification : Pipe Binding Protocol

Field Summary
static String PropagateType
          Propagated, unsecured and unreliable type of Pipe
static String UnicastSecureType
          End-to-end secured unicast pipe of Pipe
static String UnicastType
          Unicast, unreliable and unsecured type of Pipe
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, START_OK
 
Method Summary
 InputPipe createInputPipe(PipeAdvertisement adv)
          Create an InputPipe from a pipe Advertisement
 InputPipe createInputPipe(PipeAdvertisement adv, PipeMsgListener listener)
          Create an InputPipe from a pipe Advertisement
 OutputPipe createOutputPipe(PipeAdvertisement pipeAdv, long timeout)
          Attempt to create an OutputPipe using the specified Pipe Advertisement.
 void createOutputPipe(PipeAdvertisement pipeAdv, OutputPipeListener listener)
          Attempt to create an OutputPipe using the specified Pipe Advertisement.
 OutputPipe createOutputPipe(PipeAdvertisement pipeAdv, Set<? extends ID> resolvablePeers, long timeout)
          Attempt to create an OutputPipe using the specified Pipe Advertisement.
 void createOutputPipe(PipeAdvertisement pipeAdv, Set<? extends ID> resolvablePeers, OutputPipeListener listener)
          Attempt to create an OutputPipe using the specified Pipe Advertisement.
 OutputPipeListener removeOutputPipeListener(ID pipeID, OutputPipeListener listener)
          Remove an OutputPipeListener previously registered with createOuputputPipe.
 OutputPipeListener removeOutputPipeListener(String pipeID, OutputPipeListener listener)
          Deprecated. This method is being replaced by removeOutputPipeListener(ID,OutputPipeListener).
 
Methods inherited from interface net.jxta.service.Service
getImplAdvertisement, getInterface
 
Methods inherited from interface net.jxta.platform.Module
init, startApp, stopApp
 

Field Detail

UnicastType

static final String UnicastType
Unicast, unreliable and unsecured type of Pipe

See Also:
Constant Field Values

PropagateType

static final String PropagateType
Propagated, unsecured and unreliable type of Pipe

See Also:
Constant Field Values

UnicastSecureType

static final String UnicastSecureType
End-to-end secured unicast pipe of Pipe

See Also:
Constant Field Values
Method Detail

createInputPipe

InputPipe createInputPipe(PipeAdvertisement adv)
                          throws IOException
Create an InputPipe from a pipe Advertisement

Parameters:
adv - The advertisement of the Pipe.
Returns:
The InputPipe created.
Throws:
IOException - error creating input pipe

createInputPipe

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

Parameters:
adv - is the advertisement of the Pipe.
listener - PipeMsgListener to receive msgs.
Returns:
InputPipe The InputPipe created.
Throws:
IOException - Error creating input pipe

createOutputPipe

OutputPipe createOutputPipe(PipeAdvertisement pipeAdv,
                            long timeout)
                            throws IOException
Attempt to create an OutputPipe using the specified Pipe Advertisement. The pipe will be be resolved within the provided timeout.

Parameters:
pipeAdv - The advertisement of the pipe being resolved.
timeout - Time duration in milliseconds to wait for a successful pipe resolution. 0 will wait indefinitely.
Returns:
OutputPipe the successfully resolved OutputPipe.
Throws:
IOException - If the pipe cannot be created or failed to resolve within the specified time.

createOutputPipe

OutputPipe createOutputPipe(PipeAdvertisement pipeAdv,
                            Set<? extends ID> resolvablePeers,
                            long timeout)
                            throws IOException
Attempt to create an OutputPipe using the specified Pipe Advertisement. The pipe will be be resolved to one of the peers in the set of peer ids provided within the provided timeout.

Parameters:
pipeAdv - The advertisement of the pipe being resolved.
resolvablePeers - The peers on which the pipe may be resolved. If the Set is empty then the pipe may be resolved to any destination peer.
timeout - Time duration in milliseconds to wait for a successful pipe resolution. 0 will wait indefinitely.
Returns:
The successfully resolved OutputPipe.
Throws:
IOException - If the pipe cannot be created or failed to resolve within the specified time.

createOutputPipe

void createOutputPipe(PipeAdvertisement pipeAdv,
                      OutputPipeListener listener)
                      throws IOException
Attempt to create an OutputPipe using the specified Pipe Advertisement. The pipe may be resolved to any destination peer. When the pipe is resolved the listener will be called.

Parameters:
pipeAdv - The advertisement of the pipe being resolved.
listener - The listener to be called when the pipe is resolved.
Throws:
IOException - If the pipe cannot be created.

createOutputPipe

void createOutputPipe(PipeAdvertisement pipeAdv,
                      Set<? extends ID> resolvablePeers,
                      OutputPipeListener listener)
                      throws IOException
Attempt to create an OutputPipe using the specified Pipe Advertisement. When the pipe is resolved to one of the peers in the set of peer ids provided the listener will be called.

Parameters:
pipeAdv - The advertisement of the pipe being resolved.
resolvablePeers - The set of peers on which the pipe may be resolved. If the Set is empty then the pipe may be resolved to any destination peer.
listener - the listener to be called when the pipe is resolved.
Throws:
IOException - If the pipe cannot be created.

removeOutputPipeListener

@Deprecated
OutputPipeListener removeOutputPipeListener(String pipeID,
                                                       OutputPipeListener listener)
Deprecated. This method is being replaced by removeOutputPipeListener(ID,OutputPipeListener).

Remove an OutputPipeListener previously registered with createOuputputPipe.

Parameters:
pipeID - The pipe who's listener is to be removed.
listener - The listener to remove.
Returns:
The listener which was removed or null if the key did not have a mapping.

removeOutputPipeListener

OutputPipeListener removeOutputPipeListener(ID pipeID,
                                            OutputPipeListener listener)
Remove an OutputPipeListener previously registered with createOuputputPipe.

Parameters:
pipeID - The pipe who's listener is to be removed.
listener - The listener to remove.
Returns:
The listener which was removed or null if the key did not have a mapping.

JXSE