synergynetframework.appsystem.services.net.tablecomms.server
Class TableCommsServerService

java.lang.Object
  extended by synergynetframework.appsystem.services.SynergyNetService
      extended by synergynetframework.appsystem.services.net.tablecomms.server.TableCommsServerService
All Implemented Interfaces:
MessageHandler

public class TableCommsServerService
extends SynergyNetService
implements MessageHandler

The Class TableCommsServerService.


Field Summary
static java.lang.String SERVICE_NAME
          The Constant SERVICE_NAME.
static java.lang.String SERVICE_TYPE
          The Constant SERVICE_TYPE.
static int TCP_PORT
          The Constant TCP_PORT.
static int UDP_PORT
          The Constant UDP_PORT.
 
Constructor Summary
TableCommsServerService()
          Instantiates a new table comms server service.
 
Method Summary
 void broadcast(TableMessage obj)
          Broadcast.
 java.util.List<java.lang.String> getApplicationsRegisteredForHandler(ConnectionHandler handler)
          Gets the applications registered for handler.
 java.util.List<java.lang.String> getApplicationsRegisteredForTable(TableIdentity id)
          Gets the applications registered for table.
static java.lang.String getClassName(java.lang.Class<?> c)
          Gets the class name.
 java.util.List<ConnectionHandler> getHandlersForApplication(java.lang.String name)
          Gets the handlers for application.
 java.util.List<ServerMonitor> getMonitors()
          Gets the monitors.
 ServerMessageProcessor getProcessor(java.lang.String classname)
          Gets the processor.
 ServerMessageProcessor getProcessor(TableMessage msg)
          Gets the processor.
 java.util.Map<TableIdentity,ConnectionHandler> getReceivers()
          Gets the receivers.
 TableIdentity getTableIdentityForHandler(ConnectionHandler handler)
          Gets the table identity for handler.
 void handlerConnected(ConnectionHandler connectionHandler)
          Handler connected.
 void handlerDisconnected(ConnectionHandler connectionHandler)
          Handler disconnected.
 boolean hasStarted()
          Checks for started.
 void messageReceived(java.lang.Object obj, ConnectionHandler handler)
          Message received.
 void registerHandlerForApplication(java.lang.String name, ConnectionHandler handler)
          Register handler for application.
 void registerServerMonitor(ServerMonitor m)
          Register server monitor.
 void removeApplicationAssociationForHandler(ConnectionHandler handler)
          Removes the application association for handler.
 void shutdown()
          Shutdown.
 void start()
          Start.
 void stop()
          Stop.
 void unregisterHandlerForApplication(java.lang.String name, ConnectionHandler handler)
          Unregister handler for application.
 void update()
          Used to avoid threading issues.
 
Methods inherited from class synergynetframework.appsystem.services.SynergyNetService
registerServiceMessageListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
The Constant SERVICE_NAME.

See Also:
Constant Field Values

SERVICE_TYPE

public static final java.lang.String SERVICE_TYPE
The Constant SERVICE_TYPE.

See Also:
Constant Field Values

TCP_PORT

public static final int TCP_PORT
The Constant TCP_PORT.

See Also:
Constant Field Values

UDP_PORT

public static final int UDP_PORT
The Constant UDP_PORT.

See Also:
Constant Field Values
Constructor Detail

TableCommsServerService

public TableCommsServerService()
Instantiates a new table comms server service.

Method Detail

getClassName

public static java.lang.String getClassName(java.lang.Class<?> c)
Gets the class name.

Parameters:
c - the c
Returns:
the class name

broadcast

public void broadcast(TableMessage obj)
               throws java.io.IOException
Broadcast.

Parameters:
obj - the obj
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

getApplicationsRegisteredForHandler

public java.util.List<java.lang.String> getApplicationsRegisteredForHandler(ConnectionHandler handler)
Gets the applications registered for handler.

Parameters:
handler - the handler
Returns:
the applications registered for handler

getApplicationsRegisteredForTable

public java.util.List<java.lang.String> getApplicationsRegisteredForTable(TableIdentity id)
Gets the applications registered for table.

Parameters:
id - the id
Returns:
the applications registered for table

getHandlersForApplication

public java.util.List<ConnectionHandler> getHandlersForApplication(java.lang.String name)
Gets the handlers for application.

Parameters:
name - the name
Returns:
the handlers for application

getMonitors

public java.util.List<ServerMonitor> getMonitors()
Gets the monitors.

Returns:
the monitors

getProcessor

public ServerMessageProcessor getProcessor(java.lang.String classname)
Gets the processor.

Parameters:
classname - the classname
Returns:
the processor

getProcessor

public ServerMessageProcessor getProcessor(TableMessage msg)
Gets the processor.

Parameters:
msg - the msg
Returns:
the processor

getReceivers

public java.util.Map<TableIdentity,ConnectionHandler> getReceivers()
Gets the receivers.

Returns:
the receivers

getTableIdentityForHandler

public TableIdentity getTableIdentityForHandler(ConnectionHandler handler)
Gets the table identity for handler.

Parameters:
handler - the handler
Returns:
the table identity for handler

handlerConnected

public void handlerConnected(ConnectionHandler connectionHandler)
Description copied from interface: MessageHandler
Handler connected.

Specified by:
handlerConnected in interface MessageHandler
Parameters:
connectionHandler - the connection handler

handlerDisconnected

public void handlerDisconnected(ConnectionHandler connectionHandler)
Description copied from interface: MessageHandler
Handler disconnected.

Specified by:
handlerDisconnected in interface MessageHandler
Parameters:
connectionHandler - the connection handler

hasStarted

public boolean hasStarted()
Description copied from class: SynergyNetService
Checks for started.

Specified by:
hasStarted in class SynergyNetService
Returns:
true, if successful

messageReceived

public void messageReceived(java.lang.Object obj,
                            ConnectionHandler handler)
Description copied from interface: MessageHandler
Message received.

Specified by:
messageReceived in interface MessageHandler
Parameters:
obj - the object
handler - the connection handler

registerHandlerForApplication

public void registerHandlerForApplication(java.lang.String name,
                                          ConnectionHandler handler)
Register handler for application.

Parameters:
name - the name
handler - the handler

registerServerMonitor

public void registerServerMonitor(ServerMonitor m)
Register server monitor.

Parameters:
m - the m

removeApplicationAssociationForHandler

public void removeApplicationAssociationForHandler(ConnectionHandler handler)
Removes the application association for handler.

Parameters:
handler - the handler

shutdown

public void shutdown()
Description copied from class: SynergyNetService
Shutdown.

Specified by:
shutdown in class SynergyNetService

start

public void start()
           throws CouldNotStartServiceException
Description copied from class: SynergyNetService
Start.

Throws:
CouldNotStartServiceException - the could not start service exception

stop

public void stop()
Description copied from class: SynergyNetService
Stop.

Specified by:
stop in class SynergyNetService

unregisterHandlerForApplication

public void unregisterHandlerForApplication(java.lang.String name,
                                            ConnectionHandler handler)
Unregister handler for application.

Parameters:
name - the name
handler - the handler

update

public void update()
Description copied from class: SynergyNetService
Used to avoid threading issues. Should be called periodically to ensure the service updates appropriately.

Specified by:
update in class SynergyNetService