Spring Web Flow

org.springframework.webflow.engine.model.builder.xml
Class XmlFlowModelBuilder

java.lang.Object
  extended by org.springframework.webflow.engine.model.builder.xml.XmlFlowModelBuilder
All Implemented Interfaces:
FlowModelBuilder

public class XmlFlowModelBuilder
extends java.lang.Object
implements FlowModelBuilder

Builds a flow model from a XML-based flow definition resource.

Author:
Keith Donald, Scott Andrews

Constructor Summary
XmlFlowModelBuilder(org.springframework.core.io.Resource resource)
          Create a new XML flow model builder that will parse the XML document at the specified resource location and use the provided locator to access parent flow models.
XmlFlowModelBuilder(org.springframework.core.io.Resource resource, FlowModelLocator modelLocator)
          Create a new XML flow model builder that will parse the XML document at the specified resource location and use the provided locator to access parent flow models.
 
Method Summary
 void build()
          Builds any variables initialized by the flow when it starts.
 void dispose()
          Shutdown the builder, releasing any resources it holds.
protected  org.w3c.dom.Document getDocument()
          Returns the DOM document parsed from the XML file.
protected  org.w3c.dom.Element getDocumentElement()
          Returns the root document element.
 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 FlowModelBuilder.init().
 void init()
          Initialize this builder.
 void setDocumentLoader(DocumentLoader documentLoader)
          Sets the loader that will load the XML-based flow definition document.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlFlowModelBuilder

public XmlFlowModelBuilder(org.springframework.core.io.Resource resource)
Create a new XML flow model builder that will parse the XML document at the specified resource location and use the provided locator to access parent flow models.

Parameters:
resource - the path to the XML flow definition (required)

XmlFlowModelBuilder

public XmlFlowModelBuilder(org.springframework.core.io.Resource resource,
                           FlowModelLocator modelLocator)
Create a new XML flow model builder that will parse the XML document at the specified resource location and use the provided locator to access parent flow models.

Parameters:
resource - the path to the XML flow definition (required)
modelLocator - a locator for parent flow models to support flow inheritance
Method Detail

setDocumentLoader

public void setDocumentLoader(DocumentLoader documentLoader)
Sets the loader that will load the XML-based flow definition document. Optional, defaults to DefaultDocumentLoader.

Parameters:
documentLoader - the document loader

init

public void init()
          throws FlowModelBuilderException
Description copied from interface: FlowModelBuilder
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 FlowModelBuilder
Throws:
FlowModelBuilderException - an exception occurred building the flow

build

public void build()
           throws FlowModelBuilderException
Description copied from interface: FlowModelBuilder
Builds any variables initialized by the flow when it starts.

Specified by:
build in interface FlowModelBuilder
Throws:
FlowModelBuilderException - an exception occurred building the flow

getFlowModel

public FlowModel getFlowModel()
                       throws FlowModelBuilderException
Description copied from interface: FlowModelBuilder
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.

Specified by:
getFlowModel in interface FlowModelBuilder
Throws:
FlowModelBuilderException - an exception occurred building this flow

dispose

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

Specified by:
dispose in interface FlowModelBuilder
Throws:
FlowModelBuilderException - an exception occurred disposing this flow

getFlowModelResource

public org.springframework.core.io.Resource getFlowModelResource()
Description copied from interface: FlowModelBuilder
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.

Specified by:
getFlowModelResource in interface FlowModelBuilder
Returns:
the flow model resource

hasFlowModelResourceChanged

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

Specified by:
hasFlowModelResourceChanged in interface FlowModelBuilder
Returns:
true if the resource backing the flow model has changed

getDocument

protected org.w3c.dom.Document getDocument()
Returns the DOM document parsed from the XML file.


getDocumentElement

protected org.w3c.dom.Element getDocumentElement()
Returns the root document element.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Spring Web Flow