Arch4J 1.1

org.arch4j.clientcontroller
Class State

java.lang.Object
  |
  +--org.arch4j.clientcontroller.State
Direct Known Subclasses:
ErrorState

public abstract class State
extends Object

This abstract class defines basic behavior for a state.

All deriving state implementations should have a section of javadoc in the class heading based on the following:

State overview

Version:
1.0
Author:
David Colwell

Constructor Summary
State()
          Constructs a State object.
 
Method Summary
protected  void appendTransition(Transition aTransition)
          Allows subclasses to specify Transitions.
abstract  void buildTransitionList()
          Build the transitionList of Transitions available from this State.
protected  void createEmbeddedStateMachine(Transition entryTransition, StateContext context)
          Helper method to create an embedded StateMachine.
protected  void createEmbeddedStateMachine(Transition entryTransition, Transition exitTransition, StateContext context)
          Helper method to create an embedded StateMachine.
 void entryAction(StateContext context)
          Perform the entry action for this state.
 void exitAction(StateContext context)
          Perform the exit action for this state.
protected  StateMachine getEmbeddedStateMachine()
          Retrieves the embedded state machine.
abstract  String getStateName()
          Retrieves the unique state name.
protected  List getTransitionList()
          Retrieve the list of Transitions available from this State.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

State

public State()
Constructs a State object. Subclass constructors will call this default constructor implicitly.

Method Detail

appendTransition

protected void appendTransition(Transition aTransition)
Allows subclasses to specify Transitions. Note that the order the Transitions are added implies priority. If two Transitions are not mutually exclusive in their events and guard conditions, then the first in the list will execute and the second will not.

See Also:
buildTransitionList()

createEmbeddedStateMachine

protected void createEmbeddedStateMachine(Transition entryTransition,
                                          StateContext context)
                                   throws StateMachineException
Helper method to create an embedded StateMachine.

Throws:
StateMachineException - if there is any problem processing the request. This might include a missing key-value, application server problems, failed domain validation, or data access errors.

createEmbeddedStateMachine

protected void createEmbeddedStateMachine(Transition entryTransition,
                                          Transition exitTransition,
                                          StateContext context)
                                   throws StateMachineException
Helper method to create an embedded StateMachine.

Throws:
StateMachineException - if there is any problem processing the request. This might include a missing key-value, application server problems, failed domain validation, or data access errors.

getEmbeddedStateMachine

protected StateMachine getEmbeddedStateMachine()
Retrieves the embedded state machine.

Returns:
The embedded state machine, if it exists, otherwise null.

getTransitionList

protected final List getTransitionList()
Retrieve the list of Transitions available from this State.


getStateName

public abstract String getStateName()
Retrieves the unique state name. Note that this should not be defined to contain the '~' character as this is used as the full state name seperator.


entryAction

public void entryAction(StateContext context)
                 throws StateMachineException
Perform the entry action for this state. This will typically be data retrieval and setup. If this state has an embedded state machine, a call to createEmbeddedStateMachine should go here as well.

Throws:
StateMachineException - if there is a system related problem processing the request. This might be a missing key-value, application server problems, failed domain validation, or data access errors.

exitAction

public void exitAction(StateContext context)
                throws StateMachineException
Perform the exit action for this state. This will typically be for clean-up, if necessary.

Throws:
StateMachineException - if there is a system related problem processing the request. This might be a missing key-value, application server problems, failed domain validation, or data access errors.

buildTransitionList

public abstract void buildTransitionList()
Build the transitionList of Transitions available from this State. The implementation method will use addTransition to add new Transitions.


Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.