Project JXTA

net.jxta.pipe
Interface PipeService

All Superinterfaces:
Module, Service

public interface PipeService
extends Service

This class defines the API to the JXTA Pipe Service.

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

Pipes are uniquely identified by a PipeAdvertisement which is associated with each pipe. Creating the advertisement of a Pipe must be done only once in the lifetime of a Pipe. In fact, a PipeAdvertisement represents the pipe on the JXTA network.

Several types of Pipe can be used:

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

Since:
JXTA 1.0
See Also:
PipeAdvertisement, InputPipe, OutputPipe, Message

Field Summary
static java.lang.String PropagateType
          Propagated, unsecure and unreliable type of Pipe
static java.lang.String UnicastSecureType
          Unicast and secure type of Pipe
static java.lang.String UnicastType
          Unicast, unreliable and unsecure type of Pipe
 
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
 Message createMessage()
          Creates a new Message
 OutputPipe createOutputPipe(PipeAdvertisement adv, java.util.Enumeration peers, long timeout)
          create an OutputPipe from the pipe Advertisement giving a PeerId(s) where the corresponding InputPipe is supposed to be.
 OutputPipe createOutputPipe(PipeAdvertisement adv, long timeout)
          create an OutputPipe from the pipe Advertisement
 void createOutputPipe(PipeAdvertisement adv, OutputPipeListener listener)
          registers a listener for a NetPipe.
 OutputPipeListener removeOutputPipeListener(java.lang.String pipeID, OutputPipeListener listener)
          remove a Output pipe listener
 
Methods inherited from interface net.jxta.service.Service
getImplAdvertisement, getInterface
 
Methods inherited from interface net.jxta.platform.Module
init, startApp, stopApp
 

Field Detail

UnicastType

public static final java.lang.String UnicastType
Unicast, unreliable and unsecure type of Pipe

PropagateType

public static final java.lang.String PropagateType
Propagated, unsecure and unreliable type of Pipe

UnicastSecureType

public static final java.lang.String UnicastSecureType
Unicast and secure type of Pipe
Method Detail

createInputPipe

public InputPipe createInputPipe(PipeAdvertisement adv)
                          throws java.io.IOException
create an InputPipe from a pipe Advertisement
Parameters:
adv - is the advertisement of the PipeService.
Returns:
InputPipe InputPipe object created
Throws:
java.io.IOException - error creating input pipe
Since:
JXTA 1.0

createInputPipe

public InputPipe createInputPipe(PipeAdvertisement adv,
                                 PipeMsgListener listener)
                          throws java.io.IOException
create an InputPipe from a pipe Advertisement
Parameters:
adv - is the advertisement of the PipeService.
listener - PipeMsgListener to receive msgs.
Returns:
InputPipe InputPipe object created
Throws:
java.io.IOException - error creating input pipe
Since:
JXTA 1.0

createOutputPipe

public OutputPipe createOutputPipe(PipeAdvertisement adv,
                                   long timeout)
                            throws java.io.IOException
create an OutputPipe from the pipe Advertisement
Parameters:
adv - is the advertisement of the PipeService.
timeout - time createOutputPipe will block: -1 means indefinitely, otherwise, timeout in millisecond
Returns:
OuputPipe Output pip object
Throws:
java.io.IOException - error creating output pipe
Since:
JXTA 1.0

createOutputPipe

public void createOutputPipe(PipeAdvertisement adv,
                             OutputPipeListener listener)
                      throws java.io.IOException
registers a listener for a NetPipe.
Parameters:
adv - is the advertisement of the PipeService.
type - is an int and contains the name of the diffusion mode for this OutputPipe (NonBlocking, HandChecking, Propagate).
OutPutPipeListener - listener to be called back when a pipe is resolved
Throws:
java.io.IOException - error creating a listener for the type of output pipe
Since:
JXTA 1.0

createOutputPipe

public OutputPipe createOutputPipe(PipeAdvertisement adv,
                                   java.util.Enumeration peers,
                                   long timeout)
                            throws java.io.IOException
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 an enumeration of the PeerId of the peers where to look for the corresponding Pipes
timeout - time createOutputPipe will block: -1 means indefinitely, otherwise, timeout in millisecond
Returns:
OuputPipe
Throws:
java.io.IOException - if none of the peers in the enumeration has the corresponding OutputPipe
Since:
JXTA 1.0

createMessage

public Message createMessage()
Creates a new Message
Returns:
Message returns a newly allocated PipeService Message.
Since:
JXTA 1.0

removeOutputPipeListener

public OutputPipeListener removeOutputPipeListener(java.lang.String pipeID,
                                                   OutputPipeListener listener)
remove a Output pipe listener
Parameters:
OutputPipeListener - listener to remove
Returns:
OutputPipeListener the value to which the key had been mapped in this hashtable, or null if the key did not have a mapping.

Project JXTA