com.itmusings.stm
Interface STM

All Known Implementing Classes:
STMImpl

public interface STM

An implementation of a state transition machine. This would allow the caller to proceed from one state to the other. The implementation is designed to support two types of states:

  • Auto state - a state whose transitions can be computed automatically by calling a method in a class.
  • Manual state - a state that requires some triggering event (ex: user input in a form, user responding to an email etc.) to progress further.

    The STM also supports the notion of an initial state

    Author:
    Raja Shankar Kolluru

    Field Summary
    static java.lang.String FAILURE
               
    static java.lang.String SUCCESS
               
     
    Method Summary
     State proceed(java.lang.Object flowContext)
              This method allows the user to specify no starting state and feed it to the STM.
     State proceed(State startingState, java.lang.Object flowContext)
              This method allows the user to specify a starting state and feed it to the STM.
     State proceed(State startingState, java.lang.String startingEventId, java.lang.Object flowContext)
              This method allows the user to specify a starting state and feed it to the STM.
     void setFlowConfigurator(FlowConfigurator flowConfigurator)
              Initialization method.
     

    Field Detail

    SUCCESS

    static final java.lang.String SUCCESS
    See Also:
    Constant Field Values

    FAILURE

    static final java.lang.String FAILURE
    See Also:
    Constant Field Values
    Method Detail

    proceed

    State proceed(java.lang.Object flowContext)
                  throws java.lang.Exception
    This method allows the user to specify no starting state and feed it to the STM. This would start with the default flow and the initial state in it. It would then recursively process thru all "auto states" and finally returns the new state to which it transitioned.

    The new state is either an end state or a manual state (i.e. a state that requires a user triggered action to determine the transitioning event)

    This proceed() method supports the following kinds of behavior:

  • If the state passed is null, then the initial state of the default flow is chosen.
  • Parameters:
    flowContext - - the context for the flow.
    Returns:
    the transitioned state.
    Throws:
    java.lang.Exception

  • proceed

    State proceed(State startingState,
                  java.lang.Object flowContext)
                  throws java.lang.Exception
    This method allows the user to specify a starting state and feed it to the STM. This would recursively process thru all "auto states" and finally returns the new state to which it transitioned.

    The new state is either an end state or a manual state (i.e. a state that requires a user triggered action to determine the transitioning event)

    This proceed() method supports the following kinds of behavior:

  • If the state passed is null, then the initial state of the default flow is chosen.
  • Parameters:
    startingState - - the specified state in the specified flow
    flowContext - - the context for the flow.
    Returns:
    the transitioned state.
    Throws:
    java.lang.Exception

  • proceed

    State proceed(State startingState,
                  java.lang.String startingEventId,
                  java.lang.Object flowContext)
                  throws java.lang.Exception
    This method allows the user to specify a starting state and feed it to the STM. This would recursively process thru all "action states" and finally returns the new state to which it transitioned.

    The new state is either an end state or a view state (i.e. a state that requires a user triggered action to determine the transitioning event)

    This proceed() method uses the specified state in the specified flow.

    Parameters:
    startingState - - the state you start the flow in
    startingEventId - - the event that needs to start the flow. This would have been most probably obtained by the user.
    flowContext - - the context for the flow.
    Returns:
    the transitioned state.
    Throws:
    java.lang.Exception

    setFlowConfigurator

    void setFlowConfigurator(FlowConfigurator flowConfigurator)
    Initialization method. The flow needs to be read by a flow configurator which needs to be set into the STM.

    Parameters:
    flowConfigurator -


    Copyright © 2011 ITMUSINGS. All Rights Reserved.