com.ls.lars.server
Class AgentSynchronization

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.ls.lars.communication.CommunicationTemplate
              |
              +--com.ls.lars.server.AgentTemplate
                    |
                    +--com.ls.lars.server.AgentSynchronization
All Implemented Interfaces:
ICommunication, IToLars, Runnable, Serializable
Direct Known Subclasses:
AgentPlatformSecurity, AgentSynchronizeConnectionHandler, AgentSynchronizeSupervisor

public abstract class AgentSynchronization
extends AgentTemplate

This agent is the abstract super class of all agent synchronization classes! They are:

In this class settings of the cfg-file, defined in the synchronization agents is read. The following messages are understood central for all agent snynchronize agent classes! ------------------------------------------------------------------------ set_constants ------------------------------------------------------------------------ Function: Information common for all synchronize agents is defined and read from the cfg-file. The content of the message is information about the local platform eventually needed by the platform synchronization. These are: - the names of the 3 synchronization agents. xml-tags are: <AgentSynchronizeSupervisor> ... <AgentSynchronizeConnectionHandler> ... <AgentPlatformSecurity> ... - the names and types of listener running on the local platform. The xml-tags are: <ownPlatformListener> <listenerName> ... <listenerType> ... </ownPlatformListener> - order of protocol, if you have more then one possiblity to connect to another platform you could define the prefered order. The xml-tag is: <preferredProtocolOrder> <protocolType> ... </preferredProtocolOrder> - synchronization intervals. There are two different ones. The attemptConnections is the time when the platform tries to reconnect a lost remote platform connection. The checkConnections is the time in what time interval the remote connections to other platforms are checked. The xml-tags are: <synchronizatonIntervals> <attemptConnections> ... <checkConnections> ... </synchronizatonIntervals> Parameters: own platform settings (HashMap) Responses: none ------------------------------------------------------------------------ synchronize_platforms ------------------------------------------------------------------------ Function: Information common for all synchronize agents is defined. and read from the cfg-file. The message contains the remote platform parameters to be connected. They are: - the names of the remote platforms - the ip address of the remote platform - the port to be connected to the remote platform - security policy (public, private, hidden) explained in AgentPlatformSecurity - the type of connection to be used to connect to the remote platform - the connection parameters of the connection The xml-tags are: <platform> <platformId> ... <ipAddress> ... <port> ... <access> ... <connectionType> ... <connectonParameters> ... </platform> Parameters: own platform settings (HashMap) Responses: none ------------------------------------------------------------------------

Version:
$Revision: 1.10 $
Author:
Last modified by $Author: MHeitz $
See Also:
Serialized Form

Inner Class Summary
protected  class AgentSynchronization.LarsPlatformRepresentation
          Inner class that represents lars remote platforms.
 
Field Summary
protected  Vector agentListener
          Member variable stores names of the agent listeners
protected  String agentPlatformSecurityName
          Member variable stores agent name of the AgentPlatformSecurity (default: aps)
protected  String agentSychronizeConnectionHandlerName
          Member variable stores agent name of the AgentSynchronizeConnectionHandler (default: asch)
protected  String agentSychronizeSupervisorName
          Member variable stores agent name of the AgentSynchronizeSupervisor (default: ass)
protected static String ATTEMPT_CONNECTIONS
          Constant representing a string constant in the cfg-file
protected static String CHECK_CONNECTIONS
          Constant representing a string constant in the cfg-file
protected  Vector initiallyKnownPlatforms
          Member variable representing the lars platforms initially known (read from the cfg-file)
protected static String LISTENER_NAME
          Constant represents the tag in the cfg-file for a listener
protected static String LISTENER_TYPE
          Constant represents the tag in the cfg-file for a listener type
protected  String ownPlatformIP
          Member variable of the own lars platform IP
protected  String ownPlatformName
          Member variable of the own lars platform name
protected static String PLATFORM_ACCESS
          Constant representing a string constant in the cfg-file for a hashtable key
protected static String PLATFORM_CONNECTION_TYPE
          Constant representing a string constant in the cfg-file for a hashtable key
protected static String PLATFORM_IP
          Constant representing a string constant in the cfg-file for a hashtable key
protected static String PLATFORM_NAME
          Constant representing a string constant in the cfg-file for a hashtable key
protected static String PLATFORM_PORT
          Constant representing a string constant in the cfg-file for a hashtable key
protected  String preferredProtocolOrder
          Member variable stores order of connection types.
protected  int refreshTime
          Member variable containing the regular refresh time for checking platform connections in milliseconds
protected  int refreshTimeIfUnconnectedPlatforms
          Member variable containing the refresh time if unconnected platforms exists in milliseconds
protected  String revisionInformation
          revision information string, managed by our version control system.
protected static String SYNCHRONIZATION_INTERVALS
          Constant representing a string constant in the cfg-file for synchronization intervals
 
Fields inherited from class com.ls.lars.server.AgentTemplate
agentMaxPool, agentMessageRouterName, agentMinPool, defaultServiceAccessPermission, defaultServiceAccessPrivilege, dynamicObjectController, FULL_SERVICE_ACCESS, iXMLHandlerForConfigLoader, localPlatform, maxInvokeStackCounter, NO_SERVICE_ACCESS, RUN_LEVEL_ACTIONS_INITIALIZED, RUN_LEVEL_CONFIG_FILE_INTERPRETED, RUN_LEVEL_CONFIG_FILE_READ, RUN_LEVEL_EMBRYONIC, RUN_LEVEL_INTERPRET_METHODS_REGISTERED, RUN_LEVEL_POOL_INITIALIZED, RUN_LEVEL_RUNNING, RUN_LEVEL_STOPPED, RUN_LEVEL_TERMINATED
 
Fields inherited from class com.ls.lars.communication.CommunicationTemplate
agentName, homePlatform, iPKIHandler, logger, STATUS_CONNECTED, STATUS_NOT_CONNECTED
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface com.ls.lars.communication.ICommunication
AUTHENTICATION_PASSWORD, AUTHENTICATION_USER, COMPRESSION_AUTO_COMPRESSION, COMPRESSION_AUTO_COMPRESSION_START_SIZE, COMPRESSION_LEVEL, COMPRESSION_TYPE, COMPRESSION_ZIP_ENTRY_NAME, CONNECTION_TYPE, HOST_ID, HOST_IP, HOST_PORT, HTTP, J_SECURE_SOCKET, J_SOCKET, JMS, JMS_INITIAL_CONTEXT_FACTORY, JMS_JMSMESSENGER_APPLICATION_LOCATION, JMS_PROVIDER_URL, JMS_RECEIVING_QUEUE_NAME, JMS_SECURITY_CREDENTIALS, JMS_SECURITY_PRINCIPAL, JMS_SENDING_QUEUE_NAME, MAXIMUM_MESSAGE_LENGTH, PROTOCOL, RMI, SOCKET, TIMEOUT, USE_OUTBOX
 
Constructor Summary
AgentSynchronization(String agentName, String homePlatform, List agentCfgFile)
          Constructor with the agentName, its homePlatform and the name of the configuration file of the new agent.
 
Method Summary
protected  void addPlatformToVectorOfPlatforms(AgentSynchronization.LarsPlatformRepresentation platformA, Vector platforms)
          This method adds a given platform to a Vector of platforms.
protected  boolean checkForEqualPlatformConnections(AgentSynchronization.LarsPlatformRepresentation platformA, AgentSynchronization.LarsPlatformRepresentation platformB)
          This method returns true, if two platfrom connections are equal.
protected  boolean checkForEqualPlatforms(AgentSynchronization.LarsPlatformRepresentation platformA, AgentSynchronization.LarsPlatformRepresentation platformB)
          This method returns true, if two platfroms are equal.
protected  boolean checkPlatformInVectorOfPlatforms(AgentSynchronization.LarsPlatformRepresentation platformA, Vector platforms)
          This method returns true, if the platform is already stored in the platform Vector, false otherwise.
protected  void deletePlaformFromVectorOfPlatforms(AgentSynchronization.LarsPlatformRepresentation platformA, Vector platforms)
          This method deletes a given platform from a Vector of platforms.
protected  void initializeMessages()
          Method which is called after the cfg-file has been read.
protected  boolean interpretSetConstants(Message currentMessage)
          Method which is called from the cfg-file.
protected  boolean interpretSynchronizePlatforms(Message currentMessage)
          Method which is called from the cfg-file.
protected  boolean ownPlatform(AgentSynchronization.LarsPlatformRepresentation platform)
          This method returns true, if the ip-address and the lars platform name is equal to the own platform.
 
Methods inherited from class com.ls.lars.server.AgentTemplate
executeLifeCycle, executeWhileRunning, getAgentRevisionInformation, getIPKIHandler, getOwnPublicKeyCertificate, getRevisionInformation, initializeAction, interpret, interpretAccessDenied, interpretAgentConnected, interpretCheckRegisteredServices, interpretCloseConnection, interpretDefineObject, interpretDeliveryFailed, interpretGetRevisionInformation, interpretInterpretationSuccessful, interpretLoadObject, interpretLogInbox, interpretMonitorLookup, interpretNotifiedAgent, interpretNotifyCanceled, interpretNotifyNotCanceled, interpretNotUnderstood, interpretPing, interpretRegisterService, interpretSendAsConfigured, interpretSetAccessPrivileges, interpretSetForeignPublicKeyCertificate, interpretSetLog, interpretSetOwnPublicKeyCertificate, interpretSetPkiEnvironment, interpretSetPkiMessages, interpretSetPrivateKey, interpretSetRunLevel, interpretSignatureNotValid, interpretStartupConstraint, loadConfigFile, performDefaultBehavior, reconnectAfterMigration, registerInterpretMethods, registerInterpretMethods, registerInterpretMethods, reInitializeAction, setAgentMessageRouterName, setIXMLHandler, setLocalPlatform, setPKIMessage, terminateAction, toString
 
Methods inherited from class com.ls.lars.communication.CommunicationTemplate
addConnectionParameter, checkSendSystemReply, connect, createReplyId, disconnect, disconnectForMigration, finalize, forwardMessage, forwardMessage, getAgentName, getConnectionParameters, getInboxSize, getLarsHost, getNumberOfProcessedMessages, getNumberOfProcessedMessagesPerMinute, getStartTime, isConnected, logInbox, receiveBlockedMessage, receiveBlockedMessage, run, sendMessage, sendSynchronousRequest, sendSynchronousRequest, setConnectionParameters, setLog, setMeantimeBetweenConnectionCheck, waitForConnection, waitForConnection
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ls.lars.communication.IToLars
start
 

Field Detail

revisionInformation

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

PLATFORM_NAME

protected static final String PLATFORM_NAME
Constant representing a string constant in the cfg-file for a hashtable key

PLATFORM_IP

protected static final String PLATFORM_IP
Constant representing a string constant in the cfg-file for a hashtable key

PLATFORM_PORT

protected static final String PLATFORM_PORT
Constant representing a string constant in the cfg-file for a hashtable key

PLATFORM_ACCESS

protected static final String PLATFORM_ACCESS
Constant representing a string constant in the cfg-file for a hashtable key

PLATFORM_CONNECTION_TYPE

protected static final String PLATFORM_CONNECTION_TYPE
Constant representing a string constant in the cfg-file for a hashtable key

LISTENER_NAME

protected static final String LISTENER_NAME
Constant represents the tag in the cfg-file for a listener

LISTENER_TYPE

protected static final String LISTENER_TYPE
Constant represents the tag in the cfg-file for a listener type

SYNCHRONIZATION_INTERVALS

protected static final String SYNCHRONIZATION_INTERVALS
Constant representing a string constant in the cfg-file for synchronization intervals

ATTEMPT_CONNECTIONS

protected static final String ATTEMPT_CONNECTIONS
Constant representing a string constant in the cfg-file

CHECK_CONNECTIONS

protected static final String CHECK_CONNECTIONS
Constant representing a string constant in the cfg-file

refreshTimeIfUnconnectedPlatforms

protected int refreshTimeIfUnconnectedPlatforms
Member variable containing the refresh time if unconnected platforms exists in milliseconds

refreshTime

protected int refreshTime
Member variable containing the regular refresh time for checking platform connections in milliseconds

ownPlatformName

protected String ownPlatformName
Member variable of the own lars platform name

ownPlatformIP

protected String ownPlatformIP
Member variable of the own lars platform IP

initiallyKnownPlatforms

protected Vector initiallyKnownPlatforms
Member variable representing the lars platforms initially known (read from the cfg-file)

agentSychronizeSupervisorName

protected String agentSychronizeSupervisorName
Member variable stores agent name of the AgentSynchronizeSupervisor (default: ass)

agentSychronizeConnectionHandlerName

protected String agentSychronizeConnectionHandlerName
Member variable stores agent name of the AgentSynchronizeConnectionHandler (default: asch)

agentPlatformSecurityName

protected String agentPlatformSecurityName
Member variable stores agent name of the AgentPlatformSecurity (default: aps)

agentListener

protected Vector agentListener
Member variable stores names of the agent listeners

preferredProtocolOrder

protected String preferredProtocolOrder
Member variable stores order of connection types. Which connection types should be tried first. If nothing specified in the cfg-file, then just socket connections are used.
Constructor Detail

AgentSynchronization

public AgentSynchronization(String agentName,
                            String homePlatform,
                            List agentCfgFile)
Constructor with the agentName, its homePlatform and the name of the configuration file of the new agent.
Parameters:
agentName: - Name of the Agent.
homePlatform: - Name of the lars platform. e.g. 192.168.140.104-lars)
agentCfgFile: - Agent's config file. e.g AgentSynchronizeSupervisor.cfg
Method Detail

initializeMessages

protected void initializeMessages()
Method which is called after the cfg-file has been read. Log the settings.
Overrides:
initializeMessages in class AgentTemplate

interpretSynchronizePlatforms

protected boolean interpretSynchronizePlatforms(Message currentMessage)
Method which is called from the cfg-file. It reads in to which remote platforms this platfrom should be connected.
Parameters:
currentMessage - Incomming Message.
Returns:
Result is true if everything was ok, false otherwise.

interpretSetConstants

protected boolean interpretSetConstants(Message currentMessage)
Method which is called from the cfg-file. It reads in the used platform parameters.
Parameters:
currentMessage - Incomming Message.
Returns:
Result is true if everything was ok, false otherwise.

ownPlatform

protected boolean ownPlatform(AgentSynchronization.LarsPlatformRepresentation platform)
This method returns true, if the ip-address and the lars platform name is equal to the own platform.
Parameters:
platform - a lars platform is given.
Returns:
Result is true if everything was ok, false otherwise.

checkPlatformInVectorOfPlatforms

protected boolean checkPlatformInVectorOfPlatforms(AgentSynchronization.LarsPlatformRepresentation platformA,
                                                   Vector platforms)
This method returns true, if the platform is already stored in the platform Vector, false otherwise.
Parameters:
platformA - a lars platform is given.
platforms - a vector of lars platforms is given.
Returns:
Result is true if everything was ok, false otherwise.

deletePlaformFromVectorOfPlatforms

protected void deletePlaformFromVectorOfPlatforms(AgentSynchronization.LarsPlatformRepresentation platformA,
                                                  Vector platforms)
This method deletes a given platform from a Vector of platforms.
Parameters:
platformA - a lars platform is given.
platforms - a vector of lars platforms is given.

addPlatformToVectorOfPlatforms

protected void addPlatformToVectorOfPlatforms(AgentSynchronization.LarsPlatformRepresentation platformA,
                                              Vector platforms)
This method adds a given platform to a Vector of platforms.
Parameters:
platformA - a lars platform is given.
platforms - a vector of lars platforms is given.

checkForEqualPlatforms

protected boolean checkForEqualPlatforms(AgentSynchronization.LarsPlatformRepresentation platformA,
                                         AgentSynchronization.LarsPlatformRepresentation platformB)
This method returns true, if two platfroms are equal. They are equal if the platform names and platform IPs are equal.
Parameters:
platformA - a lars platform is given.
platformB - a lars platform is given.
Returns:
Result is true if everything was ok, false otherwise.

checkForEqualPlatformConnections

protected boolean checkForEqualPlatformConnections(AgentSynchronization.LarsPlatformRepresentation platformA,
                                                   AgentSynchronization.LarsPlatformRepresentation platformB)
This method returns true, if two platfrom connections are equal. They are equal if the platform names, platform IPs and platform connection types are equal.
Parameters:
platformA - a lars platform is given.
platformB - a lars platform is given.
Returns:
Result is true if everything was ok, false otherwise.