All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ajanta.pattern.Split

java.lang.Object
   |
   +----ajanta.pattern.Pattern
           |
           +----ajanta.pattern.PatternCollection
                   |
                   +----ajanta.pattern.Split

public class Split
extends PatternCollection
This pattern results in the creation of child agents for parallel traversal of contained patterns. This is conceptually similar to parallelizing a Set, where instead of one agent travelling along some path defined by the Set , each child agent is assigned one element of the Set for traversal. This pattern only controls creation and dispatch of agents. It is used when the child agents are not expected to report back to the parent.


Variable Index

 o childClassName
All the child agents created are of this class
 o noOfChild
keep track of the number of child agents created

Constructor Index

 o Split()
 o Split(String)

Method Index

 o createAgent(AgentEnv, String, URN, Itinerary)
It creates a child agent of the class agentType.
 o next(AgentEnv)
It creates child agents equal to the number of the Pattern in the list.
 o reset()
It sets the status of Split Pattern to NOTDONE and resets the status of all the Patterns in the list by calling reset method of individual Patterns.
 o scan()
An empty method ....can overridden in derived classes
 o setAgentResource(ItinAgent, ItinAgent)
It is an empty method which will be overridden in derived class.

Variables

 o childClassName
 protected String childClassName
All the child agents created are of this class

 o noOfChild
 protected int noOfChild
keep track of the number of child agents created

Constructors

 o Split
 public Split()
 o Split
 public Split(String childClass)
Parameters:
childClass - name of the class whose instances will be all the child agents created

Methods

 o setAgentResource
 public void setAgentResource(ItinAgent agent,
                              ItinAgent parent)
It is an empty method which will be overridden in derived class. It is used pass certian resources from the parent agent to child agents.

Parameters:
agent - reference to the child agent
parent - reference to the parent agent
 o createAgent
 protected ItinAgent createAgent(AgentEnv host,
                                 String agentType,
                                 URN childURN,
                                 Itinerary itin)
It creates a child agent of the class agentType. If agentType is null then it creates as that of the parent class. The constructor of the class for child agent's class should take two parameters. First parameter is Credentials object and second is the Itinerary object. Credentials of child agent owner field set to that of the owner of the parent, gurdian is set to that of parent agent and creator is set to the current host

Parameters:
host - AgentEnv of the current server
agentType - class name for the child agents
childURN - URN for the child agents
itin - Itinerary for the child agents
Returns:
It returns reference of the child agent created
 o next
 protected int next(AgentEnv host)
It creates child agents equal to the number of the Pattern in the list. Each Child agent is assigned a Pattern from the list of Patterns. Child agents are signed by the creator's ( current server's) private key and launched by calling start method of the agent. Child agents are registered with the name registry before they are launched.URN of the child agent is of the form
parent URN + "/" + Name of parent + child number

Parameters:
host - AgentEnv of the current agent server
Overrides:
next in class Pattern
 o reset
 protected void reset()
It sets the status of Split Pattern to NOTDONE and resets the status of all the Patterns in the list by calling reset method of individual Patterns.

Overrides:
reset in class PatternCollection
 o scan
 protected void scan()
An empty method ....can overridden in derived classes

Overrides:
scan in class Pattern

All Packages  Class Hierarchy  This Package  Previous  Next  Index