synergynetframework.appsystem.services.net.tablecomms.client
Class TableCommsClientService

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

public class TableCommsClientService
extends SynergyNetService
implements MessageHandler

The Class TableCommsClientService.


Constructor Summary
TableCommsClientService()
          Instantiates a new table comms client service.
 
Method Summary
static java.lang.String getClassName(java.lang.Class<?> c)
          Gets the class name.
 Client getClient()
          Gets the client.
 java.util.List<TableIdentity> getCurrentlyOnline()
          Gets the currently online.
 ClientMessageProcessor getProcessor(java.lang.String classname)
          Gets the processor.
 ClientMessageProcessor getProcessor(TableMessage msg)
          Gets the processor.
 void handlerConnected(ConnectionHandler connectionHandler)
          Handler connected.
 void handlerDisconnected(ConnectionHandler connectionHandler)
          Handler disconnected.
 boolean hasStarted()
          Checks for started.
 boolean isClientConnected()
          Checks if is client connected.
 boolean isConnected()
          Checks if is connected.
static void main(java.lang.String[] args)
          The main method.
 void messageReceived(java.lang.Object obj, ConnectionHandler handler)
          Message received.
 void register(java.lang.Object caller, TableCommsApplicationListener applistener)
          Register a TableCommsApplicationListener object for listening.
 void register(java.lang.String name, TableCommsApplicationListener applistener)
          Register a TableCommsApplicationListener object for listening.
 void sendMessage(java.lang.Object obj)
          Send message.
 void shutdown()
          Shutdown.
 void start()
          Start.
 void stop()
          Stop.
 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
 

Constructor Detail

TableCommsClientService

public TableCommsClientService()
Instantiates a new table comms client 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

main

public static void main(java.lang.String[] args)
                 throws CouldNotStartServiceException
The main method.

Parameters:
args - the arguments
Throws:
CouldNotStartServiceException - the could not start service exception

getClient

public Client getClient()
Gets the client.

Returns:
the client

getCurrentlyOnline

public java.util.List<TableIdentity> getCurrentlyOnline()
Gets the currently online.

Returns:
the currently online

getProcessor

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

Parameters:
classname - the classname
Returns:
the processor

getProcessor

public ClientMessageProcessor getProcessor(TableMessage msg)
Gets the processor.

Parameters:
msg - the msg
Returns:
the processor

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

isClientConnected

public boolean isClientConnected()
Checks if is client connected.

Returns:
true, if is client connected

isConnected

public boolean isConnected()
Checks if is connected.

Returns:
true, if is connected

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

register

public void register(java.lang.Object caller,
                     TableCommsApplicationListener applistener)
              throws java.io.IOException
Register a TableCommsApplicationListener object for listening. Convenience method that calls register() with the class name of the caller object. This allows an associated class to register a different TableCommsApplicationListener.

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

register

public void register(java.lang.String name,
                     TableCommsApplicationListener applistener)
              throws java.io.IOException
Register a TableCommsApplicationListener object for listening.

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

sendMessage

public void sendMessage(java.lang.Object obj)
                 throws java.io.IOException
Send message.

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

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()
          throws ServiceNotRunningException
Description copied from class: SynergyNetService
Stop.

Specified by:
stop in class SynergyNetService
Throws:
ServiceNotRunningException - the service not running exception

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