p2ps.pipe
Interface PipeService

All Known Implementing Classes:
PipeServiceImp

public interface PipeService

The service for constructing pipes between peers.

Version:
$Revision: 295 $
Author:
Ian Wang

Method Summary
 void addPipeConnectionListener(PipeConnectionListener listener)
          Adds a pipe connection listener to the pipe service
 Endpoint connectOutputEndpoint(java.net.URI uri)
          Connects and intializes an output endpoint to the specified URI.
 Endpoint connectOutputEndpoint(java.net.URI uri, boolean init, SecurityContext context)
          Connects an output endpoint to the specified URI
 void connectOutputPipe(PipeAdvertisement pipead)
          Attempts to connect an output pipe to the pipe specified in the advert.
 void connectOutputPipe(java.net.URI uri)
          Attempts to connect an output pipe to the specified URI.
 Endpoint createInputEndpoint(java.net.URI uri)
          Creates and initializes input endpoint for the specified URI
 Endpoint createInputEndpoint(java.net.URI uri, boolean init)
          Creates an input endpoint for the specified URI
 Endpoint[] createInputEndpoints(PipeAdvertisement pipead, boolean init)
           
 InputPipe createInputPipe(PipeAdvertisement pipead)
          Creates an input pipe using the specified advert
 InputPipe createInputPipe(PipeAdvertisement pipead, Endpoint[] endpoints)
          Creates an input pipe using the specified advert with the specified set of endpoints.
 InputPipe createInputPipe(java.net.URI uri)
          Creates an input pipe for the specified URI
 EndpointResolver[] getEndpointResolvers()
           
 java.lang.String[] getEndpointSchemes(boolean input)
           
 EndpointResolver[] getPipeResolvers(java.lang.String scheme, boolean input)
           
 java.lang.String[] getPipeSchemes(boolean input)
           
 void init()
          Initialises the pipe service
 boolean isEndpointScheme(java.lang.String scheme, boolean input)
           
 boolean isPipeSchemes(java.lang.String scheme, boolean input)
           
 void register(EndpointResolver resolver)
          Register a pipe resolver to create pipes for a particular protocol
 void removePipeConnectionListener(PipeConnectionListener listener)
          Removes a pipe connection listener from the pipe service
 void unregister(EndpointResolver resolver)
          Unregister a pipe resolver
 

Method Detail

init

public void init()
          throws InitializationException,
                 java.io.IOException
Initialises the pipe service

Throws:
InitializationException
java.io.IOException

addPipeConnectionListener

public void addPipeConnectionListener(PipeConnectionListener listener)
Adds a pipe connection listener to the pipe service


removePipeConnectionListener

public void removePipeConnectionListener(PipeConnectionListener listener)
Removes a pipe connection listener from the pipe service


createInputEndpoint

public Endpoint createInputEndpoint(java.net.URI uri)
                             throws java.io.IOException
Creates and initializes input endpoint for the specified URI

Throws:
java.io.IOException

createInputEndpoint

public Endpoint createInputEndpoint(java.net.URI uri,
                                    boolean init)
                             throws java.io.IOException
Creates an input endpoint for the specified URI

Parameters:
uri - the uri to connect to
init - true if the endpoint should be initialized
Throws:
java.io.IOException

createInputEndpoints

public Endpoint[] createInputEndpoints(PipeAdvertisement pipead,
                                       boolean init)
                                throws UnknownSchemeException,
                                       java.io.IOException
Returns:
an array of endpoints for a pipe advertisement, optionally initializing.
Throws:
UnknownSchemeException
java.io.IOException

createInputPipe

public InputPipe createInputPipe(java.net.URI uri)
                          throws UnknownSchemeException,
                                 java.io.IOException
Creates an input pipe for the specified URI

Throws:
UnknownSchemeException
java.io.IOException

createInputPipe

public InputPipe createInputPipe(PipeAdvertisement pipead)
                          throws UnknownSchemeException,
                                 java.io.IOException
Creates an input pipe using the specified advert

Throws:
UnknownSchemeException
java.io.IOException

createInputPipe

public InputPipe createInputPipe(PipeAdvertisement pipead,
                                 Endpoint[] endpoints)
                          throws java.io.IOException
Creates an input pipe using the specified advert with the specified set of endpoints.

Throws:
java.io.IOException

connectOutputEndpoint

public Endpoint connectOutputEndpoint(java.net.URI uri)
                               throws UnknownSchemeException,
                                      java.io.IOException
Connects and intializes an output endpoint to the specified URI.

Throws:
UnknownSchemeException
java.io.IOException

connectOutputEndpoint

public Endpoint connectOutputEndpoint(java.net.URI uri,
                                      boolean init,
                                      SecurityContext context)
                               throws UnknownSchemeException,
                                      java.io.IOException
Connects an output endpoint to the specified URI

Parameters:
uri - the uri to connect to
init - true if the endpoint should be initialized
context -
Throws:
UnknownSchemeException
java.io.IOException

connectOutputPipe

public void connectOutputPipe(java.net.URI uri)
                       throws UnknownSchemeException,
                              java.io.IOException
Attempts to connect an output pipe to the specified URI. PipeConnectionListeners are notified when connection is achieved/fails.

Throws:
UnknownSchemeException
java.io.IOException

connectOutputPipe

public void connectOutputPipe(PipeAdvertisement pipead)
                       throws UnknownSchemeException,
                              java.io.IOException
Attempts to connect an output pipe to the pipe specified in the advert. PipeConnectionListeners are notified when connection is achieved/fails.

Throws:
UnknownSchemeException
java.io.IOException

register

public void register(EndpointResolver resolver)
Register a pipe resolver to create pipes for a particular protocol


unregister

public void unregister(EndpointResolver resolver)
Unregister a pipe resolver


getEndpointSchemes

public java.lang.String[] getEndpointSchemes(boolean input)
Parameters:
input - true if input schemes, false if output schemes
Returns:
the currently enabled endpoint schemes

isEndpointScheme

public boolean isEndpointScheme(java.lang.String scheme,
                                boolean input)
Parameters:
scheme - the scheme name
input - true if input scheme, false if output scheme
Returns:
true if the scheme is an enabled endpoint scheme

getPipeSchemes

public java.lang.String[] getPipeSchemes(boolean input)
Parameters:
input - true if input schemes, false if output schemes
Returns:
the currently enabled pipe schemes

isPipeSchemes

public boolean isPipeSchemes(java.lang.String scheme,
                             boolean input)
Parameters:
scheme - the scheme name
input - true if input scheme, false if output scheme
Returns:
true if the scheme is an enabled pipe scheme

getEndpointResolvers

public EndpointResolver[] getEndpointResolvers()
Returns:
the registered pipe resolvers for this peer

getPipeResolvers

public EndpointResolver[] getPipeResolvers(java.lang.String scheme,
                                           boolean input)
Returns:
the registered pipe resolvers for the specified scheme