next up previous contents
Next: Users Guide Up: Agent Class Previous: Auxiliary Methods   Contents

The Agent Control Methods

The control methods are the methods from the AgentIFace used by the platform and the AgentLoader to maintain the Agent. These methods are already implemented in the basic Agent class to provide any sub class with the standard tasks already processed.

initAgent()
Is called when initializing the Agent. It creates a new AgentProfile to be used when registering at the MAFFinder.
startAgent()
Is called when (re-) started on a System. It registers the Agent at the MAFFinder with the profile created in the initAgent method. Then it sets the boolean variable running to true to let the Agent process its commands.
suspendAgent()
Is called when stopping / suspending an Agent. It unregisters the Agent from the MAFFinder. This is done only when the Agent is registered with its current Agent System. When an Agent travels and it registers there before being stopped on the source System it would unregister the new location. This is a result of the asynchronous stopping mechanism. After that it sets the running variable to false, preventing the Agent from processing a new task.
terminateAgent()
Is called at the end of the life of an Agent. It sets the boolean variable concluded to true, causing the run() to exit and with this stops the execution of the Agent.
The creator of a subclass of the Agent class has to implement the initUser(), startUser(), suspendUser() and terminateUser() method for his own code. The control methods described above are calling the user methods after processing its code. The controls are final preventing them from being overwritten by a subclass.


next up previous contents
Next: Users Guide Up: Agent Class Previous: Auxiliary Methods   Contents
Thomas Letsch 2001-02-21