|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.webflow.engine.builder.BaseFlowBuilder
org.springframework.webflow.engine.builder.xml.XmlFlowBuilder
public class XmlFlowBuilder
Flow builder that builds flows as defined in an XML document. The XML document should adhere to the following format:
<?xml version="1.0" encoding="UTF-8"?> <flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd"> <!-- Define your states here --> </flow>
Consult the web flow XML schema for more information on the XML-based flow definition format.
This builder will setup a flow-local bean factory for the flow being constructed. That flow-local bean factory will be populated with XML bean definitions contained in files referenced using the "import" element. The flow-local bean factory will use the bean factory defing this flow builder as a parent. As such, the flow can access artifacts in either its flow-local bean factory or in the parent bean factory hierarchy, e.g. the bean factory of the dispatcher.
Field Summary | |
---|---|
protected org.springframework.core.io.Resource |
location
The resource from which the document element being parsed was read. |
Constructor Summary | |
---|---|
XmlFlowBuilder(org.springframework.core.io.Resource location)
Create a new XML flow builder parsing the document at the specified location. |
|
XmlFlowBuilder(org.springframework.core.io.Resource location,
FlowServiceLocator flowServiceLocator)
Create a new XML flow builder parsing the document at the specified location, using the provided service locator to access externally managed flow 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. |
void |
buildStates()
Builds the states of the flow. |
void |
buildVariables()
Builds any variables initialized by the flow when it starts. |
protected org.springframework.beans.factory.BeanFactory |
createLocalBeanFactory(Flow flow,
org.springframework.core.io.Resource[] resources)
Create a bean factory serving as a local flow service registry. |
void |
dispose()
Shutdown the builder, releasing any resources it holds. |
protected org.w3c.dom.Element |
getChildElementByTagName(org.w3c.dom.Element ele,
java.lang.String childEleName)
Utility method that returns the first child element identified by its name. |
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. |
protected FlowArtifactFactory |
getFlowArtifactFactory()
Returns the artifact factory of the flow service locator local to this builder. |
protected FlowServiceLocator |
getLocalFlowServiceLocator()
Returns the flow service locator local to this builder. |
org.springframework.core.io.Resource |
getLocation()
Returns the resource from which the document element was loaded. |
org.springframework.core.io.Resource |
getResource()
Returns the flow definition resource held by this holder. |
void |
init(java.lang.String id,
AttributeMap attributes)
Initialize this builder. |
protected boolean |
nodeNameEquals(org.w3c.dom.Node node,
java.lang.String desiredName)
Namespace-aware equals comparison. |
protected void |
registerLocalBeans(Flow flow,
org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory)
Register beans in the bean factory local to the flow definition being built. |
void |
setDocumentLoader(DocumentLoader documentLoader)
Sets the loader that will load the XML-based flow definition document. |
void |
setLocation(org.springframework.core.io.Resource location)
Sets the resource from which the document element was loaded. |
java.lang.String |
toString()
|
Methods inherited from class org.springframework.webflow.engine.builder.BaseFlowBuilder |
---|
fromStringTo, fromStringTo, getFlow, getFlowServiceLocator, setFlow, setFlowServiceLocator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected org.springframework.core.io.Resource location
Constructor Detail |
---|
public XmlFlowBuilder(org.springframework.core.io.Resource location)
location
- the location of the XML-based flow definition resourcepublic XmlFlowBuilder(org.springframework.core.io.Resource location, FlowServiceLocator flowServiceLocator)
location
- the location of the XML-based flow definition resourceflowServiceLocator
- the locator for services needed by this builder to build its FlowMethod Detail |
---|
public org.springframework.core.io.Resource getLocation()
public void setLocation(org.springframework.core.io.Resource location)
public void setDocumentLoader(DocumentLoader documentLoader)
DefaultDocumentLoader
.
documentLoader
- the document loaderpublic java.lang.String toString()
toString
in class java.lang.Object
public void init(java.lang.String id, AttributeMap attributes) throws FlowBuilderException
FlowBuilder
init
in interface FlowBuilder
init
in class BaseFlowBuilder
id
- the identifier to assign to the flowattributes
- custom attributes to assign to the flow
FlowBuilderException
- an exception occured building the flowpublic void buildVariables() throws FlowBuilderException
FlowBuilder
buildVariables
in interface FlowBuilder
buildVariables
in class BaseFlowBuilder
FlowBuilderException
- an exception occured building the flowpublic void buildInputMapper() throws FlowBuilderException
FlowBuilder
buildInputMapper
in interface FlowBuilder
buildInputMapper
in class BaseFlowBuilder
FlowBuilderException
- an exception occured building the flowpublic void buildStartActions() throws FlowBuilderException
FlowBuilder
buildStartActions
in interface FlowBuilder
buildStartActions
in class BaseFlowBuilder
FlowBuilderException
- an exception occured building the flowpublic void buildInlineFlows() throws FlowBuilderException
FlowBuilder
buildInlineFlows
in interface FlowBuilder
buildInlineFlows
in class BaseFlowBuilder
FlowBuilderException
- an exception occured building the flowpublic void buildStates() throws FlowBuilderException
FlowBuilder
buildStates
in interface FlowBuilder
buildStates
in class BaseFlowBuilder
FlowBuilderException
- an exception occured building the flowpublic void buildGlobalTransitions() throws FlowBuilderException
FlowBuilder
buildGlobalTransitions
in interface FlowBuilder
buildGlobalTransitions
in class BaseFlowBuilder
FlowBuilderException
- an exception occured building the flowpublic void buildEndActions() throws FlowBuilderException
FlowBuilder
buildEndActions
in interface FlowBuilder
buildEndActions
in class BaseFlowBuilder
FlowBuilderException
- an exception occured building the flowpublic void buildOutputMapper() throws FlowBuilderException
FlowBuilder
buildOutputMapper
in interface FlowBuilder
buildOutputMapper
in class BaseFlowBuilder
FlowBuilderException
- an exception occured building the flowpublic void buildExceptionHandlers() throws FlowBuilderException
FlowBuilder
buildExceptionHandlers
in interface FlowBuilder
buildExceptionHandlers
in class BaseFlowBuilder
FlowBuilderException
- an exception occured building this flowpublic void dispose()
FlowBuilder
FlowBuilder.init(String, AttributeMap)
method.
dispose
in interface FlowBuilder
dispose
in class BaseFlowBuilder
public org.springframework.core.io.Resource getResource()
ResourceHolder
getResource
in interface ResourceHolder
protected org.w3c.dom.Document getDocument()
protected org.w3c.dom.Element getDocumentElement()
protected FlowServiceLocator getLocalFlowServiceLocator()
protected FlowArtifactFactory getFlowArtifactFactory()
protected org.w3c.dom.Element getChildElementByTagName(org.w3c.dom.Element ele, java.lang.String childEleName)
ele
- the DOM element to analyzechildEleName
- the child element name to look for
org.w3c.dom.Element
instance, or null
if none foundprotected boolean nodeNameEquals(org.w3c.dom.Node node, java.lang.String desiredName)
true
if either Node.getLocalName()
or
Node.getNodeName()
equals desiredName
, otherwise returns false
.
protected org.springframework.beans.factory.BeanFactory createLocalBeanFactory(Flow flow, org.springframework.core.io.Resource[] resources)
flow
- the current flow definition being builtresources
- the file resources to assemble the bean factory from; typically XML-based
protected void registerLocalBeans(Flow flow, org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory)
Subclasses may override this metod to customize the population of the bean factory local to the flow definition being built; for example, to register mock implementations of services in a test environment.
flow
- the current flow definition being builtbeanFactory
- the bean factory; register local beans with it using
SingletonBeanRegistry.registerSingleton(String, Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |