ajanta.agent
Class ItinAgent

java.lang.Object
  |
  +--ajanta.agent.Agent
        |
        +--ajanta.agent.ItinAgent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
JoinableAgent

public class ItinAgent
extends Agent

ItinAgent class extends the Agent class and abstracts the agent's mobility into an Itinerary. An Itinerary encode the agent's migration path, hence allows agent programmer to create a travel plan for the agent. Travel plans are created out of certain basic migartion patterns.

See Also:
ajanta.pattern, Serialized Form

Field Summary
 ajanta.pattern.Itinerary itin
           
 
Fields inherited from class ajanta.agent.Agent
creatorSignature, cred, host, myRef, name, ownerSignature, status
 
Constructor Summary
ItinAgent(ajanta.agent.Credentials cred)
          Itinerary of the agent is set to null
ItinAgent(ajanta.agent.Credentials cred, ajanta.pattern.Itinerary itin)
           
 
Method Summary
 void arrive()
          The arrive() method represents an entry protocol.
 void checkDepartStatus(int status)
          This method is called by depart method giving it status of next() call in depart.
 void depart()
          The depart() method represents an exit protocol.
 ajanta.pattern.Itinerary getItinerary()
          Itinerary and Credentials of the agent is set to null
 void noOp()
           
 void run()
          It is a empty method which can be overridden in subclasses.
 void setItinerary(ajanta.pattern.Itinerary itin)
          It sets the itinerary of the agent to the Itinerary object passed as argument
 void start(ajanta.server.AgentEnv host)
          After agent has been successfuly created start method is called to launch the agent to first server in the itinerary.
 
Methods inherited from class ajanta.agent.Agent
agentEntry, agentExit, colocate, colocate, meet, recallCommand, signCreator, signOwner, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

itin

public ajanta.pattern.Itinerary itin
Constructor Detail

ItinAgent

public ItinAgent(ajanta.agent.Credentials cred,
                 ajanta.pattern.Itinerary itin)
Parameters:
cred - Credentials object of the agent
itin - Itinerary ( travel plan )object for the agent

ItinAgent

public ItinAgent(ajanta.agent.Credentials cred)
Itinerary of the agent is set to null

Parameters:
cred - Credentials object of the agent
Method Detail

getItinerary

public ajanta.pattern.Itinerary getItinerary()
Itinerary and Credentials of the agent is set to null


start

public final void start(ajanta.server.AgentEnv host)
                 throws LaunchFailedException,
                        java.net.UnknownHostException,
                        java.lang.Exception
After agent has been successfuly created start method is called to launch the agent to first server in the itinerary.

Parameters:
host - current agent server's AgentEnv ( agent environment )object
LaunchFailedException
java.net.UnknownHostException
java.lang.Exception

arrive

public void arrive()
The arrive() method represents an entry protocol. It is automatically executed every time an agent arrives at a server. It is an empty method, and can be overridden in subclasses to define the application-specific entry protocol.

Specified by:
arrive in class Agent

depart

public final void depart()
The depart() method represents an exit protocol. It is automatically executed every time an agent leaves a server. If itinerary is not yet completed then it launches the agent to the next server in the itinerary by calling next() on Itinerary object. This is a final method and can not be overridden in derived classes.

Specified by:
depart in class Agent

checkDepartStatus

public void checkDepartStatus(int status)
This method is called by depart method giving it status of next() call in depart. Here application specific action can be taken based on the results of depart call.


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.

Overrides:
run in class Agent

noOp

public final void noOp()

setItinerary

public void setItinerary(ajanta.pattern.Itinerary itin)
It sets the itinerary of the agent to the Itinerary object passed as argument