|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.lang.Thread
|
+--com.ls.lars.communication.CommunicationTemplate
|
+--com.ls.lars.server.AgentTemplate
|
+--com.ls.lars.server.AgentManager
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.
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.:
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:
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.
| 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.communication.CommunicationTemplate |
agentName, homePlatform, iPKIHandler, logger, STATUS_CONNECTED, STATUS_NOT_CONNECTED |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| 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 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 |
protected String revisionInformation
public static String bnr
public static String bd
public static String modificationString
| Constructor Detail |
public AgentManager(String agentName,
String homePlatform,
List agentConfigFiles)
List containing the names of
the configuration files of the new agentagentName - 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 |
protected String getRevisionInformation()
getRevisionInformation in class AgentTemplateprotected void executeWhileRunning()
AgentTemplate.executeWhileRunning() as long as no platform shutdown is in progress. 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).executeWhileRunning in class AgentTemplateprotected boolean interpretStartAgent(Message currentMessage)
currentMessage - message to start an agentprotected boolean interpretNewAgent(Message currentMessage)
currentMessage - message to start a new agentprotected boolean interpretReloadAgent(Message currentMessage)
currentMessage - message to reload an agentprotected boolean interpretRestartAgent(Message currentMessage)
currentMessage - Message with the service "restart_agent"protected boolean interpretDeleteAgent(Message currentMessage)
currentMessage - message with the service "delete_agent"protected boolean interpretKillAgent(Message currentMessage)
currentMessage - Message with the service "kill_agent"protected boolean interpretDeleteGroup(Message currentMessage)
currentMessage - message with the service "delete_group"protected boolean interpretKillGroup(Message currentMessage)
currentMessage - message with the service "kill_group"protected boolean interpretRestartGroup(Message currentMessage)
currentMessage - message with the service "restart_group"protected boolean interpretSerializeAgent(Message currentMessage)
interpretStartMigration(com.ls.lars.communication.Message). Support will end after 2001-09.
currentMessage - Message with the service "serialize_agent"protected boolean interpretMakeAgent(Message currentMessage)
interpretMigratingAgent(com.ls.lars.communication.Message). Support will end after 2001-09.
currentMessage - message with the service "make_agent"protected boolean interpretStartMigration(Message currentMessage)
currentMessage - "start_migration" messageprotected boolean interpretMigratingAgent(Message currentMessage)
arrivingAgent.reInitializeAction()
arrivingAgent.initializeMessages()
currentMessage - message with the subject "migrating_agent"protected boolean interpretMigrationFailed(Message currentMessage)
currentMessage - message containing the name of the mobile agent and the failure reason in the contentprotected boolean interpretMigrationSuccessful(Message currentMessage)
currentMessage - message containing the name of the mobile agent in the contentprotected boolean interpretAddForward(Message currentMessage)
currentMessage - message containing the name of the agent and the forward for this agentprotected boolean interpretPresentAgents(Message currentMessage)
currentMessage - message with the service "present_agent"protected boolean interpretListAgents(Message currentMessage)
currentMessage - Message with the service "list_agents"protected boolean interpretGetVersion(Message currentMessage)
currentMessage - Message in which the version is requestedprotected boolean interpretSetLarsAdministrator(Message currentMessage)
interpretShutdownPlatform(com.ls.lars.communication.Message)).
Note, that this message is interpreted only, if it was read from a config file!
currentMessage - Message containing 'administrator' and 'password' in the map contentprotected boolean interpretShutdownPlatform(Message currentMessage)
interpretSetLarsAdministrator(com.ls.lars.communication.Message).
If administrator and password are correct:
currentMessage - Message containing 'administrator' and 'password' in the map contentprotected boolean interpretRunLevelSet(Message currentMessage)
currentMessage - message containing 'agentName', 'requestedRunLevel', 'previousRunLevel' and
'currentRunLevel' in the map contentprotected boolean interpretRunLevelNotSet(Message currentMessage)
currentMessage - message containing 'agentName', 'requestedRunLevel', 'previousRunLevel' and
'currentRunLevel' in the map content
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||