Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.webflow.execution.repository.support
Class AbstractFlowExecutionRepository

    java.lang.Object
      org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository

All Implemented Interfaces:
  FlowExecutionKeyFactory, FlowExecutionRepository

Direct Known Subclasses:
  AbstractSnapshottingFlowExecutionRepository

    public abstract class AbstractFlowExecutionRepository

extends java.lang.Object
implements FlowExecutionRepository, FlowExecutionKeyFactory

Abstract base class for flow execution repository implementations. Does not make any assumptions about the storage medium used to store active flow executions. Mandates the use of a `FlowExecutionStateRestorer`, used to rehydrate a flow execution after it has been obtained from storage from resume.

The configured `FlowExecutionStateRestorer` should be compatible with the chosen `FlowExecution` implementation and its `FlowExecutionFactory`.

Author:
  Keith Donald, Erwin Vervaet

Field Summary
`protected org.apache.commons.logging.Log` | `logger` Logger, usable in subclasses

Constructor Summary
`protected` | `AbstractFlowExecutionRepository(ConversationManager conversationManager)` Constructor for use in subclasses.

Method Summary
`protected void` | `assertKeySet(FlowExecution execution)` Assert that a flow execution key has been assigned to the execution.
`protected ConversationParameters` | `createConversationParameters(FlowExecution flowExecution)` Factory method that maps a new flow execution to a descriptive `conversation parameters` object.
`boolean` | `getAlwaysGenerateNewNextKey()` The flag indicating if a new `FlowExecutionKey` should always be generated before each put call.
`protected Conversation` | `getConversation(FlowExecutionKey key)` Returns the conversation governing the `FlowExecution` with the provided key.
`protected Conversation` | `getConversation(java.io.Serializable executionId)` Returns the conversation governing the logical flow execution with the given execution id.
`ConversationManager` | `getConversationManager()` The conversation service to delegate to for managing conversations initiated by this repository.
`abstract FlowExecution` | `getFlowExecution(FlowExecutionKey key)` Return the `FlowExecution` indexed by the provided key.
`FlowExecutionKey` | `getKey(FlowExecution execution)` Get the key to assign to the flow execution.
`FlowExecutionLock` | `getLock(FlowExecutionKey key)` Return the lock for the flow execution, allowing for the lock to be acquired or released.
`protected abstract java.io.Serializable` | `nextSnapshotId(java.io.Serializable executionId)` The next snapshot id to use for a `FlowExecution` instance.
`FlowExecutionKey` | `parseFlowExecutionKey(java.lang.String encodedKey)` Parse the string-encoded flow execution key into its object form.
`abstract 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.
`void` | `setAlwaysGenerateNewNextKey(boolean alwaysGenerateNewNextKey)` Sets the flag indicating if a new `FlowExecutionKey` should always be generated before each put call.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.springframework.webflow.execution.FlowExecutionKeyFactory
`removeAllFlowExecutionSnapshots, removeFlowExecutionSnapshot, updateFlowExecutionSnapshot`

Field Detail

### logger

    protected final org.apache.commons.logging.Log logger

  Logger, usable in subclasses

Constructor Detail

### AbstractFlowExecutionRepository

    protected AbstractFlowExecutionRepository(ConversationManager conversationManager)

  Constructor for use in subclasses.

  Parameters:
    `conversationManager` - the conversation manager to use

Method Detail

### getConversationManager

    public ConversationManager getConversationManager()

  The conversation service to delegate to for managing conversations initiated by this repository.

### getAlwaysGenerateNewNextKey

    public boolean getAlwaysGenerateNewNextKey()

  The flag indicating if a new `FlowExecutionKey` should always be generated before each put call.

### setAlwaysGenerateNewNextKey

    public void setAlwaysGenerateNewNextKey(boolean alwaysGenerateNewNextKey)

  Sets the flag indicating if a new `FlowExecutionKey` should always be generated before each put call. By setting this to false a FlowExecution can remain identified by the same key throughout its life.

### getKey

    public FlowExecutionKey getKey(FlowExecution execution)

  Description copied from interface: `FlowExecutionKeyFactory`
  Get the key to assign to the flow execution. This factory simply generates the key to assign, it does not actually perform the key assignment.

  Specified by:
    `getKey` in interface `FlowExecutionKeyFactory`
  Parameters:
    `execution` - the flow execution
  Returns:
    the key to assign to the flow execution

### parseFlowExecutionKey

    public FlowExecutionKey parseFlowExecutionKey(java.lang.String encodedKey)
                                           throws FlowExecutionRepositoryException

  Description copied from interface: `FlowExecutionRepository`
  Parse the string-encoded flow execution key into its object form. Essentially, the reverse of `FlowExecutionKey.toString()`.

  Specified by:
    `parseFlowExecutionKey` in interface `FlowExecutionRepository`
  Parameters:
    `encodedKey` - the string encoded key
  Returns:
    the parsed flow execution key, the persistent identifier for exactly one flow execution
  Throws:
    `FlowExecutionRepositoryException`

### getLock

    public FlowExecutionLock getLock(FlowExecutionKey key)
                              throws FlowExecutionRepositoryException

  Description copied from interface: `FlowExecutionRepository`
  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();
       }

  Specified by:
    `getLock` in interface `FlowExecutionRepository`
  Parameters:
    `key` - the identifier of the flow execution to lock
  Returns:
    the lock
  Throws:
    `FlowExecutionRepositoryException` - a problem occurred accessing the lock object

### removeFlowExecution

    public void removeFlowExecution(FlowExecution flowExecution)
                             throws FlowExecutionRepositoryException

  Description copied from interface: `FlowExecutionRepository`
  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.

  Specified by:
    `removeFlowExecution` in interface `FlowExecutionRepository`
  Parameters:
    `flowExecution` - the flow execution
  Throws:
    `FlowExecutionRepositoryException` - the flow execution could not be removed.

### nextSnapshotId

    protected abstract java.io.Serializable nextSnapshotId(java.io.Serializable executionId)

  The next snapshot id to use for a `FlowExecution` instance. Called when `getting a flow execution key`.

  Returns:
    the id of the flow execution

### getFlowExecution

    public abstract FlowExecution getFlowExecution(FlowExecutionKey key)
                                            throws FlowExecutionRepositoryException

  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 acquire the lock for the keyed flow execution.

  Specified by:
    `getFlowExecution` in interface `FlowExecutionRepository`
  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

    public abstract void putFlowExecution(FlowExecution flowExecution)
                                   throws FlowExecutionRepositoryException

  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 acquire the lock for the keyed flow execution.

  Specified by:
    `putFlowExecution` in interface `FlowExecutionRepository`
  Parameters:
    `flowExecution` - the flow execution
  Throws:
    `FlowExecutionRepositoryException` - the flow execution could not be stored

### createConversationParameters

    protected ConversationParameters createConversationParameters(FlowExecution flowExecution)

  Factory method that maps a new flow execution to a descriptive `conversation parameters` object.

  Parameters:
    `flowExecution` - the new flow execution
  Returns:
    the conversation parameters object to pass to the conversation manager when the conversation is started

### getConversation

    protected Conversation getConversation(FlowExecutionKey key)
                                    throws NoSuchFlowExecutionException

  Returns the conversation governing the `FlowExecution` with the provided key.

  Parameters:
    `key` - the flow execution key
  Returns:
    the governing conversation
  Throws:
    `NoSuchFlowExecutionException` - when the conversation for identified flow execution cannot be found

### getConversation

    protected Conversation getConversation(java.io.Serializable executionId)
                                    throws NoSuchConversationException

  Returns the conversation governing the logical flow execution with the given execution id.

  Parameters:
    `executionId` - the flow execution id
  Returns:
    the governing conversation
  Throws:
    `NoSuchConversationException` - when the conversation for identified flow execution cannot be found

### assertKeySet

    protected void assertKeySet(FlowExecution execution)
                         throws java.lang.IllegalStateException

  Assert that a flow execution key has been assigned to the execution.

  Parameters:
    `execution` - the flow execution
  Throws:
    `java.lang.IllegalStateException` - if a key has not yet been assigned as expected

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD