JBoss Remoting 3.0.0.Beta2

org.jboss.remoting
Interface Endpoint

All Superinterfaces:
Closeable, HandleableCloseable<Endpoint>

public interface Endpoint
extends HandleableCloseable<Endpoint>

A potential participant in a JBoss Remoting communications relationship.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.remoting.HandleableCloseable
HandleableCloseable.Key
 
Method Summary
 SimpleCloseable addServiceListener(ServiceListener serviceListener, boolean onlyNew)
          Add a listener for observing when local and remote services are added.
<I,O> Client<I,O>
createClient(RequestHandler handler, Class<I> requestClass, Class<O> replyClass)
          Create a client that uses the given request handler to handle its requests.
<I,O> ClientSource<I,O>
createClientSource(RequestHandlerSource handlerSource, Class<I> requestClass, Class<O> replyClass)
          Create a client source that uses the given request handler source to generate clients.
<I,O> Handle<RequestHandler>
createRequestHandler(RequestListener<I,O> requestListener, Class<I> requestClass, Class<O> replyClass)
          Create a request handler that can be used to receive incoming requests on this endpoint.
 ConcurrentMap<Object,Object> getAttributes()
          Get the endpoint attribute map.
 String getName()
          Get the name of this endpoint.
<I,O> IoFuture<ClientSource<I,O>>
locateService(URI serviceUri, Class<I> requestClass, Class<O> replyClass)
          Attempt to locate a service.
 SimpleCloseable registerRemoteService(RemoteServiceConfiguration configuration)
          Register a remotely available service.
<I,O> Handle<RequestHandlerSource>
registerService(LocalServiceConfiguration<I,O> configuration)
          Create a request handler source that can be used to acquire clients associated with a request listener on this endpoint.
 
Methods inherited from interface org.jboss.remoting.HandleableCloseable
addCloseHandler, close
 

Method Detail

getAttributes

ConcurrentMap<Object,Object> getAttributes()
Get the endpoint attribute map. This is a storage area for any data associated with this endpoint, including (but not limited to) connection and protocol information, and application information. You must have the TODO permission to invoke this method.

Returns:
the endpoint map

getName

String getName()
Get the name of this endpoint.

Returns:
the endpoint name, or null if there is no name

createRequestHandler

<I,O> Handle<RequestHandler> createRequestHandler(RequestListener<I,O> requestListener,
                                                  Class<I> requestClass,
                                                  Class<O> replyClass)
                                            throws IOException
Create a request handler that can be used to receive incoming requests on this endpoint. The client may be passed to a remote endpoint as part of a request or a reply, or it may be used locally. You must have the createRequestHandler EndpointPermission to invoke this method.

Type Parameters:
I - the request type
O - the reply type
Parameters:
requestListener - the request listener
requestClass - the class of requests sent to this request listener
replyClass - the class of replies received back from this request listener
Returns:
a handle for the client
Throws:
IOException - if an error occurs

registerService

<I,O> Handle<RequestHandlerSource> registerService(LocalServiceConfiguration<I,O> configuration)
                                             throws IOException
Create a request handler source that can be used to acquire clients associated with a request listener on this endpoint. The request handler source may be ignored, passed to a remote endpoint as part of a request or a reply, or used locally. The objects that are produced by this method may be used to mass-produce RequestHandler instances. You must have the registerService EndpointPermission to invoke this method.

Type Parameters:
I - the request type
O - the reply type
Parameters:
configuration - the configuration to use
Throws:
IOException - if an error occurs

createClient

<I,O> Client<I,O> createClient(RequestHandler handler,
                               Class<I> requestClass,
                               Class<O> replyClass)
                         throws IOException
Create a client that uses the given request handler to handle its requests. You must have the createClient EndpointPermission to invoke this method.

Type Parameters:
I - the request type
O - the reply type
Parameters:
handler - the request handler
requestClass - the class of requests sent through this client
replyClass - the class of replies received back through this client
Returns:
the client
Throws:
IOException - if an error occurs

createClientSource

<I,O> ClientSource<I,O> createClientSource(RequestHandlerSource handlerSource,
                                           Class<I> requestClass,
                                           Class<O> replyClass)
                                     throws IOException
Create a client source that uses the given request handler source to generate clients. You must have the createClientSource EndpointPermission to invoke this method.

Type Parameters:
I - the request type
O - the reply type
Parameters:
handlerSource - the request handler source
requestClass - the class of requests sent through this client source
replyClass - the class of replies received back through this client source
Returns:
the client source
Throws:
IOException - if an error occurs

locateService

<I,O> IoFuture<ClientSource<I,O>> locateService(URI serviceUri,
                                                Class<I> requestClass,
                                                Class<O> replyClass)
                                          throws IllegalArgumentException
Attempt to locate a service. The return value then be queried for the service's ClientSource.

Type Parameters:
I - the request type
O - the reply type
Parameters:
serviceUri - the URI of the service
requestClass - the class of requests sent through the client source
replyClass - the class of replies received back through the client source
Returns:
the future service
Throws:
IllegalArgumentException - if the given URI is not a valid Remoting service URI

registerRemoteService

SimpleCloseable registerRemoteService(RemoteServiceConfiguration configuration)
                                      throws IllegalArgumentException,
                                             IOException
Register a remotely available service.

The remote endpoint must not have the same name as this endpoint. The group name and service type must be non-null and non-empty. The metric must be greater than zero. You must have the registerRemoteService EndpointPermission to invoke this method.

Parameters:
configuration - the remote service configuration
Returns:
a closeable that may be used to remove the registration
Throws:
IllegalArgumentException - if one of the given arguments was not valid
IOException - if an error occurs with the registration

addServiceListener

SimpleCloseable addServiceListener(ServiceListener serviceListener,
                                   boolean onlyNew)
Add a listener for observing when local and remote services are added. The caller may specify whether the listener should be notified of the complete list of currently registered services (set onlyNew to false) or only services registered after the time of calling this method (set onlyNew to true). You must have the addServiceListener EndpointPermission to invoke this method.

Parameters:
serviceListener - the listener
onlyNew - true if only new registrations should be sent to the listener
Returns:
a handle which may be used to unregister the listener

JBoss Remoting 3.0.0.Beta2

Copyright © 2008 JBoss, a division of Red Hat, Inc.