All Packages Class Hierarchy This Package Previous Next Index
Class ajanta.agent.Agent
java.lang.Object
|
+----ajanta.agent.Agent
- public abstract class Agent
- extends Object
- implements Serializable
The Agent class is the generic mobile agent. It serves as the base class
for all agents. Application-specific agents should be programmed as
sub-classes of Agent.
- See Also:
- Credentials, AgentStatus
-
creatorSignature
- signature of the credential signed by creator of the agent
-
cred
- Credentials of the agent
-
host
- host is the object reference to the current server's environment object.
-
myRef
-
-
name
- URN ( name ) of the agent
-
ownerSignature
- signature of the credential signed by owner of the agent
-
status
- status object is modified whenever a recall request is pending.
-
Agent()
- Default constructor of the agent which assigns cred, host, ownerSignature
and creatorSignature as null
-
Agent(Credentials)
- It assigns host, ownerSignature and creatorSignature as null.
-
Agent(Credentials, AgentEnv)
- It assigns ownerSignature and creatorSignature as null.
-
agentEntry()
- It system defined entry protocol and is the first method to be
automatically executed every time an agent arrives at a server.
-
agentExit()
- Agent's server executes this method just before it is sent off to
another server.
-
arrive()
- The arrive() method represents an entry protocol.
-
colocate(URN)
- This method is called to relocate the agent at the server where a
specified "target" object is currently resident.
-
colocate(URN, MethodSpec)
-
This method is called to relocate the agent at the server where a
specified "target" object is currently resident.
-
depart()
- The depart() method represents an exit protocol.
-
meet(URN, MethodSpec)
- This method acts as the starting point of execution for an agent
when it is relocated at a server.
-
recallCommand(URN, URN)
- This method is executed by the agent server currenlty hosting this agent when
it receives a recall request for this agent.
-
run()
- It is a empty method which can be overridden in subclasses.
-
signCreator(URN)
- It signs the credentials byte of the agent with specified server's ( creator) private keys
and store it in creatorSignature
-
signOwner()
- It signs the credentials byte of the agent with owner's private keys
and store it in ownerSignature
-
start(AgentEnv, URN, MethodSpec)
- After agent has been created this method is called to launch the agent
to appropriate server.
name
public URN name
- URN ( name ) of the agent
cred
public Credentials cred
- Credentials of the agent
ownerSignature
public byte ownerSignature[]
- signature of the credential signed by owner of the agent
creatorSignature
public byte creatorSignature[]
- signature of the credential signed by creator of the agent
host
public transient AgentEnv host
- host is the object reference to the current server's environment object.
status
public AgentStatus status
- status object is modified whenever a recall request is pending.
This information is checked in the agentExit method, which is executed
when the agent is about to leave a server.
myRef
public Object myRef
Agent
public Agent()
- Default constructor of the agent which assigns cred, host, ownerSignature
and creatorSignature as null
Agent
public Agent(Credentials cred)
- It assigns host, ownerSignature and creatorSignature as null. cred is assigned
to the Credentials passed as argument.
Agent
public Agent(Credentials cred,
AgentEnv host)
- It assigns ownerSignature and creatorSignature as null. cred is assigned
to the Credentials object passed as argument and host to AgentEnv object.
agentEntry
public final void agentEntry()
- It system defined entry protocol and is the first method to be
automatically executed every time an agent arrives at a server.
arrive
public abstract void arrive()
- The arrive() method represents an entry protocol. It is
automatically executed every time an agent arrives at a server.
It is an abstract method, and must be overridden in subclasses to
define the application-specific entry protocol.
depart
public abstract void depart()
- The depart() method represents an exit protocol. It is
automatically executed every time an agent leaves a server.
It is an abstract method, and must be overridden in subclasses to
define the application-specific exit protocol.
agentExit
public final void agentExit()
- Agent's server executes this method just before it is sent off to
another server. It checks agent's status to find whether a recall
is pending or not. If a recall is pending then it colocate the agent
to returnTo server set in recall command . If returnTo is not set
then it is colocated to guardian of the agent.
run
public void run()
- It is a empty method which can be overridden in subclasses. This
is the default method which get executed on a server if no other
method is specified
start
public void start(AgentEnv host,
URN dest,
MethodSpec action) throws LaunchFailedException, UnknownHostException
- After agent has been created this method is called to launch the agent
to appropriate server.
- Parameters:
- host - AgentEnv instance representing server's environment
- dest - URN of the destination server
- action - MethodSpec representing the method to be executed on the server
if null then run method is executed
colocate
public void colocate(URN target)
- This method is called to relocate the agent at the server where a
specified "target" object is currently resident.
- Parameters:
- target - URN of the target object
colocate
public void colocate(URN target,
MethodSpec as)
- This method is called to relocate the agent at the server where a
specified "target" object is currently resident. It execute the
meet method on the server. Meet method execute the specified method
in the MethodSpec
- Parameters:
- target - URN of the target object
- as - MethodSpec representing the method to be executed by meet method
meet
public void meet(URN reportTo,
MethodSpec as)
- This method acts as the starting point of execution for an agent
when it is relocated at a server. The meet method contains the specification
of the actions to be performed by the agent when it is relocated.
recallCommand
public void recallCommand(URN whoInvoked,
URN reportTo)
- This method is executed by the agent server currenlty hosting this agent when
it receives a recall request for this agent. It set the recallPending status of
the agent to true.
- Parameters:
- whoInvoked - URN of the recaller
- reportTo - URN of object with whom agent has to colocate on recall
signCreator
public void signCreator(URN serverURN)
- It signs the credentials byte of the agent with specified server's ( creator) private keys
and store it in creatorSignature
- Parameters:
- serverURN - URN of the creator of the agent
signOwner
public void signOwner()
- It signs the credentials byte of the agent with owner's private keys
and store it in ownerSignature
All Packages Class Hierarchy This Package Previous Next Index