ajanta.pattern
Class Selection

java.lang.Object
  |
  +--ajanta.pattern.Pattern
        |
        +--ajanta.pattern.PatternCollection
              |
              +--ajanta.pattern.Selection
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Selection
extends PatternCollection

This emulates conditional control structure. The traversal of this pattern implies choosing one pattern from the list based on a user-defined choosePattern method. This choice could be made on basis of the agent's state or the hosts to be visited in the pattern. Strategies for making a selection could be randomized, priority-based, etc. This pattern is also useful in selecting alternate paths in case of failures, like unavailability of hosts.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class ajanta.pattern.PatternCollection
current, list
 
Fields inherited from class ajanta.pattern.Pattern
action, DONE, FAILED, NOTDONE, status
 
Constructor Summary
Selection()
           
 
Method Summary
protected  ajanta.pattern.Pattern chooseNext()
          Selects next pattern to execute
protected  int choosePattern()
          It will determine the location of the next Pattern in the list by modifying value of current .
protected  int next(ajanta.server.AgentEnv host)
          Based on a user-defined choosePattern method it find next pattern to be executed and call next on that.
protected  void scan()
          An empty method ....can overridden in derived classes
 
Methods inherited from class ajanta.pattern.PatternCollection
currentEntry, firstEntry, insert, join, print, reset
 
Methods inherited from class ajanta.pattern.Pattern
getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Selection

public Selection()
Method Detail

next

protected int next(ajanta.server.AgentEnv host)
            throws java.net.UnknownHostException
Based on a user-defined choosePattern method it find next pattern to be executed and call next on that. This is performed as long as there is some patterns which has not be DONE.

Specified by:
next in class Pattern
java.net.UnknownHostException

scan

protected void scan()
An empty method ....can overridden in derived classes

Specified by:
scan in class Pattern

chooseNext

protected ajanta.pattern.Pattern chooseNext()
Selects next pattern to execute


choosePattern

protected int choosePattern()
It will determine the location of the next Pattern in the list by modifying value of current . It is application specific method and should be appropraitely overridden. Currenyly it provides sequential order