org.ros.internal.node.service
Class DefaultServiceClient<T,S>

java.lang.Object
  extended by org.ros.internal.node.service.DefaultServiceClient<T,S>
All Implemented Interfaces:
ServiceClient<T,S>

public class DefaultServiceClient<T,S>
extends java.lang.Object
implements ServiceClient<T,S>


Method Summary
 void call(T request, ServiceResponseListener<S> listener)
          Calls a method on the ServiceServer.
 void connect(java.net.URI uri)
          Connects to a ServiceServer.
 GraphName getName()
           
static
<S,T> DefaultServiceClient<S,T>
newDefault(GraphName nodeName, ServiceDeclaration serviceDeclaration, MessageSerializer<S> serializer, MessageDeserializer<T> deserializer, MessageFactory messageFactory, java.util.concurrent.ScheduledExecutorService executorService)
           
 T newMessage()
           
 void shutdown()
          Stops the client (e.g.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

newDefault

public static <S,T> DefaultServiceClient<S,T> newDefault(GraphName nodeName,
                                                         ServiceDeclaration serviceDeclaration,
                                                         MessageSerializer<S> serializer,
                                                         MessageDeserializer<T> deserializer,
                                                         MessageFactory messageFactory,
                                                         java.util.concurrent.ScheduledExecutorService executorService)

connect

public void connect(java.net.URI uri)
Description copied from interface: ServiceClient
Connects to a ServiceServer.

Specified by:
connect in interface ServiceClient<T,S>
Parameters:
uri - the URI of the ServiceServer to connect to

shutdown

public void shutdown()
Description copied from interface: ServiceClient
Stops the client (e.g. disconnect a persistent service connection).

Specified by:
shutdown in interface ServiceClient<T,S>

call

public void call(T request,
                 ServiceResponseListener<S> listener)
Description copied from interface: ServiceClient
Calls a method on the ServiceServer.

Specified by:
call in interface ServiceClient<T,S>
Parameters:
request - the request message
listener - the ServiceResponseListener that will handle the response to this request

getName

public GraphName getName()
Specified by:
getName in interface ServiceClient<T,S>
Returns:
the name of the service this ServiceClient is connected to

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

newMessage

public T newMessage()
Specified by:
newMessage in interface ServiceClient<T,S>
Returns:
a new request message