amber.client
Interface ConnectionModule

All Known Implementing Classes:
SocketConnection

public interface ConnectionModule

This interface is required by all connection modules which connect from the client to the server for Amber. As the modules are dynamically instantiated the derived class must also have a default constructor. This class is also responsible for ensuring a reliable connection which reestablishes itself when the connection fails.

Version:
1.0.0
Author:
Dr. David J. Knowles
See Also:
RComponent

Method Summary
 void close()
          Closes the connection to the remote server.
 void commLinkLost()
          This function is called when the system has detected a communications fault to the server.
 void forwardPacket(Packet packet)
          Called by the ReceiveThread and any internal functions when a packet is to be sent to its required destination.
 void init(BaseComponent parent, Packet initialPacket, int clientType, java.lang.Object configuration)
          This function initialises the connection module and establishes a link to the Amber server.
 void sendPacket(Packet packet)
          Sends a packet to the remote server.
 void setSessionId(java.lang.String sessionId)
          Sets the internal session identifier which is used when the connection is reestablished.
 

Method Detail

init

public void init(BaseComponent parent,
                 Packet initialPacket,
                 int clientType,
                 java.lang.Object configuration)
          throws java.io.IOException
This function initialises the connection module and establishes a link to the Amber server. At some point in the initialisation the function will call the parent object with the initial session packet. The parent MUST in turn set the session ID before returning.
Parameters:
parent - BaseComponent handle of the parent master object.
initialPacket - to send to the server.
clientType - int type of client object connecting.
configuration - Object containing optional configuration information. If this object is null the module will query the parent using getParameter to get the required information.
Returns:
Packet containing the initial session packet.
Throws:
java.io.IOException - with any connection problems.

setSessionId

public void setSessionId(java.lang.String sessionId)
Sets the internal session identifier which is used when the connection is reestablished.
Parameters:
sessionId - String containing the session identifier.

sendPacket

public void sendPacket(Packet packet)
Sends a packet to the remote server.
Parameters:
packet - Packet to send to the server.

forwardPacket

public void forwardPacket(Packet packet)
                   throws AmberException
Called by the ReceiveThread and any internal functions when a packet is to be sent to its required destination. This function examines the packet and passes it to the appropriate applet.
Parameters:
packet - Packet containing the information to send to the specified component.
Throws:
AmberException - containing any errors.

commLinkLost

public void commLinkLost()
This function is called when the system has detected a communications fault to the server. It is the responsibility of the module to reestablish the link to the server.

close

public void close()
Closes the connection to the remote server.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.