org.springframework.webflow.engine.builder
Class BaseFlowBuilder

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

public abstract class BaseFlowBuilder
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 init(String, AttributeMap) and buildStates().

This class also provides a FlowServiceLocator for use by subclasses in the flow construction process.

Author:
Keith Donald, Erwin Vervaet
See Also:
FlowServiceLocator

Constructor Summary
protected BaseFlowBuilder()
          Default constructor for subclassing.
protected BaseFlowBuilder(FlowServiceLocator flowServiceLocator)
          Creates a flow builder using the given locator to link in artifacts.
 
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 buildInlineFlows()
          Builds any "in-line" flows encapsulated by 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.
 void dispose()
          Shutdown the builder, releasing any resources it holds.
protected  org.springframework.binding.convert.ConversionExecutor fromStringTo(java.lang.Class targetType)
          Returns a converter capable of converting a string value to the given type.
protected  org.springframework.binding.convert.ConversionExecutor fromStringTo(java.lang.String targetAlias)
          Returns a conversion executor capable of converting string objects to the target class aliased by the provided alias.
 Flow getFlow()
          Get the flow (result) built by this builder.
 FlowServiceLocator getFlowServiceLocator()
          Returns the configured flow service locator.
abstract  void init(java.lang.String flowId, AttributeMap attributes)
          Initialize this builder.
protected  void setFlow(Flow flow)
          Set the flow being built by this builder.
 void setFlowServiceLocator(FlowServiceLocator flowServiceLocator)
          Sets the flow service locator to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseFlowBuilder

protected BaseFlowBuilder()
Default constructor for subclassing. Sets up use of a BaseFlowServiceLocator.

See Also:
setFlowServiceLocator(FlowServiceLocator)

BaseFlowBuilder

protected BaseFlowBuilder(FlowServiceLocator flowServiceLocator)
Creates a flow builder using the given locator to link in artifacts.

Parameters:
flowServiceLocator - the locator for services needed by this builder to build its Flow
Method Detail

getFlowServiceLocator

public FlowServiceLocator getFlowServiceLocator()
Returns the configured flow service locator.


setFlowServiceLocator

public void setFlowServiceLocator(FlowServiceLocator flowServiceLocator)
Sets the flow service locator to use. Defaults to BaseFlowServiceLocator.


setFlow

protected void setFlow(Flow flow)
Set the flow being built by this builder. Typically called during initialization to set the initial flow reference returned by getFlow() after building.


init

public abstract void init(java.lang.String flowId,
                          AttributeMap attributes)
                   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:
flowId - the identifier to assign to the flow
attributes - custom attributes to assign to the flow
Throws:
FlowBuilderException - an exception occured building the flow

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 occured 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 occured 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 occured building the flow

buildInlineFlows

public void buildInlineFlows()
                      throws FlowBuilderException
Description copied from interface: FlowBuilder
Builds any "in-line" flows encapsulated by the flow.

Specified by:
buildInlineFlows in interface FlowBuilder
Throws:
FlowBuilderException - an exception occured 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 occured 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 occured 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 occured 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 occured 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 occured building this flow

getFlow

public Flow getFlow()
Get the flow (result) built by this builder.

Specified by:
getFlow in interface FlowBuilder

dispose

public void dispose()
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(String, AttributeMap) method.

Specified by:
dispose in interface FlowBuilder

fromStringTo

protected org.springframework.binding.convert.ConversionExecutor fromStringTo(java.lang.String targetAlias)
Returns a conversion executor capable of converting string objects to the target class aliased by the provided alias.

Parameters:
targetAlias - the target class alias, e.g. "long" or "float"
Returns:
the conversion executor, or null if no suitable converter exists for given alias

fromStringTo

protected org.springframework.binding.convert.ConversionExecutor fromStringTo(java.lang.Class targetType)
                                                                       throws org.springframework.binding.convert.ConversionException
Returns a converter capable of converting a string value to the given type.

Parameters:
targetType - the type you wish to convert to (from a string)
Returns:
the converter
Throws:
org.springframework.binding.convert.ConversionException - when the converter cannot be found


Copyright © 2004-2007. All Rights Reserved.