next up previous contents
Next: Example Agent Up: Creating an Agent Previous: helper.getProxy(String proxyInterface)   Contents

Helper

The helper is the only way the Agent has to access to resources. It provides some needed information about the System and some methods to do output. All resource requests are identified by the AgentID of the Agent when going through the helper to the platform. The helper provides the Agent with the following information about the System:

getAgentSystemName()
Returns the name of the Agent.
getID()
Returns the AgentID of the Agent.
getSystemID()
Returns the AgentSystemID of the System.
getPlace()
Returns the place where the Agent resides.
getLocation()
Returns the location of the Agent. This is used for example by the basic Agent to register at the MAFFinder.
The output of the Agent should not be done using the standard System.print() and System.println() methods. Instead the helper provides the following output methods:

print(String s)
Prints the string to the desired output stream. This can be the standard output stream of the java System class or the registered admin System Agents. Replaces System.print(String s).
println(String s)
Prints the string to the desired output stream and adds a new line to the end. Replaces System.println(String s).
print(Exception e)
Should be called to inform the System about an exception. Replaces Exception.printStackTrace() or similar methods.
To terminate itself the Agent has to call the method conclude() of the helper. It should not call the terminateUser() or terminateAgent() directly. This would not have the expected effecttypeset@protect @@footnote SF@gobble@opt The Agent itself would have been stopped, but the System would not know about it. The loader would still have another status and the Agent object would still reside in the JVM, because it would still be referenced by the System. .


next up previous contents
Next: Example Agent Up: Creating an Agent Previous: helper.getProxy(String proxyInterface)   Contents
Thomas Letsch 2001-02-21