Spring Web Flow

org.springframework.webflow.execution.repository
Interface FlowExecutionRepository

All Known Implementing Classes:
AbstractFlowExecutionRepository, AbstractSnapshottingFlowExecutionRepository, DefaultFlowExecutionRepository

public interface FlowExecutionRepository

Central subsystem interface responsible for the saving and restoring of flow executions, where each flow execution represents a state of an active flow definition.

Flow execution repositories are responsible for managing the storage, restoration and removal of flow executions launched by clients of the Spring Web Flow system.

When placed in a repository a FlowExecution object representing the state of a flow at a point in time is indexed under a unique FlowExecutionKey.

Author:
Erwin Vervaet, Keith Donald
See Also:
FlowExecution, FlowExecutionKey

Method Summary
 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 parseFlowExecutionKey(java.lang.String encodedKey)
          Parse the string-encoded flow execution key into its object form.
 void putFlowExecution(FlowExecution flowExecution)
          Place the FlowExecution in this repository under the provided key.
 void removeFlowExecution(FlowExecution flowExecution)
          Remove the flow execution from the repository.
 

Method Detail

parseFlowExecutionKey

FlowExecutionKey parseFlowExecutionKey(java.lang.String encodedKey)
                                       throws FlowExecutionRepositoryException
Parse the string-encoded flow execution key into its object form. Essentially, the reverse of FlowExecutionKey.toString().

Parameters:
encodedKey - the string encoded key
Returns:
the parsed flow execution key, the persistent identifier for exactly one flow execution
Throws:
FlowExecutionRepositoryException

getLock

FlowExecutionLock getLock(FlowExecutionKey key)
                          throws FlowExecutionRepositoryException
Return the lock for the flow execution, allowing for the lock to be acquired or released. Caution: 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();
 }
 

Parameters:
key - the identifier of the flow execution to lock
Returns:
the lock
Throws:
FlowExecutionRepositoryException - a problem occurred accessing the lock object

getFlowExecution

FlowExecution getFlowExecution(FlowExecutionKey key)
                               throws FlowExecutionRepositoryException
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 acquire the lock for the keyed flow execution.

Parameters:
key - the flow execution key
Returns:
the flow execution, fully hydrated and ready to resume
Throws:
FlowExecutionRepositoryException - if no flow execution was indexed with the key provided

putFlowExecution

void putFlowExecution(FlowExecution flowExecution)
                      throws FlowExecutionRepositoryException
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 acquire the lock for the keyed flow execution.

Parameters:
flowExecution - the flow execution
Throws:
FlowExecutionRepositoryException - the flow execution could not be stored

removeFlowExecution

void removeFlowExecution(FlowExecution flowExecution)
                         throws FlowExecutionRepositoryException
Remove the flow execution from the repository. This should be called when the flow execution ends (is no longer active). Before calling this method, you should acquire the lock for the keyed flow execution.

Parameters:
flowExecution - the flow execution
Throws:
FlowExecutionRepositoryException - the flow execution could not be removed.

Spring Web Flow