com.ls.lars.server
Class AgentSynchronizeSupervisor

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

public final class AgentSynchronizeSupervisor
extends AgentSynchronization
implements ILarsConstants

This agent is the supervisor of the platform synchronization!

AgentSynchronizeSupervisor gives connection orders establishing connections to new remote platforms. It closes properly lost connections to remote platforms and checks from time to time whether the remote platforms are still connected.

------------------------------------------------------------------------ register_remote_platforms (registered as service) ------------------------------------------------------------------------ Function: A new remote platform is registered. After registration the AgentSynchronizeSupervisor instructs the AgentSynchronizeConnectionHandler to make the connection to that new registered platform. Parameters: remote platform parameters (Hashtable) e.g.: <platform> <access>public</access> <port>7002</port> <ipAddress>192.168.140.104</ipAddress> <connectionType>socket</connectionType> <platformId>lars2</platformId> </platform> Responses: none ------------------------------------------------------------------------ unregister_remote_platforms (registered as service) ------------------------------------------------------------------------ Function: A new remote platform is unregistered. After unregistration the AgentSynchronizeSupervisor instructs the AgentSynchronizeConnectionHandler to close the connection to that remote platform. Parameters: remote platform parameters (Hashtable) e.g.: <platform> <ipAddress>192.168.140.104</ipAddress> <platformId>lars2</platformId> </platform> Responses: none ------------------------------------------------------------------------ list_platforms (registered as service) ------------------------------------------------------------------------ Function: If AgentSynchronizeSupervisor receives a list_platfroms, it sends back list_of_platforms to the sender. The list of platforms contains all remote platforms connected to the platform. Parameters: none Responses: list_of_platforms (HashMap of connected remote platforms) ------------------------------------------------------------------------ Config File: The config file for AgentSynchronizeSupervisor is usually called PlatformSynchronization.cfg and is located in the conf/lars2 directory of the platform installation. Mostly important, it contains the messages to connect to other lars platforms.

Version:
$Revision: 1.14 $
Author:
Last modified by $Author: CReich $
See Also:
Serialized Form

Inner classes inherited from class com.ls.lars.server.AgentSynchronization
AgentSynchronization.LarsPlatformRepresentation
 
Field Summary
protected  String revisionInformation
          revision information string, managed by our version control system.
 
Fields inherited from class com.ls.lars.server.AgentSynchronization
agentListener, agentPlatformSecurityName, agentSychronizeConnectionHandlerName, agentSychronizeSupervisorName, ATTEMPT_CONNECTIONS, CHECK_CONNECTIONS, initiallyKnownPlatforms, LISTENER_NAME, LISTENER_TYPE, ownPlatformIP, ownPlatformName, PLATFORM_ACCESS, PLATFORM_CONNECTION_TYPE, PLATFORM_IP, PLATFORM_NAME, PLATFORM_PORT, preferredProtocolOrder, refreshTime, refreshTimeIfUnconnectedPlatforms, 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.ILarsConstants
AUTHENTICATE_BLOWFISH_KEY, AUTHENTICATE_FINGERPRINT, AUTHENTICATE_KEY_MAP, AUTHENTICATE_PUBLIC_KEY, AUTHENTICATE_SEED, AUTHENTICATE_USER, DAY, HOUR, HTTP_META_MESSAGE_PREFIX, MESSAGE_GROUP_AGENTNAME, MESSAGE_GROUP_GROUPNAME, MESSAGE_GROUP_TRANSACTION, MINUTE, NO_GROUP_AVAILABLE, NO_SERVICE_PROVIDER_AVAILABLE, SECOND, SERVICE_ACCESS_DENIED, SERVICE_ADD_FORWARD, SERVICE_AGENT_AVAILABLE, SERVICE_AGENT_BUILD, SERVICE_AGENT_CONNECTED, SERVICE_AGENT_CREATED, SERVICE_AGENT_KILLED, SERVICE_AGENT_NOT_BUILD, SERVICE_AGENT_NOT_KILLED, SERVICE_AGENT_NOT_NOTIFIED, SERVICE_AGENT_NOT_PRESENT, SERVICE_AGENT_PRESENT, SERVICE_AGENT_STARTUP_CONSTRAINT, SERVICE_ASK_FOR_CONNECTION_PARAMETERS, SERVICE_ASK_GROUP_MEMBERS, SERVICE_ASK_SERVICE_PROVIDER_MEMBERS, SERVICE_AUTHENTICATE, SERVICE_CANCEL_NOTIFY, SERVICE_CHANGE_HOST, SERVICE_CHECK_INBOX_SIZE, SERVICE_CHECK_REGISTERED_SERVICES, SERVICE_CLASS_NOT_FOUND, SERVICE_CLOSE_CONNECTION, SERVICE_CLOSE_CONNECTIONS, SERVICE_CONNECTION_CLOSED, SERVICE_CONNECTION_NOT_KILLED, SERVICE_DELETE_AGENT, SERVICE_DELETE_FAILED, SERVICE_DELETE_GROUP, SERVICE_DELETE_GROUP_COMPLETE, SERVICE_DELETE_GROUP_FAILED, SERVICE_DELETE_GROUP_PARTIAL, SERVICE_DELIVERY_FAILED, SERVICE_EMAIL_NOT_SENT, SERVICE_EMAIL_SENT, SERVICE_GET_REVISION_INFORMATION, SERVICE_GET_VERSION, SERVICE_GO_HOME, SERVICE_HTTP_AGENT_ERROR, SERVICE_HTTP_AGENT_REGISTERED, SERVICE_HTTP_CLOSE_CONNECTION, SERVICE_HTTP_GET_MESSAGES, SERVICE_HTTP_REGISTER_AGENT, SERVICE_INFORM_REMOTE_PLATFORMS, SERVICE_INITIALIZE_INBOX_CHECK, SERVICE_INTERPRETATION_SUCCESSFUL, SERVICE_KILL_AGENT, SERVICE_KILL_GROUP, SERVICE_KILL_GROUP_COMPLETE, SERVICE_KILL_GROUP_FAILED, SERVICE_KILL_GROUP_PARTIAL, SERVICE_KILLED_CONNECTION, SERVICE_LIST_AGENTS, SERVICE_LIST_OF_AGENTS, SERVICE_LIST_OF_PLATFORMS, SERVICE_LIST_PLATFORMS, SERVICE_LOG_INBOX, SERVICE_LOG_SYSTEM_INFORMATION, SERVICE_MAKE_AGENT, SERVICE_MIGRATE, SERVICE_MIGRATING_AGENT, SERVICE_MIGRATION_FAILED, SERVICE_MIGRATION_SUCCESSFUL, SERVICE_MONITOR_ALIVE, SERVICE_MONITOR_LOOKUP, SERVICE_NEW_AGENT, SERVICE_NOT_UNDERSTOOD, SERVICE_NOTIFIED_AGENT, SERVICE_NOTIFY_AGENT, SERVICE_NOTIFY_AGENT_CONNECTED, SERVICE_NOTIFY_CANCELED, SERVICE_NOTIFY_NOT_CANCELED, SERVICE_NOTIFY_SERVICE_STATUS_CHANGED, SERVICE_OPEN_CONNECTION_REPLY, SERVICE_OPEN_CONNECTIONS, SERVICE_PING, SERVICE_PONG, SERVICE_PRESENT_AGENTS, SERVICE_REGISTER, SERVICE_REGISTER_PLATFORMS, SERVICE_REGISTER_REMOTE_PLATFORMS, SERVICE_REGISTER_SERVICE, SERVICE_REGISTERED_SERVICES, SERVICE_RELOAD_AGENT, SERVICE_REMOVE_MESSAGE_GROUP, SERVICE_REMOVE_MESSAGE_GROUP_FAILED, SERVICE_REMOVE_MESSAGE_GROUP_SUCCEEDED, SERVICE_RESPONSE_FOR_CONNECTION_PARAMETERS, SERVICE_RESPONSE_GROUP_MEMBERS, SERVICE_RESPONSE_SERVICE_PROVIDER_MEMBERS, SERVICE_RESTART_AGENT, SERVICE_RESTART_GROUP, SERVICE_RESTART_GROUP_COMPLETE, SERVICE_RESTART_GROUP_FAILED, SERVICE_RESTART_GROUP_PARTIAL, SERVICE_REVISION_INFORMATION, SERVICE_RUN_LEVEL_NOT_SET, SERVICE_RUN_LEVEL_SET, SERVICE_SEND_AS_CONFIGURED, SERVICE_SEND_MAIL, SERVICE_SENDER_RIP, SERVICE_SERIALIZE_AGENT, SERVICE_SERIALIZE_FAILED, SERVICE_SERIALIZED_AGENT, SERVICE_SERIALIZING_AGENT, SERVICE_SERVICE_NOT_PROVIDED, SERVICE_SERVICE_STATUS_CHANGED, SERVICE_SET_ACCESS_PRIVILEGES, SERVICE_SET_AGENT_NAME, SERVICE_SET_COMPRESSION, SERVICE_SET_CONSTANTS, SERVICE_SET_DENY_LIST, SERVICE_SET_LARS_ADMINISTRATOR, SERVICE_SET_LOCAL_PORT, SERVICE_SET_LOG, SERVICE_SET_LOGIN_AGENT, SERVICE_SET_MAIL_ADDRESSES, SERVICE_SET_MAX_MESSAGE_LENGTH, SERVICE_SET_PLATFORM_ID, SERVICE_SET_PORT, SERVICE_SET_RUN_LEVEL, SERVICE_SET_TRUSTED_IP, SERVICE_SET_USER_LIST, SERVICE_SHOW_ALL_SERVICES, SERVICE_SHUTDOWN_PLATFORM, SERVICE_SHUTDOWN_PLATFORM_DECLINED, SERVICE_SHUTDOWN_PLATFORM_IN_PROGRESS, SERVICE_SIGNATURE_NOT_VALID, SERVICE_START_AGENT, SERVICE_START_MIGRATION, SERVICE_START_UP, SERVICE_SUBSCRIBE_TO_MESSAGE_GROUP, SERVICE_SUBSCRIBE_TO_MESSAGE_GROUP_FAILED, SERVICE_SUBSCRIBE_TO_MESSAGE_GROUP_PARTIALLY, SERVICE_SUBSCRIBE_TO_MESSAGE_GROUP_SUCCEEDED, SERVICE_SYNCHRONIZE, SERVICE_TERMINATING_AGENT, SERVICE_TYPE_NOT_FOUND, SERVICE_UNREGISTER, SERVICE_UNREGISTER_ALL_SERVICES, SERVICE_UNREGISTER_PLATFORMS, SERVICE_UNREGISTER_REMOTE_PLATFORMS, SERVICE_UNREGISTER_SERVICE, SERVICE_UNSUBSCRIBE_FROM_ALL_MESSAGE_GROUPS, SERVICE_UNSUBSCRIBE_FROM_ALL_MESSAGE_GROUPS_FAILED, SERVICE_UNSUBSCRIBE_FROM_ALL_MESSAGE_GROUPS_SUCCEEDED, SERVICE_UNSUBSCRIBE_FROM_MESSAGE_GROUP, SERVICE_UNSUBSCRIBE_FROM_MESSAGE_GROUP_FAILED, SERVICE_UNSUBSCRIBE_FROM_MESSAGE_GROUP_SUCCEEDED, SERVICE_USER_NOT_OK, SERVICE_USER_OK, SERVICE_VERSION, SERVICE_WAKE_UP, WEEK
 
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
AgentSynchronizeSupervisor(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 initializeMessages()
          Method which is called after the cfg-file has been read.
protected  boolean interpretListPlatforms(Message currentMessage)
          Sends back the sender a list of connected platforms. in the Vector of platforms, false otherwise.
protected  boolean interpretNotifiedAgent(Message currentMessage)
          Method is called by the AgentTimer.
protected  boolean interpretOpenConnectionReply(Message currentMessage)
          Reply from the AgentSynchronizeConnectionHandler when the connection process is finished.
protected  boolean interpretRegisterRemotePlatforms(Message currentMessage)
          Method is called by the a remote AgentPlatformSecurity.
protected  boolean interpretSendLocalPlatformInformation(Message currentMessage)
          Registers its own platform information at the sender side (used by JMS-Messenger).
protected  boolean interpretStartUp(Message currentMessage)
          If initial things are done.
protected  boolean interpretUnregisterRemotePlatforms(Message currentMessage)
          Method is called to unregister a remote platform and therefore disconnect.
protected  boolean interpretWakeUp(Message currentMessage)
          Method is called by the AgentTimer.
 
Methods inherited from class com.ls.lars.server.AgentSynchronization
addPlatformToVectorOfPlatforms, checkForEqualPlatformConnections, checkForEqualPlatforms, checkPlatformInVectorOfPlatforms, deletePlaformFromVectorOfPlatforms, interpretSetConstants, interpretSynchronizePlatforms, ownPlatform
 
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, 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.
Constructor Detail

AgentSynchronizeSupervisor

public AgentSynchronizeSupervisor(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. e.g. ass
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. It registers the services register_remote_platforms.
Overrides:
initializeMessages in class AgentSynchronization

interpretStartUp

protected boolean interpretStartUp(Message currentMessage)
If initial things are done. AgentSynchronizeSupervisor is started by receiving an start_up from AgentPlatformSecurity.
Parameters:
currentMessage - Incomming Message.
Returns:
Result is true if everything was ok, false otherwise.

interpretNotifiedAgent

protected boolean interpretNotifiedAgent(Message currentMessage)
Method is called by the AgentTimer. Method not used. Declaration prevents log-file over flooding.
Overrides:
interpretNotifiedAgent in class AgentTemplate
Parameters:
currentMessage - Incomming Message.
Returns:
Result is true if everything was ok, false otherwise.

interpretRegisterRemotePlatforms

protected boolean interpretRegisterRemotePlatforms(Message currentMessage)
Method is called by the a remote AgentPlatformSecurity. The message contains the platforms the remote AgentPlatformSecurity is willing to inform. The content of the message could be: You could send the AgentSynchronizeSupervisor a message with the service register_remote_platform with the following content: <platform> <access>public</access> <port>7002</port> <ipAddress>192.168.140.104</ipAddress> <connectionType>socket</connectionType> <platformId>lars</platformId> </platform>
Parameters:
currentMessage - Incomming Message.
Returns:
Result is true if everything was ok, false otherwise.

interpretUnregisterRemotePlatforms

protected boolean interpretUnregisterRemotePlatforms(Message currentMessage)
Method is called to unregister a remote platform and therefore disconnect. You could send the AgentSynchronizeSupervisor a message with the service unregister_remote_platform with the following content:
 
   192.168.140.104
   lars2
 
 
Parameters:
currentMessage - Incomming Message.
Returns:
Result is true if everything was ok, false otherwise.

interpretOpenConnectionReply

protected boolean interpretOpenConnectionReply(Message currentMessage)
Reply from the AgentSynchronizeConnectionHandler when the connection process is finished.
Parameters:
currentMessage - no conntent
Returns:
Result is true if platform is contained in vector of platforms, false otherwise.

interpretWakeUp

protected boolean interpretWakeUp(Message currentMessage)
Method is called by the AgentTimer. In there a method is called which tests from time to time the connections to the remote platforms.
Parameters:
currentMessage - Incomming Message.
Returns:
Result is true if everything was ok, false otherwise.

interpretListPlatforms

protected boolean interpretListPlatforms(Message currentMessage)
Sends back the sender a list of connected platforms. in the Vector of platforms, false otherwise.
Parameters:
currentMessage - No content. only the sender is important
Returns:
Result is true if platform is contained in vector of platforms, false otherwise.

interpretSendLocalPlatformInformation

protected boolean interpretSendLocalPlatformInformation(Message currentMessage)
Registers its own platform information at the sender side (used by JMS-Messenger).
Parameters:
currentMessage - Contains the remote platform name.
Returns:
Result is true if platform is contained in vector of platforms, false otherwise.