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

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

public class DefaultServiceServer<T,S>
extends java.lang.Object
implements ServiceServer<T,S>

Default implementation of a ServiceServer.


Constructor Summary
DefaultServiceServer(ServiceDeclaration serviceDeclaration, ServiceResponseBuilder<T,S> serviceResponseBuilder, AdvertiseAddress advertiseAddress, MessageDeserializer<T> messageDeserializer, MessageSerializer<S> messageSerializer, MessageFactory messageFactory, java.util.concurrent.ScheduledExecutorService scheduledExecutorService)
           
 
Method Summary
 void addListener(ServiceServerListener<T,S> listener)
          Add a ServiceServerListener.
 org.jboss.netty.buffer.ChannelBuffer finishHandshake(java.util.Map<java.lang.String,java.lang.String> incomingHeader)
           
 GraphName getName()
           
 java.net.URI getUri()
           
 org.jboss.netty.channel.ChannelHandler newRequestHandler()
           
 void removeListener(ServiceServerListener<T,S> listener)
          Remove a ServiceServerListener.
 void shutdown()
          Stops the service and unregisters it.
 void signalOnMasterRegistrationFailure()
          Signal all ServiceServerListeners that the ServiceServer has failed to register with the master.
 void signalOnMasterRegistrationSuccess()
          Signal all ServiceServerListeners that the ServiceServer has been successfully registered with the master.
 void signalOnMasterUnregistrationFailure()
          Signal all ServiceServerListeners that the ServiceServer has failed to unregister with the master.
 void signalOnMasterUnregistrationSuccess()
          Signal all ServiceServerListeners that the ServiceServer has been successfully unregistered with the master.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultServiceServer

public DefaultServiceServer(ServiceDeclaration serviceDeclaration,
                            ServiceResponseBuilder<T,S> serviceResponseBuilder,
                            AdvertiseAddress advertiseAddress,
                            MessageDeserializer<T> messageDeserializer,
                            MessageSerializer<S> messageSerializer,
                            MessageFactory messageFactory,
                            java.util.concurrent.ScheduledExecutorService scheduledExecutorService)
Method Detail

finishHandshake

public org.jboss.netty.buffer.ChannelBuffer finishHandshake(java.util.Map<java.lang.String,java.lang.String> incomingHeader)

getUri

public java.net.URI getUri()
Specified by:
getUri in interface ServiceServer<T,S>
Returns:
the URI for this ServiceServer

getName

public GraphName getName()
Specified by:
getName in interface ServiceServer<T,S>
Returns:
the name of the ServiceServer

newRequestHandler

public org.jboss.netty.channel.ChannelHandler newRequestHandler()

signalOnMasterRegistrationSuccess

public void signalOnMasterRegistrationSuccess()
Signal all ServiceServerListeners that the ServiceServer has been successfully registered with the master.

Each listener is called in a separate thread.


signalOnMasterRegistrationFailure

public void signalOnMasterRegistrationFailure()
Signal all ServiceServerListeners that the ServiceServer has failed to register with the master.

Each listener is called in a separate thread.


signalOnMasterUnregistrationSuccess

public void signalOnMasterUnregistrationSuccess()
Signal all ServiceServerListeners that the ServiceServer has been successfully unregistered with the master.

Each listener is called in a separate thread.


signalOnMasterUnregistrationFailure

public void signalOnMasterUnregistrationFailure()
Signal all ServiceServerListeners that the ServiceServer has failed to unregister with the master.

Each listener is called in a separate thread.


shutdown

public void shutdown()
Description copied from interface: ServiceServer
Stops the service and unregisters it.

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

addListener

public void addListener(ServiceServerListener<T,S> listener)
Description copied from interface: ServiceServer
Add a ServiceServerListener.

Specified by:
addListener in interface ServiceServer<T,S>
Parameters:
listener - the ServiceServerListener to add

removeListener

public void removeListener(ServiceServerListener<T,S> listener)
Description copied from interface: ServiceServer
Remove a ServiceServerListener.

This has no effect if the specified ServiceServerListener was never added.

Specified by:
removeListener in interface ServiceServer<T,S>
Parameters:
listener - the ServiceServerListener to remove

toString

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