org.springframework.webflow.config
Class FlowExecutorFactoryBean

java.lang.Object
  extended by org.springframework.webflow.config.FlowExecutorFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean

public class FlowExecutorFactoryBean
extends java.lang.Object
implements org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean

The default flow executor factory implementation. As a FactoryBean, this class has been designed for use as a Spring managed bean.

This factory encapsulates the construction and assembly of a FlowExecutor, including the provision of its FlowExecutionRepository strategy.

The definition locator property is required, all other properties are optional.

This class has been designed with subclassing in mind. If you want to do advanced Spring Web Flow customization, e.g. using a custom FlowExecutor implementation, consider subclassing this class and overriding one or more of the provided hook methods.

Author:
Keith Donald, Erwin Vervaet

Constructor Summary
FlowExecutorFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  ConversationManager createDefaultConversationManager()
          Create the conversation manager to be used in the default case, e.g.
protected  FlowExecutionRepository createExecutionRepository(RepositoryType repositoryType, FlowExecutionStateRestorer executionStateRestorer, ConversationManager conversationManager)
          Factory method for creating the flow execution repository for saving and loading executing flows.
protected  FlowExecutionFactory createFlowExecutionFactory(AttributeMap executionAttributes, FlowExecutionListenerLoader executionListenerLoader)
          Create the flow execution factory to be used by the executor produced by this factory bean.
protected  FlowExecutionStateRestorer createFlowExecutionStateRestorer(FlowDefinitionLocator definitionLocator, AttributeMap executionAttributes, FlowExecutionListenerLoader executionListenerLoader)
          Create the flow execution state restorer to be used by the executor produced by this factory bean.
protected  FlowExecutor createFlowExecutor(FlowDefinitionLocator definitionLocator, FlowExecutionFactory executionFactory, FlowExecutionRepository executionRepository)
          Create the flow executor instance created by this factory bean and configure it appropriately.
 FlowExecutor getFlowExecutor()
          Returns the flow executor constructed by the factory bean.
protected  org.springframework.binding.mapping.AttributeMapper getInputMapper()
          Return the configured input mapper.
protected  java.lang.Integer getMaxContinuations()
          Returns the configured maximum number of continuation snapshots allowed for a single conversation when using the continuation flow execution repository.
protected  java.lang.Integer getMaxConversations()
          Returns the configured maximum number of allowed concurrent conversations in the session.
 java.lang.Object getObject()
           
 java.lang.Class getObjectType()
           
 boolean isSingleton()
           
 void setConversationManager(ConversationManager conversationManager)
          Sets the strategy for managing conversations that should be configured for flow executors created by this factory.
 void setDefaults(FlowSystemDefaults defaults)
          Set system defaults that should be used.
 void setDefinitionLocator(FlowDefinitionLocator definitionLocator)
          Sets the flow definition locator that will locate flow definitions needed for execution.
 void setExecutionAttributes(java.util.Map executionAttributes)
          Sets the system attributes that apply to flow executions launched by the executor created by this factory.
 void setExecutionListener(FlowExecutionListener executionListener)
          Convenience setter that sets a single listener that always applies to flow executions launched by the executor created by this factory.
 void setExecutionListenerLoader(FlowExecutionListenerLoader executionListenerLoader)
          Sets the strategy for loading the listeners that will observe executions of a flow definition.
 void setExecutionListeners(FlowExecutionListener[] executionListeners)
          Convenience setter that sets a list of listeners that always apply to flow executions launched by the executor created by this factory.
 void setInputMapper(org.springframework.binding.mapping.AttributeMapper inputMapper)
          Set the service responsible for mapping attributes of an ExternalContext to a new FlowExecution during the launch flow operation.
 void setMaxContinuations(int maxContinuations)
          Set the maximum number of continuation snapshots allowed for a single conversation when using the continuation flow execution repository.
 void setMaxConversations(int maxConversations)
          Set the maximum number of allowed concurrent conversations in the session.
 void setRepositoryType(RepositoryType repositoryType)
          Sets the type of flow execution repository that should be configured for the flow executors created by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowExecutorFactoryBean

public FlowExecutorFactoryBean()
Method Detail

setDefinitionLocator

public void setDefinitionLocator(FlowDefinitionLocator definitionLocator)
Sets the flow definition locator that will locate flow definitions needed for execution. Typically also a FlowDefinitionRegistry. Required.

Parameters:
definitionLocator - the flow definition locator (registry)

setExecutionAttributes

public void setExecutionAttributes(java.util.Map executionAttributes)
Sets the system attributes that apply to flow executions launched by the executor created by this factory. Execution attributes may affect flow execution behavior.

Note: this method simply accepts a generic java.util.Map to allow for easy configuration by Spring. The map entries should consist of non-null String keys with object values.

Parameters:
executionAttributes - the flow execution system attributes

setExecutionListener

public void setExecutionListener(FlowExecutionListener executionListener)
Convenience setter that sets a single listener that always applies to flow executions launched by the executor created by this factory.

Parameters:
executionListener - the flow execution listener

setExecutionListeners

public void setExecutionListeners(FlowExecutionListener[] executionListeners)
Convenience setter that sets a list of listeners that always apply to flow executions launched by the executor created by this factory.

Parameters:
executionListeners - the flow execution listeners

setExecutionListenerLoader

public void setExecutionListenerLoader(FlowExecutionListenerLoader executionListenerLoader)
Sets the strategy for loading the listeners that will observe executions of a flow definition. Allows full control over what listeners should apply to executions of a flow definition launched by the executor created by this factory.


setRepositoryType

public void setRepositoryType(RepositoryType repositoryType)
Sets the type of flow execution repository that should be configured for the flow executors created by this factory. This factory encapsulates the construction of the repository implementation corresponding to the provided type.

Parameters:
repositoryType - the flow execution repository type

setMaxContinuations

public void setMaxContinuations(int maxContinuations)
Set the maximum number of continuation snapshots allowed for a single conversation when using the continuation flow execution repository.

Since:
1.0.1
See Also:
ContinuationFlowExecutionRepository.setMaxContinuations(int)

getMaxContinuations

protected java.lang.Integer getMaxContinuations()
Returns the configured maximum number of continuation snapshots allowed for a single conversation when using the continuation flow execution repository.

Returns:
the configured value or null if the user did not explicitly specify a value and wants to use the default
Since:
1.0.1

setConversationManager

public void setConversationManager(ConversationManager conversationManager)
Sets the strategy for managing conversations that should be configured for flow executors created by this factory.

The conversation manager is used by the flow execution repository subsystem to begin and end new conversations that store execution state.

By default, a SessionBindingConversationManager is used. Do not use setMaxConversations(int) when using this method.


setMaxConversations

public void setMaxConversations(int maxConversations)
Set the maximum number of allowed concurrent conversations in the session. This is a convenience setter to allow easy configuration of the maxConversations property of the default SessionBindingConversationManager. Do not use this when using setConversationManager(ConversationManager).

Since:
1.0.1
See Also:
SessionBindingConversationManager.setMaxConversations(int)

getMaxConversations

protected java.lang.Integer getMaxConversations()
Returns the configured maximum number of allowed concurrent conversations in the session. Will only be used when using the default conversation manager, e.g. when no explicit conversation manager has been configured using setConversationManager(ConversationManager).

Returns:
the configured value or null if the user did not explicitly specify a value and wants to use the default
Since:
1.0.1

setInputMapper

public void setInputMapper(org.springframework.binding.mapping.AttributeMapper inputMapper)
Set the service responsible for mapping attributes of an ExternalContext to a new FlowExecution during the launch flow operation.

This is optional. If not set, a default implementation will be used that simply exposes all request parameters as flow execution input attributes.

Since:
1.0.4

getInputMapper

protected org.springframework.binding.mapping.AttributeMapper getInputMapper()
Return the configured input mapper.

Since:
1.0.4

setDefaults

public void setDefaults(FlowSystemDefaults defaults)
Set system defaults that should be used.

Parameters:
defaults - the defaults to use.

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

createDefaultConversationManager

protected ConversationManager createDefaultConversationManager()
Create the conversation manager to be used in the default case, e.g. when no explicit conversation manager has been configured using setConversationManager(ConversationManager). This implementation return a SessionBindingConversationManager.

Returns:
the default conversation manager

createFlowExecutionFactory

protected FlowExecutionFactory createFlowExecutionFactory(AttributeMap executionAttributes,
                                                          FlowExecutionListenerLoader executionListenerLoader)
Create the flow execution factory to be used by the executor produced by this factory bean. Configure the execution factory appropriately. Subclasses may override if they which to use a custom execution factory, e.g. to use a custom FlowExecution implementation.

Parameters:
executionAttributes - execution attributes to apply to created executions
executionListenerLoader - decides which listeners to apply to created executions
Returns:
a new flow execution factory instance

createFlowExecutionStateRestorer

protected FlowExecutionStateRestorer createFlowExecutionStateRestorer(FlowDefinitionLocator definitionLocator,
                                                                      AttributeMap executionAttributes,
                                                                      FlowExecutionListenerLoader executionListenerLoader)
Create the flow execution state restorer to be used by the executor produced by this factory bean. Configure the state restorer appropriately. Subclasses may override if they which to use a custom state restorer implementation.

Parameters:
definitionLocator - the definition locator to use
executionAttributes - execution attributes to apply to restored executions
executionListenerLoader - decides which listeners should apply to restored flow executions
Returns:
a new state restorer instance

createExecutionRepository

protected FlowExecutionRepository createExecutionRepository(RepositoryType repositoryType,
                                                            FlowExecutionStateRestorer executionStateRestorer,
                                                            ConversationManager conversationManager)
Factory method for creating the flow execution repository for saving and loading executing flows. Subclasses may override to customize the repository implementation used.

Parameters:
repositoryType - a hint indicating what type of repository to create
executionStateRestorer - the execution state restorer strategy to be used by the repository
conversationManager - the conversation manager specified by the user, could be null in which case the default conversation manager should be used
Returns:
a new flow execution repository instance

createFlowExecutor

protected FlowExecutor createFlowExecutor(FlowDefinitionLocator definitionLocator,
                                          FlowExecutionFactory executionFactory,
                                          FlowExecutionRepository executionRepository)
Create the flow executor instance created by this factory bean and configure it appropriately. Subclasses may override if they which to use a custom executor implementation.

Parameters:
definitionLocator - the definition locator to use
executionFactory - the execution factory to use
executionRepository - the execution repository to use
Returns:
a new flow executor instance

getObjectType

public java.lang.Class getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean

getObject

public java.lang.Object getObject()
                           throws java.lang.Exception
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean
Throws:
java.lang.Exception

getFlowExecutor

public FlowExecutor getFlowExecutor()
Returns the flow executor constructed by the factory bean.

Since:
1.0.2


Copyright © 2004-2007. All Rights Reserved.