Spring Web Flow

org.springframework.webflow.engine.model.builder
Interface FlowModelBuilder

All Known Implementing Classes:
XmlFlowModelBuilder

public interface FlowModelBuilder

Builder interface used to build a flow model. The process of building a flow model consists of the following steps:

  1. Initialize this builder by calling init().
  2. Call build() to create the flow model.
  3. Call getFlowModel() to return the fully-built FlowModel model.
  4. Dispose this builder, releasing any resources allocated during the building process by calling dispose().

Implementations should encapsulate flow construction logic, either for a specific kind of flow, for example, an XmlFlowModelBuilder, for building flows from an XML-definition.

This is a good example of the classic GoF builder pattern.

Author:
Keith Donald, Erwin Vervaet, Scott Andrews
See Also:
FlowModel

Method Summary
 void build()
          Builds any variables initialized by the flow when it starts.
 void dispose()
          Shutdown the builder, releasing any resources it holds.
 FlowModel getFlowModel()
          Get the fully constructed flow model.
 org.springframework.core.io.Resource getFlowModelResource()
          Get the underlying flow model resource accessed to build this flow model.
 boolean hasFlowModelResourceChanged()
          Returns true if the underlying flow model resource has changed since the last call to init().
 void init()
          Initialize this builder.
 

Method Detail

init

void init()
          throws FlowModelBuilderException
Initialize this builder. This could cause the builder to open a stream to an externalized resource representing the flow definition, for example.

Throws:
FlowModelBuilderException - an exception occurred building the flow

build

void build()
           throws FlowModelBuilderException
Builds any variables initialized by the flow when it starts.

Throws:
FlowModelBuilderException - an exception occurred building the flow

getFlowModel

FlowModel getFlowModel()
                       throws FlowModelBuilderException
Get the fully constructed flow model. 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 model is ready for use.

Throws:
FlowModelBuilderException - an exception occurred building this flow

dispose

void dispose()
             throws FlowModelBuilderException
Shutdown the builder, releasing any resources it holds. A new flow construction process should start with another call to the init() method.

Throws:
FlowModelBuilderException - an exception occurred disposing this flow

getFlowModelResource

org.springframework.core.io.Resource getFlowModelResource()
Get the underlying flow model resource accessed to build this flow model. Returns null if this builder does not construct the flow model from a resource.

Returns:
the flow model resource

hasFlowModelResourceChanged

boolean hasFlowModelResourceChanged()
Returns true if the underlying flow model resource has changed since the last call to init(). Always returns false if the flow model is not build from a resource.

Returns:
true if the resource backing the flow model has changed

Spring Web Flow