|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository
org.springframework.webflow.execution.repository.support.AbstractConversationFlowExecutionRepository
public abstract class AbstractConversationFlowExecutionRepository
A convenient base class for flow execution repository implementations that delegate to a conversation service for managing conversations that govern the persistent state of paused flow executions.
ConversationManager| Constructor Summary | |
|---|---|
protected |
AbstractConversationFlowExecutionRepository(FlowExecutionStateRestorer executionStateRestorer,
ConversationManager conversationManager)
Constructor for use in subclasses. |
| Method Summary | |
|---|---|
protected ConversationParameters |
createConversationParameters(FlowExecution flowExecution)
Factory method that maps a new flow execution to a descriptive conversation parameters object. |
protected abstract java.io.Serializable |
generateContinuationId(FlowExecution flowExecution)
Template method used to generate a new continuation id for given flow execution. |
FlowExecutionKey |
generateKey(FlowExecution flowExecution)
Generate a unique flow execution key to be used as the persistent identifier of the flow execution. |
protected java.io.Serializable |
getContinuationId(FlowExecutionKey key)
Returns the continuation id part of given composite flow execution key. |
protected Conversation |
getConversation(FlowExecutionKey key)
Returns the conversation governing the execution of the FlowExecution with the provided key. |
protected ConversationId |
getConversationId(FlowExecutionKey key)
Returns the conversation id part of given composite flow execution key. |
protected ConversationManager |
getConversationManager()
Returns the configured conversation manager. |
protected MutableAttributeMap |
getConversationScope(FlowExecutionKey key)
Returns the "conversation scope" for the flow execution with the key provided. |
abstract FlowExecution |
getFlowExecution(FlowExecutionKey key)
Return the FlowExecution indexed by the provided key. |
FlowExecutionLock |
getLock(FlowExecutionKey key)
Return the lock for the flow execution, allowing for the lock to be acquired or released. |
FlowExecutionKey |
getNextKey(FlowExecution flowExecution,
FlowExecutionKey previousKey)
Obtain the "next" flow execution key to be used as the flow execution's persistent identity. |
protected void |
onBegin(Conversation conversation)
An "on begin conversation" callback, allowing for insertion of custom logic after a new conversation has begun. |
protected void |
onEnd(Conversation conversation)
An "on conversation end" callback, allowing for insertion of custom logic after a conversation has ended (it's Conversation.end() method has been
called). |
protected abstract java.io.Serializable |
parseContinuationId(java.lang.String encodedId)
Template method to parse the continuation id from the encoded string. |
FlowExecutionKey |
parseFlowExecutionKey(java.lang.String encodedKey)
Parse the string-encoded flow execution key into its object form. |
protected void |
putConversationScope(FlowExecutionKey key,
MutableAttributeMap scope)
Sets the conversation scope attribute for the flow execution with the key provided. |
abstract void |
putFlowExecution(FlowExecutionKey key,
FlowExecution flowExecution)
Place the FlowExecution in this repository under the
provided key. |
void |
removeFlowExecution(FlowExecutionKey key)
Remove the flow execution from the repository. |
| 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 |
|---|
protected AbstractConversationFlowExecutionRepository(FlowExecutionStateRestorer executionStateRestorer,
ConversationManager conversationManager)
executionStateRestorer - the transient flow execution state restorerconversationManager - the conversation manager to use| Method Detail |
|---|
protected ConversationManager getConversationManager()
public FlowExecutionKey generateKey(FlowExecution flowExecution)
FlowExecutionRepository
flowExecution - the flow execution
public FlowExecutionKey getNextKey(FlowExecution flowExecution,
FlowExecutionKey previousKey)
FlowExecutionRepository
flowExecution - the flow executionpreviousKey - the current key associated with the flow exection
public FlowExecutionLock getLock(FlowExecutionKey key)
throws FlowExecutionRepositoryException
FlowExecutionRepositoryCaution: care should be made not to allow for a deadlock situation. If you acquire a lock make sure you release it when you are done.
The general pattern for safely doing work against a locked conversation follows:
FlowExecutionLock lock = repository.getLock(key);
lock.lock();
try {
FlowExecution execution = repository.getFlowExecution(key);
// do work
}
finally {
lock.unlock();
}
key - the identifier of the flow execution to lock
FlowExecutionRepositoryException - a problem occured accessing the
lock object
public abstract FlowExecution getFlowExecution(FlowExecutionKey key)
throws FlowExecutionRepositoryException
FlowExecutionRepositoryFlowExecution 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.
key - the flow execution key
FlowExecutionRepositoryException - if no flow execution was indexed
with the key provided
public abstract void putFlowExecution(FlowExecutionKey key,
FlowExecution flowExecution)
throws FlowExecutionRepositoryException
FlowExecutionRepositoryFlowExecution 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.
key - the flow execution keyflowExecution - the flow execution
FlowExecutionRepositoryException - the flow execution could not be
stored
public void removeFlowExecution(FlowExecutionKey key)
throws FlowExecutionRepositoryException
FlowExecutionRepository
key - the flow execution key
FlowExecutionRepositoryException - the flow execution could not be
removed.
public FlowExecutionKey parseFlowExecutionKey(java.lang.String encodedKey)
throws FlowExecutionRepositoryException
FlowExecutionRepositoryFlowExecutionKey.toString().
encodedKey - the string encoded key
FlowExecutionRepositoryExceptionprotected ConversationParameters createConversationParameters(FlowExecution flowExecution)
conversation parameters object.
flowExecution - the new flow execution
protected void onBegin(Conversation conversation)
conversation - the conversation that has begunprotected void onEnd(Conversation conversation)
Conversation.end() method has been
called).
This implementation is empty.
conversation - the conversation that has endedprotected ConversationId getConversationId(FlowExecutionKey key)
key - the composite key
protected java.io.Serializable getContinuationId(FlowExecutionKey key)
key - the composite key
protected Conversation getConversation(FlowExecutionKey key)
throws NoSuchFlowExecutionException
FlowExecution with the provided key.
key - the flow execution key
NoSuchFlowExecutionException - when the conversation for identified
flow execution cannot be foundprotected MutableAttributeMap getConversationScope(FlowExecutionKey key)
key - the flow execution key
protected void putConversationScope(FlowExecutionKey key,
MutableAttributeMap scope)
key - the flow execution keyscope - the execution's conversation scopeprotected abstract java.io.Serializable generateContinuationId(FlowExecution flowExecution)
flowExecution - the flow execution
protected abstract java.io.Serializable parseContinuationId(java.lang.String encodedId)
throws FlowExecutionRepositoryException
encodedId - the string identifier
FlowExecutionRepositoryException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||