com.ls.lars.server
Class AgentManager

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

public final class AgentManager
extends AgentTemplate

This agent creates, serializes and removes agents on request.

Note: AgentManager is usually named "am".

Note: AgentManager logs ERROR and WARNING log information in both the system's log file and it's own log file, all log messages with a less important log level are logged only in AgentManager's own log file.


to Class Specification
 Incoming Messages:
     You can send messages requesting the following services to
     AgentManager. Input parameters you have to specify are
     listed with the messages and must be transmitted using a
     map.
     ------------------------------------------------------------------------
     start_agent
     ------------------------------------------------------------------------
     Function:   Creates a new agent of the specified agent
                 class with the given name. In contrast to
                 the new_agent message this method doesn't
                 send a reply message. In dependence of the
                 message there is the possibility to make an
                 agent pool for load balancing functionality.

     Parameters: class, name, cfgFile, loadBalancing  (Map)

                 cfgFile The configuration file or files
                         for the agent. There may be more
                         than one configuration file. In
                         this case the file names are
                         separated by spaces.
                         It is possible to use the 'source'
                         TAG here. Then it is only valid for
                         this config file. But be careful,
                         the global source settings will be
                         overwritten for this file. For detailed
                         explanation see below.

                 class   The full class of the agent
                         It is possible to use the 'source'
                         TAG here. But be careful,
                         the global source settings will be
                         overwritten for this file. For detailed
                         explanation see below. If you use the
                         source TAG here you have to enter the
                         class name between the 'name' TAG.

                 name    The agent's name. Take care of the
                         naming conventions for some agent,
                         i.e. AgentTimer should always be
                         named "at".

                 loadBalancing   For the load balancing there
                                 are two TAG's. The 'minPoolSize'
                                 and the 'maxPoolSize'. Both of
                                 them have to hold a numeric value.
                                 e.g.:
<loadBalancing> <minPoolSize>1</minPoolSize> <maxPoolSize>5</maxPoolSize> </loadBalancing>
                 source  Sorry, but at the moment this is not
                         accessible!!! (Only for the config file)
                         For the location from where to get
                         config files and class files. It is
                         very useful for loading from any
                         URL. Here you have additional TAG's:
                         'protocol' e.g.: file, http, ftp
                         'url' any valid url without protocol
                         'path' the path where to get the files
                         'archive' the jar/zip file to load from
                         'name' the name of the file
                         'port' the port to connect to

                         All these settings are optional, but
                         if you want to load from an URL you
                         have to set the 'protocol' and the
                         'ipAddress' (mandatory).

                         Example:
<source> <protocol>http</protocol> <ipAddress>ls500.living-systems.de</ipAddress> </source>
     Responses:  none
     ------------------------------------------------------------------------
     new_agent
     ------------------------------------------------------------------------
     Function:   Creates a new agent of the specified agent
                 class with the given name. This message is
                 usually sent by another agent so that the
                 agent manager has to send a reply message
                 if the creation was successful or
                 unsuccessful.

     Parameters: class, name, cfgFile (Map, see above)

     Responses:  agent_created     The agent was successfully
                                   created and inserted into
                                   the platform.

                 type_not_found    The agent could not be
                                   built, probably due to a
                                   class not found error

                 agent_present     An agent with this name is
                                   already present, choose
                                   another name.
     ------------------------------------------------------------------------
     reload_agent
     ------------------------------------------------------------------------
     Function:   Creates a new agent of the specified agent
                 class with the given name, the agent class
                 is reloaded. This message is
                 usually sent by another agent thus the
                 agent manager has to send a reply message
                 if the creation was successful or
                 unsuccessful.

     Parameters: class, name, cfgFile (Map, see above))

     Responses:  agent_created     The agent was successfully
                                   created and inserted into
                                   the platform

                 type_not_found    The agent could not be
                                   built, probably due to a
                                   class not found

                 agent_present     An agent with this name is
                                   already present, choose
                                   another name
     ------------------------------------------------------------------------
     restart_agent
     ------------------------------------------------------------------------
     Function:   Restarts an agent that was once created by
                 this agent manager and that is currently not
                 running on the platform.

     Parameters: agentName (String)

     Responses:  agent_not_build   The agent was not built,
                                   because the generation
                                   parameters (class name,
                                   config file(s)) were
                                   unknown.
                 agent_created     The agent was successfully
                                   created and inserted into
                                   the platform
                 type_not_found    The agent could not be
                                   built, probably due to a
                                   class not found error
                 agent_present     An agent with this name is
                                   already present, choose
                                   another name
     ------------------------------------------------------------------------
     delete_agent
     ------------------------------------------------------------------------
     Funktion:   Deletes the agent agentName from the platform
                 by first running his AgentTemplate.terminateAction()
                 method, then killing him off (see below).

     Parameters: agentName (String)

     Responses:  terminating_agent The agent is being deleted.

                 delete_failed     The agent could not be deleted.

                 agent_not_present An agent with this name
                                   does not exist on the platform.
     ------------------------------------------------------------------------
     kill_agent
     ------------------------------------------------------------------------
     Function:   Deletes the agent agentName from the platform without
                 running his AgentTemplate.terminateAction() method before.

     Parameters: agentName (String)

     Responses:  agent_killed      The agent was successfully
                                   killed off
                 agent_not_killed  The agent could not be deleted
     ------------------------------------------------------------------------
     restart_group
     ------------------------------------------------------------------------
     Function:   Restarts all the agents of a group that was
                 once created by this agent manager and that is
                 asked by the sender to be restarted.

     Parameters: group name (String)

     Responses: restart_group_complete  All the agents of the
                                        group could be restarted

                restart_group_partial   Only a part of the agents
                                        of the group could be
                                        restarted, the message informs the
                                        sender about the status
                                        of each agent

                restart_group_failed    All the agents of the
                                        group could not be
                                        restarted. This message contains
                                        a special "description" field,
                                        which holds the
                                        reason why the group
                                        couldn't be restarted
     ------------------------------------------------------------------------
     delete_group
     ------------------------------------------------------------------------
     Function:   Deletes all the agents of a group that were
                 once created by this agent manager without running their
                 AgentTemplate.terminateAction()

     Parameters: group name (String)

     Responses: delete_group_complete  All the agents of the
                                       group were deleted

                delete_group_partial   Only a part of the agents
                                       of the group could be
                                       deleted, the message informs the
                                       sender about the status
                                       of each agent

                delete_group_failed    All the agents of the
                                       group could not be
                                       deleted This message contains
                                       a special "description" field,
                                       which holds the
                                       reason why the group
                                       couldn't be deleted
     ------------------------------------------------------------------------
     kill_group
     ------------------------------------------------------------------------
     Function:   Deletes all the agents of a group that was
                 once created by this agent manager, without calling
                 their AgentTemplate.terminateAction() method.
     Parameters: group name (String)
     Responses: kill_group_complete  All the agents of the group were killed
                kill_group_partial   Only a part of the agents
                                     of the group could be
                                     killed, the message informs the
                                     sender about the status
                                     of each agent
                kill_group_failed    All the agents from the
                                     group could not be kill
                                     This message contains
                                     a special "description" field,
                                     which holds the
                                     reason why the group
                                     couldn't be killed
     ------------------------------------------------------------------------
     serialize_agent
     ------------------------------------------------------------------------
     Function:   Serializes an agent, i.e. converts the entire agent object
                 into a string object which can be sent over any data
                 connection. The agent will be stopped, converted into a
                 string which is sent to the originator of the
                 serialize_agent message, and then removed from the platform.
     Parameters: agent (String)
     Responses:  serializing_agent The agent is being serialized

                 serialized_agent  The agent was successfully
                                   serialized. The response message
                                   (Map) contains two elements:
                                   the name of the serialized agent ('name')
                                   and the object string ('code').
                 serialize_failed  Serialization could not
                                   be performed, because the
                                   agent's terminateAction() method
                                   did not return successful.
                 agent_not_present An agent with this name
                                   does not exist on the
                                   platform
     ------------------------------------------------------------------------
     make_agent
     ------------------------------------------------------------------------
     Function:   Takes a serialized agent, builds a new
                 agent from the string object and injects it
                 into the platform. The agent is started on
                 the platform as usual.
     Parameters: agent, code (Map)
     Responses:  agent_build       The agent was properly
                                   built and started.
                 class_not_found   The agent class could not
                                   be decoded or rebuilt,
                                   probably due to a missing
                                   class or a wrong class path.
                 agent_not_build   The agent could not be
                                   built, try another name.
     ------------------------------------------------------------------------
     start_migration
     ------------------------------------------------------------------------
     Function:   Request of the sender of this message to be serialized, sent
                 to the platform specified in the content of the message and
                 restarted there.
     Parameters: String containing the name of the platform, whereto the
                 sender wants to migrate (e.g. "192.168.1.1-lars")
     Responses:  migration_failed:
                    this reply is sent only, if the agent migration failed;
                    a reason will be given as String in the content
     ------------------------------------------------------------------------
     migrating_agent
     ------------------------------------------------------------------------
     Function:   Takes the received serialized agent and builds another agent
                 from the received information.
     Parameters: code of the agent (String)
     Responses:  migration_successful:
                     Anounce the sender of the agent that the migration of
                      the agent was successful.
                 migration_failed:
                      Anounce the sender of the agent that the migration of
                      the agent has failed.
     ------------------------------------------------------------------------
     present_agent
     ------------------------------------------------------------------------
     Function:   Checks whether the agent exists on the
                 platform (this does not mean it is alive or
                 working, it just does exist!)

     Parameters: agentName (String)

     Responses:  agent_available       Agent exists
                 agent_not_available   Agent does not exist
     ------------------------------------------------------------------------
     list_agents
     ------------------------------------------------------------------------
     Function:   Lists all agents in a content hash. The
                 hash is an enumeration of items in the
                 style of "agent0, agent1, agent2, agent3..."

     Parameters: none

     Responses:  list_of_agents    The content of the response
                                   message is the agent list
                                   as a Map.
     ------------------------------------------------------------------------
     get_version
     ------------------------------------------------------------------------
     Function:   Get information about build number and build
                 date of the running platform.
     Parameters: none
     Responses:  version    String containing the current
                            version of the platfoms.
     ------------------------------------------------------------------------
     set_lars_administrator (config file only!)
     ------------------------------------------------------------------------
     Function:   Configures user and password to be used to identify a lars
                 administrator (someone, who is allowed to shutdown the lars
                 platform, see "shutdown_platform").
                 Note, that this message is interpreted only, if it was read
                 from a config file!
     Parameters: administrator, password (Map)
     Responses:  none
     ------------------------------------------------------------------------
     shutdown_platform
     ------------------------------------------------------------------------
     Function:   Asks AgentManager to shutdown the lars platform.
                 Therefore the administrator and his password need to be
                 correct, see "set_lars_administrator".
     Parameters: administrator, password (Map)
     Responses:  shutdown_platform_in_progress:
                      if administrator and password were correct
                 shutdown_platform_declined:
                      if administrator and password were not correct
     ------------------------------------------------------------------------
 Config File:
     The config file for AgentManager is usually called AgentManager.cfg and
     located in the conf/lars directory of the platform installation.
     Most important: it contains the messages to start up other
     agents.
     The first message should be a set_log message to set the correct log
     file and level.

 

Version:
$Revision: 1.45 $
Author:
Last modified by $Author: ASchneider $
See Also:
Serialized Form

Field Summary
static String bd
          contains the build date (automatically maintained by the BuildNumberParser)
static String bnr
          contains the build number (automatically maintained by the BuildNumberParser)
static String modificationString
          displayable modification string created out of automatically updated datamembers
protected  String revisionInformation
          revision information string, managed by our version control system.
 
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
AgentManager(String agentName, String homePlatform, List agentConfigFiles)
          Constructor with the agentName, its homePlatform and a List containing the names of the configuration files of the new agent
 
Method Summary
protected  void executeWhileRunning()
          Main method of AgentManager, that is called in a loop as long as the agent's run level is less than STOPPED.
protected  String getRevisionInformation()
          gets the revision information of this agent
protected  boolean interpretAddForward(Message currentMessage)
          adds a forward for the specified agent to message router
protected  boolean interpretDeleteAgent(Message currentMessage)
          Asks an agent (by running its terminateAction() method) to remove itself from the platform and sends a confirming "terminating_agent", "delete_failed" or "agent_not_present" reply afterwards.
protected  boolean interpretDeleteGroup(Message currentMessage)
          Trys to delete all the agents from a group and sends the result back to the sender of the message.
protected  boolean interpretGetVersion(Message currentMessage)
          Sends a reply message with service "version" informing about the current version of the platform.
protected  boolean interpretKillAgent(Message currentMessage)
          Removes an agent from the agent platform.
protected  boolean interpretKillGroup(Message currentMessage)
          Tries to kill all the agents from a group and sends the result back to the sender of the message.
protected  boolean interpretListAgents(Message currentMessage)
          Sends a reply message with the service "list_of_agents" and a content containing a list of all active agents on this platform.
protected  boolean interpretMakeAgent(Message currentMessage)
          Deprecated. This method is replaced by interpretMigratingAgent(com.ls.lars.communication.Message). Support will end after 2001-09.
protected  boolean interpretMigratingAgent(Message currentMessage)
          Builds an agent out of the given serialized code and restarts him on the local (which is the new) platform.
protected  boolean interpretMigrationFailed(Message currentMessage)
          notifies agent manager, that a previously sent mobile agent was not restarted at the remote platform
protected  boolean interpretMigrationSuccessful(Message currentMessage)
          notifies agent manager, that a previously sent mobile agent was restarted at the remote platform
protected  boolean interpretNewAgent(Message currentMessage)
          Starts a new agent (specified in the content of the given message) and sends a reply message The agent class is taken from the cache, if it was previously instantiated.
protected  boolean interpretPresentAgents(Message currentMessage)
          Sends a reply message which is stating, if an agent with the given name exists on the platform ("agent_available") or not ("agent_not_available").
protected  boolean interpretReloadAgent(Message currentMessage)
          Reloads an agent (specified in the content of the given message) and sends a reply message.
protected  boolean interpretRestartAgent(Message currentMessage)
          Restarts the agent with the given name, if it is not running on the platform.
protected  boolean interpretRestartGroup(Message currentMessage)
          Trys to restart all the agents from a group and sends the result back to the sender of the message.
protected  boolean interpretRunLevelNotSet(Message currentMessage)
          Interprets a message, that informs agent manager, that the sender has fulfilled the request to enter a new run level.
protected  boolean interpretRunLevelSet(Message currentMessage)
          Interprets a message, that informs agent manager, that the sender has fulfilled the request to enter a new run level.
protected  boolean interpretSerializeAgent(Message currentMessage)
          Deprecated. This method is replaced by interpretStartMigration(com.ls.lars.communication.Message). Support will end after 2001-09.
protected  boolean interpretSetLarsAdministrator(Message currentMessage)
          Configures a user and a corresponding password used to identify a lars administrator (someone, who is allowed to shutdown the lars platform, see interpretShutdownPlatform(com.ls.lars.communication.Message)).
protected  boolean interpretShutdownPlatform(Message currentMessage)
          Interprets the request to shutdown the lars platform.
protected  boolean interpretStartAgent(Message currentMessage)
          Starts a new agent (specified in the content of the given message) without sending a reply message.
protected  boolean interpretStartMigration(Message currentMessage)
          The agent who sends this message is going to be serialized and sent to another platfrom (which is given in the content of the currentMessage).
 
Methods inherited from class com.ls.lars.server.AgentTemplate
executeLifeCycle, getAgentRevisionInformation, getIPKIHandler, getOwnPublicKeyCertificate, initializeAction, initializeMessages, 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.

bnr

public static String bnr
contains the build number (automatically maintained by the BuildNumberParser)

bd

public static String bd
contains the build date (automatically maintained by the BuildNumberParser)

modificationString

public static String modificationString
displayable modification string created out of automatically updated datamembers
Constructor Detail

AgentManager

public AgentManager(String agentName,
                    String homePlatform,
                    List agentConfigFiles)
Constructor with the agentName, its homePlatform and a List containing the names of the configuration files of the new agent
Parameters:
agentName - name of the agent (example: xyz)
homePlatform - name of the homePlatform where the agent was created. (example: 195.52.158.233/lars)
agentConfigFiles - config files which should be read by the agent when it starts up
Method Detail

getRevisionInformation

protected String getRevisionInformation()
gets the revision information of this agent
Overrides:
getRevisionInformation in class AgentTemplate
Returns:
the revision information

executeWhileRunning

protected void executeWhileRunning()
Main method of AgentManager, that is called in a loop as long as the agent's run level is less than STOPPED. It calls AgentTemplate.executeWhileRunning() as long as no platform shutdown is in progress.
Otherwise it checks, if the platform shutdown time has been reached. If yes, it sets the run level of the lars platform to TERMINATED (which exits the Java Virtual machine). Else it waits at most 500 milliseconds to receive a message from its inbox and calls AgentTemplate.interpret(com.ls.lars.communication.Message) for that message. Afterwards or if it did not receive a message at all, AgentManager sends requests to all those agents, that until now denied to terminate, to delete themselves (if at least 500 ms have elapsed since the last reminder).
Overrides:
executeWhileRunning in class AgentTemplate

interpretStartAgent

protected boolean interpretStartAgent(Message currentMessage)
Starts a new agent (specified in the content of the given message) without sending a reply message. The agent class is taken from the cache, if it was previously instantiated.
Parameters:
currentMessage - message to start an agent
Returns:
true, if starting the agent suceeded; false else

interpretNewAgent

protected boolean interpretNewAgent(Message currentMessage)
Starts a new agent (specified in the content of the given message) and sends a reply message The agent class is taken from the cache, if it was previously instantiated.
Parameters:
currentMessage - message to start a new agent
Returns:
true, if starting the agent suceeded; false else

interpretReloadAgent

protected boolean interpretReloadAgent(Message currentMessage)
Reloads an agent (specified in the content of the given message) and sends a reply message. The agent class is reloaded by a new class loader (even if it was previously instantiated).
Parameters:
currentMessage - message to reload an agent
Returns:
true, if starting the agent suceeded; false else

interpretRestartAgent

protected boolean interpretRestartAgent(Message currentMessage)
Restarts the agent with the given name, if it is not running on the platform. This message is usually sent by AgentPlatformMonitor, so that the agent manager has to send a reply message informing about the creation having been successful ("agent_created") or unsuccessful ("type_not_found" or "agent_present").
Parameters:
currentMessage - Message with the service "restart_agent"
Returns:
boolean if successful true, else false

interpretDeleteAgent

protected boolean interpretDeleteAgent(Message currentMessage)
Asks an agent (by running its terminateAction() method) to remove itself from the platform and sends a confirming "terminating_agent", "delete_failed" or "agent_not_present" reply afterwards.
Parameters:
currentMessage - message with the service "delete_agent"
Returns:
boolean if successful true, else false

interpretKillAgent

protected boolean interpretKillAgent(Message currentMessage)
Removes an agent from the agent platform. Runs the terminateAction() method of the condemned agent, but ignores it's return value. Sends a confirming "agent_killed" or "agent_not_killed" reply afterwards.
Parameters:
currentMessage - Message with the service "kill_agent"
Returns:
boolean if successful true, else false

interpretDeleteGroup

protected boolean interpretDeleteGroup(Message currentMessage)
Trys to delete all the agents from a group and sends the result back to the sender of the message. Sends the reply message 'delete_group_complete' in case that all the agents from that group could be deleted. Sends the reply message 'delete_group_partial' in case that there are agents that accepted the delete request. Sends the reply message 'delete_group_failed' in case that no agent from that group could not be deleted.
Parameters:
currentMessage - message with the service "delete_group"
Returns:
boolean true if successful, else false

interpretKillGroup

protected boolean interpretKillGroup(Message currentMessage)
Tries to kill all the agents from a group and sends the result back to the sender of the message. Sends the reply message 'kill_group_complete' in case that all the agents from that group could be kill Sends the reply message 'kill_group_partial' in case that there are agents that could be kill Sends the reply message 'kill_group_failed' in case that no agent from that group could not be kill
Parameters:
currentMessage - message with the service "kill_group"
Returns:
boolean true if successfu, else false

interpretRestartGroup

protected boolean interpretRestartGroup(Message currentMessage)
Trys to restart all the agents from a group and sends the result back to the sender of the message. Sends the reply message 'restart_group_complete' in case that all the agents from that group could be restarted Sends the reply message 'restart_group_partial' in case that there are agents that could be restarted Sends the reply message 'restart_group_failed' in case that no agent from that group could not be restarted
Parameters:
currentMessage - message with the service "restart_group"
Returns:
boolean true if successful, else false

interpretSerializeAgent

protected boolean interpretSerializeAgent(Message currentMessage)
Deprecated. This method is replaced by interpretStartMigration(com.ls.lars.communication.Message). Support will end after 2001-09.

Serializes the agent specified by its name (which is given in the content of currentMessage).
Parameters:
currentMessage - Message with the service "serialize_agent"
Returns:
boolean if successful true, else false

interpretMakeAgent

protected boolean interpretMakeAgent(Message currentMessage)
Deprecated. This method is replaced by interpretMigratingAgent(com.ls.lars.communication.Message). Support will end after 2001-09.

Builds an agent out of the given serialized code with the given name
Parameters:
currentMessage - message with the service "make_agent"
Returns:
boolean if successful true, else false

interpretStartMigration

protected boolean interpretStartMigration(Message currentMessage)
The agent who sends this message is going to be serialized and sent to another platfrom (which is given in the content of the currentMessage).
Parameters:
currentMessage - "start_migration" message
Returns:
boolean if successful true, else false

interpretMigratingAgent

protected boolean interpretMigratingAgent(Message currentMessage)
Builds an agent out of the given serialized code and restarts him on the local (which is the new) platform. Therefore the following steps are performed:
  1. deserialize arriving agent from the content of the message
  2. call arrivingAgent.reInitializeAction()
  3. call arrivingAgent.initializeMessages()
  4. plug arriving agent into message router
  5. start the arriving agent's thread
  6. send "start_up" message to arriving agent
  7. send "migration_successful" reply to platform, where arriving agent comes from
If anything fails, a "migration_failed" reply is sent to platform, where arriving agent comes from and the incoming "migrating_agent" message is just forwarded back to the original sender (Forwarding assures an increase of the hop counter and therefore avoids an everlasting bouncing, if errors happen on both sides).
Parameters:
currentMessage - message with the subject "migrating_agent"
Returns:
true, if interpretation of message is successful (this includes starting the mobile agent!); false else

interpretMigrationFailed

protected boolean interpretMigrationFailed(Message currentMessage)
notifies agent manager, that a previously sent mobile agent was not restarted at the remote platform
Parameters:
currentMessage - message containing the name of the mobile agent and the failure reason in the content
Returns:
always true

interpretMigrationSuccessful

protected boolean interpretMigrationSuccessful(Message currentMessage)
notifies agent manager, that a previously sent mobile agent was restarted at the remote platform
Parameters:
currentMessage - message containing the name of the mobile agent in the content
Returns:
always true

interpretAddForward

protected boolean interpretAddForward(Message currentMessage)
adds a forward for the specified agent to message router
Parameters:
currentMessage - message containing the name of the agent and the forward for this agent
Returns:
true if forward could successfully be added

interpretPresentAgents

protected boolean interpretPresentAgents(Message currentMessage)
Sends a reply message which is stating, if an agent with the given name exists on the platform ("agent_available") or not ("agent_not_available").
Parameters:
currentMessage - message with the service "present_agent"
Returns:
boolean if successful true, else false (in this case always return true)

interpretListAgents

protected boolean interpretListAgents(Message currentMessage)
Sends a reply message with the service "list_of_agents" and a content containing a list of all active agents on this platform.
Parameters:
currentMessage - Message with the service "list_agents"
Returns:
boolean if successful true, else false (in this case always return true)

interpretGetVersion

protected boolean interpretGetVersion(Message currentMessage)
Sends a reply message with service "version" informing about the current version of the platform.
Parameters:
currentMessage - Message in which the version is requested
Returns:
always true

interpretSetLarsAdministrator

protected boolean interpretSetLarsAdministrator(Message currentMessage)
Configures a user and a corresponding password used to identify a lars administrator (someone, who is allowed to shutdown the lars platform, see interpretShutdownPlatform(com.ls.lars.communication.Message)).

Note, that this message is interpreted only, if it was read from a config file!

Parameters:
currentMessage - Message containing 'administrator' and 'password' in the map content
Returns:
true, if the message was interpreted correctly; false else

interpretShutdownPlatform

protected boolean interpretShutdownPlatform(Message currentMessage)
Interprets the request to shutdown the lars platform. Therefore the user and password given in the message are checked against those configured in interpretSetLarsAdministrator(com.ls.lars.communication.Message). If administrator and password are correct:
  1. sends a 'shutdown_platform_in_progress' message reply
  2. asks AgentMessageRouter to disconnect all agent-like clients
  3. sends 'set_run_level "STOPPED"' message to all running agents
  4. enters an internal state, that makes him terminating the lars platform in 5 seconds
If administrator or password are not correct, a 'shutdown_platform_declined' reply message is sent.
Parameters:
currentMessage - Message containing 'administrator' and 'password' in the map content
Returns:
true, if the message was interpreted correctly; false else

interpretRunLevelSet

protected boolean interpretRunLevelSet(Message currentMessage)
Interprets a message, that informs agent manager, that the sender has fulfilled the request to enter a new run level. If the requestedRunLevel is "STOPPED" and the currentRunLevel is "STOPPED" or "TERMINATED", AgentManager removes all references to the deleted agent. Otherwise AgentManager just ignores this message, because he is not interested.
Parameters:
currentMessage - message containing 'agentName', 'requestedRunLevel', 'previousRunLevel' and 'currentRunLevel' in the map content
Returns:
always true

interpretRunLevelNotSet

protected boolean interpretRunLevelNotSet(Message currentMessage)
Interprets a message, that informs agent manager, that the sender has fulfilled the request to enter a new run level. If no platform shutdown is in progress, AgentManager just ignores this message, because he is not interested.
Parameters:
currentMessage - message containing 'agentName', 'requestedRunLevel', 'previousRunLevel' and 'currentRunLevel' in the map content
Returns:
always true