next up previous contents
Next: suspendUser() Up: Extending the basic Agent Previous: initUser()   Contents

startUser()

This method is called when ever the Agent is started or resumed after being stopped. This is also called when reaching a new Agent System after traveling. In this method one should write the code which is dependent on the actual System where the Agent executes. Also this method should not exceed processing time. The real work an Agent does has to be put into the own working methods and be set as a command to execute. When this method is called the Agent is already registered at the MAFFinder. This is done by the basic Agent class.

The startUser of the example contains the following code:

try{

   Location[] obs = getMAFFinder().lookupAgent(

                      new Name(helper.getID()), profile);

   helper.println(``Registered with location '' + obs[0]);

} catch(Exception e) {helper.print(e);};

helper.println(``Start called...''); 

Since the Agent should be registered it can now do a lookup for its entry in the MAFFinder. It does this by using the method to get the actual MAFFinder of the System and queries it for an Agent with its Name and AgentProfile. This should return its current location.


next up previous contents
Next: suspendUser() Up: Extending the basic Agent Previous: initUser()   Contents
Thomas Letsch 2001-02-21