Spring Web Flow

org.springframework.webflow.engine.builder.support
Class AbstractFlowBuilder

java.lang.Object
  extended by org.springframework.webflow.engine.builder.support.AbstractFlowBuilder
All Implemented Interfaces:
FlowBuilder
Direct Known Subclasses:
FlowModelFlowBuilder

public abstract class AbstractFlowBuilder
extends java.lang.Object
implements FlowBuilder

Abstract base implementation of a flow builder defining common functionality needed by most concrete flow builder implementations. This class implements all optional parts of the FlowBuilder process as no-op methods. Subclasses are only required to implement buildStates().

Author:
Keith Donald, Erwin Vervaet

Constructor Summary
AbstractFlowBuilder()
           
 
Method Summary
 void buildEndActions()
          Builds any end actions to execute when the flow ends.
 void buildExceptionHandlers()
          Creates and adds all exception handlers to the flow built by this builder.
 void buildGlobalTransitions()
          Builds any transitions shared by all states of the flow.
 void buildInputMapper()
          Builds the input mapper responsible for mapping flow input on start.
 void buildOutputMapper()
          Builds the output mapper responsible for mapping flow output on end.
 void buildStartActions()
          Builds any start actions to execute when the flow starts.
abstract  void buildStates()
          Builds the states of the flow.
 void buildVariables()
          Builds any variables initialized by the flow when it starts.
protected  Flow createFlow()
          Factory method that initially creates the flow implementation during flow builder initialization.
 void dispose()
          Shutdown the builder, releasing any resources it holds.
protected  void doDispose()
          Flow builder destruction hook.
protected  void doInit()
          Flow builder initialization hook.
protected  FlowBuilderContext getContext()
          Returns this flow builder's context.
 Flow getFlow()
          Get the fully constructed and configured Flow object.
 java.lang.String getFlowResourceString()
          Returns a string describing the location of the flow resource; the logical location where the source code can be found.
 boolean hasFlowChanged()
          As the underlying flow managed by this builder changed since the last build occurred?
 void init(FlowBuilderContext context)
          Initialize this builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFlowBuilder

public AbstractFlowBuilder()
Method Detail

init

public void init(FlowBuilderContext context)
          throws FlowBuilderException
Description copied from interface: FlowBuilder
Initialize this builder. This could cause the builder to open a stream to an externalized resource representing the flow definition, for example.

Specified by:
init in interface FlowBuilder
Parameters:
context - the flow builder context
Throws:
FlowBuilderException - an exception occurred building the flow

doInit

protected void doInit()
Flow builder initialization hook. Does nothing by default. May be overridden by subclasses.


createFlow

protected Flow createFlow()
Factory method that initially creates the flow implementation during flow builder initialization. Simply delegates to the configured flow artifact factory by default.

Returns:
the flow instance, initially created but not yet built

getContext

protected FlowBuilderContext getContext()
Returns this flow builder's context.

Returns:
the flow builder context

buildVariables

public void buildVariables()
                    throws FlowBuilderException
Description copied from interface: FlowBuilder
Builds any variables initialized by the flow when it starts.

Specified by:
buildVariables in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building the flow

buildInputMapper

public void buildInputMapper()
                      throws FlowBuilderException
Description copied from interface: FlowBuilder
Builds the input mapper responsible for mapping flow input on start.

Specified by:
buildInputMapper in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building the flow

buildStartActions

public void buildStartActions()
                       throws FlowBuilderException
Description copied from interface: FlowBuilder
Builds any start actions to execute when the flow starts.

Specified by:
buildStartActions in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building the flow

buildStates

public abstract void buildStates()
                          throws FlowBuilderException
Description copied from interface: FlowBuilder
Builds the states of the flow.

Specified by:
buildStates in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building the flow

buildGlobalTransitions

public void buildGlobalTransitions()
                            throws FlowBuilderException
Description copied from interface: FlowBuilder
Builds any transitions shared by all states of the flow.

Specified by:
buildGlobalTransitions in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building the flow

buildEndActions

public void buildEndActions()
                     throws FlowBuilderException
Description copied from interface: FlowBuilder
Builds any end actions to execute when the flow ends.

Specified by:
buildEndActions in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building the flow

buildOutputMapper

public void buildOutputMapper()
                       throws FlowBuilderException
Description copied from interface: FlowBuilder
Builds the output mapper responsible for mapping flow output on end.

Specified by:
buildOutputMapper in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building the flow

buildExceptionHandlers

public void buildExceptionHandlers()
                            throws FlowBuilderException
Description copied from interface: FlowBuilder
Creates and adds all exception handlers to the flow built by this builder.

Specified by:
buildExceptionHandlers in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building this flow

getFlow

public Flow getFlow()
             throws FlowBuilderException
Description copied from interface: FlowBuilder
Get the fully constructed and configured Flow object. Called by the builder's assembler (director) after assembly. When this method is called by the assembler, it is expected flow construction has completed and the returned flow is fully configured and ready for use.

Specified by:
getFlow in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building this flow

dispose

public void dispose()
             throws FlowBuilderException
Description copied from interface: FlowBuilder
Shutdown the builder, releasing any resources it holds. A new flow construction process should start with another call to the FlowBuilder.init(FlowBuilderContext) method.

Specified by:
dispose in interface FlowBuilder
Throws:
FlowBuilderException - an exception occurred building this flow

hasFlowChanged

public boolean hasFlowChanged()
Description copied from interface: FlowBuilder
As the underlying flow managed by this builder changed since the last build occurred?

Specified by:
hasFlowChanged in interface FlowBuilder
Returns:
true if changed, false if not

getFlowResourceString

public java.lang.String getFlowResourceString()
Description copied from interface: FlowBuilder
Returns a string describing the location of the flow resource; the logical location where the source code can be found. Used for informational purposes.

Specified by:
getFlowResourceString in interface FlowBuilder
Returns:
the flow resource string

doDispose

protected void doDispose()
Flow builder destruction hook. Does nothing by default. May be overridden by subclasses.


Spring Web Flow