next up previous contents
Next: The AgentLoader Up: Structure of an Agent Previous: Structure of an Agent   Contents

The AgentHelper

The Agent needs access to some information about the platform and to some resources of the platform. The AgentHelper holds the ID of the Agent providing every call to the platform with this ID to enable security checks. Since the helper gets the AgentID from the platform when the Agent is created or received from another System this ID can be trusted. The Agent has no possibility to alter this ID object of the helper. The methods provided by the AgentHelper are the following:

getAgentSystemName()
Returns the name of the System where the Agent is executing.
getID()
Returns the ID of the Agent. When initialized the Agent does not know its ID. It it needs its ID it has to ask its helper for it. For accessing to resources or information an Agent does not need to know its ID since all of these calls are going through the helper.
getSystemID()
Returns the AgentSystemID of the System where the Agent is executing.
getPlace()
Returns the place in the System where the Agent is running.
getLocation()
Returns the Location object identifying this Agent. This is used when an Agent wants for example register itself at the MAFFinder. When there is a security mechanism enabled the Agent will not have access to the java.net package, which keeps the Agent from getting the actual host. The actual ip number would be necessary to create a new Location object with its actual address.
conclude()
To conclude an Agent the platform has to do some tasks like removing the Agent from the hash tables. An Agent cannot terminate itself for this reason. Instead it has to call this method of its helper to be terminated by the System.
getProxy(String proxyinterface)
This method is used for access to resources (proxies of System Agents) of the System. When calling this method the System checks first if the Agent is allowed to access this resource object and returns it then to the Agent. The getProxy method requires a string of the interface as parameter.
print(String s)
This method should be used by the Agent to print its output to. The output of the Agent is forwarded to the methods of the System and then, if available, to all admin System Agents. This method prints the given string without adding a carriage return (or line feed) at the end.
println(String s)
This method does the same as the print method, but adds a new line at the end of the string.
print(Exception e)
this method should be used to print an exception. When catching a exception which is not expected (error in the program) this method should be used to let the System inform the administrator about it.
As already described, the Agent does not have access (when security is enabled in future) to more information or methods of the System. The helper should provide all methods which an Agent needs while running on the System.


next up previous contents
Next: The AgentLoader Up: Structure of an Agent Previous: Structure of an Agent   Contents
Thomas Letsch 2001-02-21