p2ps.endpoint
Interface EndpointResolver

All Known Implementing Classes:
AbstractEndpointResolver

public interface EndpointResolver

The service for creating input/output socket for a particulat transport protocol, and for resolving the addresses of socket on remote peers.

Version:
$Revision: 295 $
Author:
Ian Wang

Method Summary
 Endpoint connectOutputEndpoint(java.net.URI uri, SecurityContext remotecontext)
          Connects an endpoint to output to the specified uri
 Endpoint createInputEndpoint(java.lang.String pipeid, java.lang.String scheme)
          Create a endpoint for the specified scheme
 Endpoint createInputEndpoint(java.lang.String pipeid, java.net.URI uri)
          Create a endpoint for the specified input pipe bound the specified uri address
 EndpointResolverAdvertisement getAdvertisement()
           
 java.lang.String[] getEndpointSchemes()
           
 java.lang.String[] getGroupIDs(java.net.URI uri)
           
 java.lang.String getPeerID(java.net.URI uri)
           
 java.lang.String getPipeID(java.net.URI uri)
           
 java.lang.String[] getPipeSchemes()
           
 Endpoint[] getResolverEndpoints()
           
 java.net.URI getResolverEndpointURI(java.lang.String scheme)
           
 java.net.URI[] getResolverEndpointURIs()
           
 java.lang.String[] getResolverForPeerIDs()
           
 void init(Peer peer)
          Initialises the endpoint resolver
 boolean isEndpointScheme(java.lang.String scheme)
           
 boolean isPipeScheme(java.lang.String scheme)
           
 boolean isSchemeInputEnabled(java.lang.String scheme)
           
 boolean isSchemeOutputEnabled(java.lang.String scheme)
           
 void resolveEndpoint(byte[] query, java.net.URI resolveruri)
          Sends an endpoint query for the specified pipe id to the specified endpoint uri.
 void setSchemeEnabled(java.lang.String scheme, boolean input, boolean output)
          Sets whether input and output using the specified scheme is enabled
 

Method Detail

init

public void init(Peer peer)
          throws java.io.IOException
Initialises the endpoint resolver

Throws:
java.io.IOException

getPipeID

public java.lang.String getPipeID(java.net.URI uri)
Returns:
the pipe id from a URI (null if unkown scheme or uri does not contain the pipe id)

getPeerID

public java.lang.String getPeerID(java.net.URI uri)
Returns:
the peer id from a URI (null if unkown scheme or uri does not contain the peer id)

getGroupIDs

public java.lang.String[] getGroupIDs(java.net.URI uri)
Returns:
an array of group ids from a URI (null if unkown scheme)

getEndpointSchemes

public java.lang.String[] getEndpointSchemes()
Returns:
an array of the endpoint schemes handled by this resolver. An endpoint scheme is one from which a concrete endpoint can be created by this resolver without using endpoint resolution.

getPipeSchemes

public java.lang.String[] getPipeSchemes()
Returns:
an array of the pipe schemes handled by this resolver. A pipe scheme is one from which a pipe can be created using endpoint resolution (if required)

isEndpointScheme

public boolean isEndpointScheme(java.lang.String scheme)
Returns:
true if the specified scheme is an endpoint scheme

isPipeScheme

public boolean isPipeScheme(java.lang.String scheme)
Returns:
true if the specified scheme is an pipe scheme

isSchemeInputEnabled

public boolean isSchemeInputEnabled(java.lang.String scheme)
Returns:
true if input using the specified scheme is enabled

isSchemeOutputEnabled

public boolean isSchemeOutputEnabled(java.lang.String scheme)
Returns:
true if output using the specified scheme is enabled

setSchemeEnabled

public void setSchemeEnabled(java.lang.String scheme,
                             boolean input,
                             boolean output)
Sets whether input and output using the specified scheme is enabled


getResolverEndpoints

public Endpoint[] getResolverEndpoints()
Returns:
the resolver endpoint

getResolverEndpointURIs

public java.net.URI[] getResolverEndpointURIs()
                                       throws java.io.IOException
Returns:
the address of the resolver endpoint
Throws:
java.io.IOException

getResolverEndpointURI

public java.net.URI getResolverEndpointURI(java.lang.String scheme)
                                    throws java.io.IOException
Returns:
the address of the resolver endpoint for the specified scheme (null if no endpoint for specified scheme)
Throws:
java.io.IOException

getResolverForPeerIDs

public java.lang.String[] getResolverForPeerIDs()
Returns:
the ids of the peers this resolver handles enpoint resolution for

getAdvertisement

public EndpointResolverAdvertisement getAdvertisement()
                                               throws java.io.IOException
Returns:
a pipe resolver advert for this resolver (or null if not advertisable)
Throws:
java.io.IOException

createInputEndpoint

public Endpoint createInputEndpoint(java.lang.String pipeid,
                                    java.lang.String scheme)
                             throws java.io.IOException
Create a endpoint for the specified scheme

Throws:
java.io.IOException

createInputEndpoint

public Endpoint createInputEndpoint(java.lang.String pipeid,
                                    java.net.URI uri)
                             throws java.io.IOException
Create a endpoint for the specified input pipe bound the specified uri address

Throws:
java.io.IOException

connectOutputEndpoint

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

Throws:
java.io.IOException

resolveEndpoint

public void resolveEndpoint(byte[] query,
                            java.net.URI resolveruri)
                     throws java.io.IOException
Sends an endpoint query for the specified pipe id to the specified endpoint uri. Responses are notified to endpoint resolution listeneers

Throws:
java.io.IOException