toolbox.socket
Class SocketClientImpl

Package class diagram package SocketClientImpl
java.lang.Object
  extended by toolbox.socket.SocketClientImpl
All Implemented Interfaces:
SocketClient

public class SocketClientImpl
extends java.lang.Object
implements SocketClient

The default implementation of the SocketClient interface.


Constructor Summary
SocketClientImpl()
          Default constructor.
 
Method Summary
 void destroy()
          Destroy this client.
 void init(SocketConnectionManager connMngr, SocketProtocolHandler handler)
          Initialise this client with the provided infrastructure components to facilitate socket communications.
 void publish(java.lang.String payload)
          This method facilitates 1-way fire and forget client socket communication.
 java.lang.String request(java.lang.String payload)
          This method facilitates 2-way synchronous client socket communication.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketClientImpl

public SocketClientImpl()
Default constructor.

Method Detail

init

public void init(SocketConnectionManager connMngr,
                 SocketProtocolHandler handler)
Initialise this client with the provided infrastructure components to facilitate socket communications.

Specified by:
init in interface SocketClient
Parameters:
connMngr - SocketConnectionManager responsible for managing client socket connections.
handler - SocketProtocolHandler responsible for sending and receiving data over a client socket connection.

request

public java.lang.String request(java.lang.String payload)
                         throws SocketClientException
This method facilitates 2-way synchronous client socket communication.

Specified by:
request in interface SocketClient
Parameters:
payload - Sring containing the request data.
Returns:
String containing the response data.
Throws:
SocketClientException - when an error occurs during socket communication.

publish

public void publish(java.lang.String payload)
             throws SocketClientException
This method facilitates 1-way fire and forget client socket communication.

Specified by:
publish in interface SocketClient
Parameters:
payload - String containing the data that must be plublished.
Throws:
SocketClientException - when an error occurs during socket communication.

destroy

public void destroy()
Destroy this client.

Specified by:
destroy in interface SocketClient