All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class uhr.core.role.StateCommandableAideFactory

java.lang.Object
   |
   +----uhr.core.role.StateCommandableAideFactory

public class StateCommandableAideFactory
extends Object
This is a factory for StateCommandableAides. The advantage is the aides created already have the desired StateMachine. This allows more concise StateCommandable implementations and more StateMachine reuse.

The factory comes with several popular built in StateMachines. More may be added to suit your domain. The built in ones are:

    ID = RunTest, no propogated commands.
    Transitions - State, Command, NewState
              1. Created, RunTest, Running
    ID = Start, no propogated commands.
    Transitions - State, Command, NewState
              1. Created, Start,   Running
 


Constructor Index

 o StateCommandableAideFactory()

Method Index

 o addStateMachine(String, StateMachine)
Adds the state machine to the factory using the id.
 o createAide(String)
Creates an aide with the StateMachine having the id.
 o createAide(String, StateCommandable)
Creates an aide with the StateMachine having the id, and the commandable.
 o enumerateStateMachineIDs()
Returns an enumeration of all the StateMachine ids in the factory.
 o getStateMachine(String)
Returns the StateMachine for the id or null if none.

Constructors

 o StateCommandableAideFactory
 public StateCommandableAideFactory()

Methods

 o createAide
 public static StateCommandableAide createAide(String stateMachineID)
Creates an aide with the StateMachine having the id.

Parameters:
stateMachineID - identifies the StateMachine to use.
Returns:
a new aide.
Throws: IllegalStateException
if no StateMachine with the id has been added to the factory.
 o createAide
 public static StateCommandableAide createAide(String stateMachineID,
                                               StateCommandable commandable)
Creates an aide with the StateMachine having the id, and the commandable.

Parameters:
stateMachineID - identifies the StateMachine to use.
commandable - the aide's StateCommandable.
Returns:
a new aide.
Throws: IllegalStateException
if no StateMachine with the id has been added to the factory.
 o addStateMachine
 public static void addStateMachine(String id,
                                    StateMachine machine)
Adds the state machine to the factory using the id.

Parameters:
id - the machine identifier, unique to this factory.
machine - the state machine to be added.
Throws: IllegalStateException
if the id has already been added.
 o enumerateStateMachineIDs
 public static Enumeration enumerateStateMachineIDs()
Returns an enumeration of all the StateMachine ids in the factory.

Returns:
the ids in no particular order.
 o getStateMachine
 public static StateMachine getStateMachine(String id)
Returns the StateMachine for the id or null if none.

Parameters:
id - the id to use to lookup the StateMachine added with the id.
Returns:
the StateMachine with the id or null if none.

All Packages  Class Hierarchy  This Package  Previous  Next  Index