ajanta.agent
Class ReportableAgent

java.lang.Object
  |
  +--ajanta.agent.Agent
        |
        +--ajanta.agent.ReportableAgent
All Implemented Interfaces:
AccessProtocol, Reportable, Resource, java.io.Serializable

public class ReportableAgent
extends Agent
implements Resource, AccessProtocol, Reportable

Often it is necessary for Agents to return and report their results back to another principal -- a server, an agent or just another object. Agents may also encounter exceptions in trying to perform their task. They may need to contact another principal (usually the guardian) to help them handle these exceptions. Hence they need to be able to report to these principals which can examine the agent's current state and take the necessary actions. Any agent wishing to either report results or get its exception handled appropriatly can be derived from this class.

See Also:
Resource, AccessProtocol, Reportable, Serialized Form

Field Summary
 
Fields inherited from class ajanta.agent.Agent
creatorSignature, cred, host, myRef, name, ownerSignature, status
 
Constructor Summary
ReportableAgent(ajanta.agent.Credentials cred)
           
 
Method Summary
 void arrive()
          It register the agent as a resource with agent's URN as the name of resource
 void depart()
          Empty method and should be overridden in derived classes
 ajanta.util.Resource getProxy(ajanta.agent.Credentials cred)
          Return a proxy of the resource based on the credential of the caller.
 void report(ajanta.agent.Agent ag)
          It just print agent' name and should be appropriately overridden in derived classes.
 
Methods inherited from class ajanta.agent.Agent
agentEntry, agentExit, colocate, colocate, meet, recallCommand, run, signCreator, signOwner, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportableAgent

public ReportableAgent(ajanta.agent.Credentials cred)
Parameters:
cred - Credentials object for the agent
Method Detail

report

public void report(ajanta.agent.Agent ag)
It just print agent' name and should be appropriately overridden in derived classes.

Specified by:
report in interface Reportable
Parameters:
ag - - the agent repoting

arrive

public void arrive()
It register the agent as a resource with agent's URN as the name of resource

Specified by:
arrive in class Agent

depart

public void depart()
Empty method and should be overridden in derived classes

Specified by:
depart in class Agent

getProxy

public ajanta.util.Resource getProxy(ajanta.agent.Credentials cred)
Description copied from interface: AccessProtocol
Return a proxy of the resource based on the credential of the caller.

Specified by:
getProxy in interface AccessProtocol
Parameters:
cred - Credentials object of the caller
Returns:
reference to this agent