com.ls.lars.communication
Class ClientSynchronization

java.lang.Object
  |
  +--com.ls.lars.communication.ClientSynchronization

public class ClientSynchronization
extends Object

This class is used to connect to other lars platform. It is the client side of the lars platform sychronization.

Version:
$Revision: 1.19 $
Author:
Last modified by $Author: CReich $

Field Summary
protected  String revisionInformation
          revision information string, managed by our version control system.
 
Constructor Summary
ClientSynchronization(String remoteIP, String remoteID, int remotePort, String agentMessageRouterName, String homePlatform, ILogger logger, Map remoteConnectionParameters)
          Constructor which builds the communication part for the messenger of the platform synchronization.
 
Method Summary
 void closeMessengerConnection()
          Method closes given connections to remote platforms actively by calling closeConnection() of the messenger.
static void closePlatformConnection(String platformMessengerName)
          Method closes given connections to remote platforms actively and removes the Messenger from the MessageRouter.
static boolean connectionStatus(String platformMessengerName, String platformConnectionType, ILogger logger)
          Method checks the connection status of an messenger.
 void makeJMSConnection(int connectionTimeout)
          Method makes an platform connection using a JMSMessenger.
 void makeJSecureSocketConnection(int connectionTimeout, String agentName, int authenticationTimeout)
          Method makes an platform connection using a JSecureSocketMessenger.
 void makeJSocketConnection(int connectionTimeout)
          Method makes an platform connection using a JSocketMessenger.
 void makeRMIConnection(int connectionTimeout)
          Method makes an platform connection using a RMIMessenger.
 void makeSocketConnection(int connectionTimeout)
          Method makes an platform connection using a SocketMessenger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

revisionInformation

protected String revisionInformation
revision information string, managed by our version control system.
Constructor Detail

ClientSynchronization

public ClientSynchronization(String remoteIP,
                             String remoteID,
                             int remotePort,
                             String agentMessageRouterName,
                             String homePlatform,
                             ILogger logger,
                             Map remoteConnectionParameters)
Constructor which builds the communication part for the messenger of the platform synchronization.
Parameters:
remoteIP - IP address of the remote platform.
remoteID - Lars platform ID of the remote platform.
remotePort - Port of the remote platform.
agentMessageRouterName - Name of the agent message router.
homePlatform - Platform ID of the local platform.
logger - Agent log of the calling agent.
remoteConnectionParameters - Connection parameters of the remote platform.
Method Detail

makeSocketConnection

public void makeSocketConnection(int connectionTimeout)
                          throws ConnectionException
Method makes an platform connection using a SocketMessenger.
Parameters:
connectionTimeout - Time to wait to establish a connection.
Throws:
ConnectionException - If the connection to the remote platform fails.

makeJSocketConnection

public void makeJSocketConnection(int connectionTimeout)
                           throws ConnectionException
Method makes an platform connection using a JSocketMessenger.
Parameters:
connectionTimeout - Time to wait to establish a connection.
Throws:
ConnectionException - If the connection to the remote platform fails.

makeJSecureSocketConnection

public void makeJSecureSocketConnection(int connectionTimeout,
                                        String agentName,
                                        int authenticationTimeout)
                                 throws ConnectionException
Method makes an platform connection using a JSecureSocketMessenger.
Parameters:
connectionTimeout - Time to wait to establish a connection.
agentName - Name of the agent.
authenticationTimeout - Time to wait to check authentication.
Throws:
ConnectionException - If the connection to the remote platform fails or authentication fails.

makeRMIConnection

public void makeRMIConnection(int connectionTimeout)
                       throws ConnectionException
Method makes an platform connection using a RMIMessenger.
Parameters:
connectionTimeout - Time to wait to establish a connection.
Throws:
ConnectionException - If the connection to the remote platform fails.

makeJMSConnection

public void makeJMSConnection(int connectionTimeout)
                       throws ConnectionException
Method makes an platform connection using a JMSMessenger.
Parameters:
connectionTimeout - Time to wait to establish a connection.
Throws:
ConnectionException - If the connection to the remote platform fails.

closeMessengerConnection

public void closeMessengerConnection()
Method closes given connections to remote platforms actively by calling closeConnection() of the messenger.

closePlatformConnection

public static void closePlatformConnection(String platformMessengerName)
Method closes given connections to remote platforms actively and removes the Messenger from the MessageRouter.
Parameters:
platformMessengerName - Name of the associated platform messenger.

connectionStatus

public static boolean connectionStatus(String platformMessengerName,
                                       String platformConnectionType,
                                       ILogger logger)
Method checks the connection status of an messenger.
Parameters:
platformMessengerName - Name of the platform messenger.
platformConnectionType - Type of the messenger (RMI, socket, ...).
logger - Logger to use to log the messages.
Returns:
true if the connection to a messenger is alive, else false