org.springframework.webflow.executor
Class FlowExecutorImpl

java.lang.Object
  extended by org.springframework.webflow.executor.FlowExecutorImpl
All Implemented Interfaces:
FlowExecutor

public class FlowExecutorImpl
extends java.lang.Object
implements FlowExecutor

The default implementation of the central facade for driving the execution of flows within an application.

This object is responsible for creating and starting new flow executions as requested by clients, as well as signaling events for processing by existing, paused executions (that are waiting to be resumed in response to a user event).

This object is a facade or entry point into the Spring Web Flow execution system and makes the overall system easier to use. The name executor was chosen as executors drive executions.

Commonly used configurable properties

name description default
definitionLocator The service locator responsible for loading flow definitions to execute. None
executionFactory The factory responsible for creating new flow executions. None
executionRepository The repository responsible for managing flow execution persistence. None
inputMapper The service responsible for mapping attributes of external contexts that request to launch new flow executions. After mapping, the target map is then passed to the FlowExecution, exposing external context attributes as input to the flow during startup. A request parameter mapper, which exposes all request parameters in to the flow execution for input mapping.

Author:
Erwin Vervaet, Keith Donald, Colin Sampaleanu
See Also:
FlowDefinitionLocator, FlowExecutionFactory, FlowExecutionRepository, AttributeMapper

Constructor Summary
FlowExecutorImpl(FlowDefinitionLocator definitionLocator, FlowExecutionFactory executionFactory, FlowExecutionRepository executionRepository)
          Create a new flow executor.
 
Method Summary
protected  MutableAttributeMap createInput(ExternalContext context)
          Factory method that creates the input attribute map for a newly created FlowExecution.
 FlowDefinitionLocator getDefinitionLocator()
          Exposes the configured flow definition locator to subclasses and privileged accessors.
 FlowExecutionFactory getExecutionFactory()
          Exposes the configured execution factory to subclasses and privileged accessors.
 FlowExecutionRepository getExecutionRepository()
          Exposes the execution repository to subclasses and privileged accessors.
 org.springframework.binding.mapping.AttributeMapper getInputMapper()
          Exposes the configured input mapper to subclasses and privileged accessors.
 ResponseInstruction launch(java.lang.String flowDefinitionId, ExternalContext context)
          Launch a new execution of identified flow definition in the context of the current external client request.
 ResponseInstruction refresh(java.lang.String flowExecutionKey, ExternalContext context)
          Reissue the last response instruction issued by the flow execution.
 ResponseInstruction resume(java.lang.String flowExecutionKey, java.lang.String eventId, ExternalContext context)
          Resume an existing, paused flow execution by signaling an event against its current state.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowExecutorImpl

public FlowExecutorImpl(FlowDefinitionLocator definitionLocator,
                        FlowExecutionFactory executionFactory,
                        FlowExecutionRepository executionRepository)
Create a new flow executor.

Parameters:
definitionLocator - the locator for accessing flow definitions to execute
executionFactory - the factory for creating executions of flow definitions
executionRepository - the repository for persisting paused flow executions
Method Detail

getInputMapper

public org.springframework.binding.mapping.AttributeMapper getInputMapper()
Exposes the configured input mapper to subclasses and privileged accessors.

Returns:
the input mapper

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.

The default implementation simply exposes all request parameters as flow execution input attributes. May be null.

See Also:
RequestParameterInputMapper

getDefinitionLocator

public FlowDefinitionLocator getDefinitionLocator()
Exposes the configured flow definition locator to subclasses and privileged accessors.

Returns:
the flow definition locator

getExecutionFactory

public FlowExecutionFactory getExecutionFactory()
Exposes the configured execution factory to subclasses and privileged accessors.

Returns:
the execution factory

getExecutionRepository

public FlowExecutionRepository getExecutionRepository()
Exposes the execution repository to subclasses and privileged accessors.

Returns:
the execution repository

launch

public ResponseInstruction launch(java.lang.String flowDefinitionId,
                                  ExternalContext context)
                           throws FlowException
Description copied from interface: FlowExecutor
Launch a new execution of identified flow definition in the context of the current external client request.

Specified by:
launch in interface FlowExecutor
Parameters:
flowDefinitionId - the unique id of the flow definition to launch
context - the external context representing the state of a request into Spring Web Flow from an external system
Returns:
the starting response instruction
Throws:
FlowException - if an exception occured launching the new flow execution

resume

public ResponseInstruction resume(java.lang.String flowExecutionKey,
                                  java.lang.String eventId,
                                  ExternalContext context)
                           throws FlowException
Description copied from interface: FlowExecutor
Resume an existing, paused flow execution by signaling an event against its current state.

Specified by:
resume in interface FlowExecutor
Parameters:
flowExecutionKey - the identifying key of a paused flow execution that is waiting to resume on the occurrence of a user event
eventId - the user event that occured
context - the external context representing the state of a request into Spring Web Flow from an external system
Returns:
the next response instruction
Throws:
FlowException - if an exception occured resuming the existing flow execution

refresh

public ResponseInstruction refresh(java.lang.String flowExecutionKey,
                                   ExternalContext context)
                            throws FlowException
Description copied from interface: FlowExecutor
Reissue the last response instruction issued by the flow execution. This is a logical refresh operation that allows the "current response" to be re-issued. This operation is idempotent and does not affect the state of the flow execution.

Specified by:
refresh in interface FlowExecutor
Parameters:
flowExecutionKey - the identifying key of a paused flow execution that is waiting to resume on the ocurrence of a user event
context - the external context representing the state of a request into Spring Web Flow from an external system
Returns:
the current response instruction
Throws:
FlowException - if an exception occured retrieving the current response instruction

createInput

protected MutableAttributeMap createInput(ExternalContext context)
Factory method that creates the input attribute map for a newly created FlowExecution. This implementation uses the registered input mapper, if any.

Parameters:
context - the external context
Returns:
the input map, or null if no input


Copyright © 2004-2007. All Rights Reserved.