|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
Annotated | An interface to be implemented by objects that are annotated with attributes they wish to expose to clients. |
FlowDefinition | The definition of a flow, a program that when executed carries out the orchestration of a task on behalf of a single client. |
StateDefinition | A step within a flow definition where behavior is executed. |
TransitionableStateDefinition | A state that can transition to another state. |
TransitionDefinition | A transition takes a flow from one state to another. |
Core, stable abstractions for representing flow definitions.
Each flow has an indentifier and is composed of one or more states, one of which is the start state. States may be transitionable, and if so define one or more transitions that lead to other states.
With these types a client can introspect a flow definition to reason on its attributes and traverse its structure, perhaps to display a visual diagram. Note that the types defined in this package do not capture the behavioral characteristics of a flow.
The following code shows the beginnings of a basic flow definition traversal algorithm:
FlowDefinition flow = ... // lookup start state StateDefinition state = flow.getStartState(); // traverse to state transitions traverse(state); public void traverse(StateDefinition state) { logger.info("State: " + state.getId()); while (state instanceof TransitionableStateDefinition) { TransitionableStateDefinition transitionable = (TransitionableStateDefinition)state; TransitionDefinition[] transitions = transitionable.getTransitions(); for (int i = 0; i < transitions.length; i++) { Transition t = transitions[i]; logger.info("Transition " + t.getId()); traverse(state.getOwner().getState(t.getTargetStateId()); } } }
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |