org.springframework.webflow.execution.repository.continuation
Class ContinuationFlowExecutionRepository

java.lang.Object
  extended by org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository
      extended by org.springframework.webflow.execution.repository.support.AbstractConversationFlowExecutionRepository
          extended by org.springframework.webflow.execution.repository.continuation.ContinuationFlowExecutionRepository
All Implemented Interfaces:
FlowExecutionRepository

public class ContinuationFlowExecutionRepository
extends AbstractConversationFlowExecutionRepository

Stores one to many flow execution continuations (snapshots) per conversation, where each continuation represents a paused, restorable view-state of a flow execution snapshotted at a point in time.

The set of active user conversations are managed by a ConversationManager implementation, which this repository delegates to.

This repository is responsible for:

This repository implementation also provides support for conversation invalidation after completion, where once a logical conversation completes (by one of its FlowExecution's reaching an end state), the entire conversation (including all continuations) is invalidated. This prevents the possibility of duplicate submission after completion.

This repository implementation should be considered when you do have to support browser navigational button use, e.g. you cannot lock down the browser and require that all navigational events to be routed explicitly through Spring Web Flow.

Author:
Keith Donald

Field Summary
 
Fields inherited from class org.springframework.webflow.execution.repository.support.AbstractConversationFlowExecutionRepository
logger
 
Constructor Summary
ContinuationFlowExecutionRepository(FlowExecutionStateRestorer executionStateRestorer, ConversationManager conversationManager)
          Create a new continuation based flow execution repository using given state restorer and conversation manager.
 
Method Summary
protected  java.io.Serializable generateContinuationId(FlowExecution flowExecution)
          Template method used to generate a new continuation id for given flow execution.
protected  FlowExecutionContinuation getContinuation(FlowExecutionKey key)
          Returns the continuation in the group with the specified key.
 FlowExecutionContinuationFactory getContinuationFactory()
          Returns the continuation factory that encapsulates the construction of continuations stored in this repository.
 UidGenerator getContinuationIdGenerator()
          Returns the uid generation strategy used to generate continuation identifiers.
 FlowExecution getFlowExecution(FlowExecutionKey key)
          Return the FlowExecution indexed by the provided key.
 int getMaxContinuations()
          Returns the maximum number of continuations allowed per conversation in this repository.
protected  java.io.Serializable parseContinuationId(java.lang.String encodedId)
          Template method to parse the continuation id from the encoded string.
 void putFlowExecution(FlowExecutionKey key, FlowExecution flowExecution)
          Place the FlowExecution in this repository under the provided key.
 void setContinuationFactory(FlowExecutionContinuationFactory continuationFactory)
          Sets the continuation factory that encapsulates the construction of continuations stored in this repository.
 void setContinuationIdGenerator(UidGenerator continuationIdGenerator)
          Sets the uid generation strategy used to generate unique continuation identifiers for flow execution keys.
 void setMaxContinuations(int maxContinuations)
          Sets the maximum number of continuations allowed per conversation in this repository.
 
Methods inherited from class org.springframework.webflow.execution.repository.support.AbstractConversationFlowExecutionRepository
createConversationParameters, generateKey, getContinuationId, getConversation, getConversationId, getConversationManager, getConversationScope, getLock, getNextKey, onBegin, onEnd, parseFlowExecutionKey, putConversationScope, removeFlowExecution
 
Methods inherited from class org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository
getExecutionStateRestorer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContinuationFlowExecutionRepository

public ContinuationFlowExecutionRepository(FlowExecutionStateRestorer executionStateRestorer,
                                           ConversationManager conversationManager)
Create a new continuation based flow execution repository using given state restorer and conversation manager.

Parameters:
executionStateRestorer - the state restoration strategy to use
conversationManager - the conversation manager to use
Method Detail

getContinuationFactory

public FlowExecutionContinuationFactory getContinuationFactory()
Returns the continuation factory that encapsulates the construction of continuations stored in this repository. Defaults to SerializedFlowExecutionContinuationFactory.


setContinuationFactory

public void setContinuationFactory(FlowExecutionContinuationFactory continuationFactory)
Sets the continuation factory that encapsulates the construction of continuations stored in this repository.


getContinuationIdGenerator

public UidGenerator getContinuationIdGenerator()
Returns the uid generation strategy used to generate continuation identifiers. Defaults to RandomGuidUidGenerator.


setContinuationIdGenerator

public void setContinuationIdGenerator(UidGenerator continuationIdGenerator)
Sets the uid generation strategy used to generate unique continuation identifiers for flow execution keys.


getMaxContinuations

public int getMaxContinuations()
Returns the maximum number of continuations allowed per conversation in this repository.


setMaxContinuations

public void setMaxContinuations(int maxContinuations)
Sets the maximum number of continuations allowed per conversation in this repository. Use -1 for unlimited. The default is 30.


getFlowExecution

public FlowExecution getFlowExecution(FlowExecutionKey key)
Description copied from interface: FlowExecutionRepository
Return the FlowExecution indexed by the provided key. The returned flow execution represents the restored state of an executing flow from a point in time. This should be called to resume a persistent flow execution.

Before calling this method, you should aquire the lock for the keyed flow execution.

Specified by:
getFlowExecution in interface FlowExecutionRepository
Specified by:
getFlowExecution in class AbstractConversationFlowExecutionRepository
Parameters:
key - the flow execution key
Returns:
the flow execution, fully hydrated and ready to signal an event against

putFlowExecution

public void putFlowExecution(FlowExecutionKey key,
                             FlowExecution flowExecution)
Description copied from interface: FlowExecutionRepository
Place the FlowExecution in this repository under the provided key. This should be called to save or update the persistent state of an active (but paused) flow execution.

Before calling this method, you should aquire the lock for the keyed flow execution.

Specified by:
putFlowExecution in interface FlowExecutionRepository
Specified by:
putFlowExecution in class AbstractConversationFlowExecutionRepository
Parameters:
key - the flow execution key
flowExecution - the flow execution

generateContinuationId

protected java.io.Serializable generateContinuationId(FlowExecution flowExecution)
Description copied from class: AbstractConversationFlowExecutionRepository
Template method used to generate a new continuation id for given flow execution. Subclasses must override.

Specified by:
generateContinuationId in class AbstractConversationFlowExecutionRepository
Parameters:
flowExecution - the flow execution
Returns:
the continuation id

parseContinuationId

protected java.io.Serializable parseContinuationId(java.lang.String encodedId)
Description copied from class: AbstractConversationFlowExecutionRepository
Template method to parse the continuation id from the encoded string.

Specified by:
parseContinuationId in class AbstractConversationFlowExecutionRepository
Parameters:
encodedId - the string identifier
Returns:
the parsed continuation id

getContinuation

protected FlowExecutionContinuation getContinuation(FlowExecutionKey key)
                                             throws FlowExecutionRestorationFailureException
Returns the continuation in the group with the specified key.

Parameters:
key - the flow execution key
Returns:
the continuation.
Throws:
FlowExecutionRestorationFailureException


Copyright © 2009 Spring Framework. All Rights Reserved.