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.impl
Class DefaultFlowExecutionRepository

    java.lang.Object
      org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository
          org.springframework.webflow.execution.repository.snapshot.AbstractSnapshottingFlowExecutionRepository
              org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository

All Implemented Interfaces:
  FlowExecutionKeyFactory, FlowExecutionRepository

    public class DefaultFlowExecutionRepository

extends AbstractSnapshottingFlowExecutionRepository

The default flow execution repository implementation. Takes one to `max` flow execution snapshots, where each snapshot represents a copy of a `FlowExecution` taken at a point in time. Snapshots are created via a `FlowExecutionSnapshotFactory` and that may or may not involve creating a copy of a flow execution through Java serialization. In particular when the flow-execution-repository element is configured with max-execution-snapshots="0", creating snapshot copies is effectively turned off.

The set of active flow executions are managed by a `ConversationManager` implementation, which this repository delegates to.

This repository is responsible for:

- Beginning a new `Conversation` when a `FlowExecution` is assigned a persistent key. Each conversation is assigned a unique conversation id which forms one part of the flow execution key.
- Taking `execution snapshots` to persist flow execution state. A snapshot is a copy of the execution created at a point in time that can be restored and continued. Snapshotting supports users going back in their browser to continue their flow execution from a previoius point.
- Ending conversations when flow executions end.

This repository implementation also provides support for execution invalidation after completion, where once a logical flow execution completes, it and all of its snapshots are removed. This cleans up memory and prevents the possibility of duplicate submission after completion.

Author:
  Keith Donald

Field Summary

Fields inherited from class org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository
`logger`

Constructor Summary
`DefaultFlowExecutionRepository(ConversationManager conversationManager, FlowExecutionSnapshotFactory snapshotFactory)` Create a new default flow execution repository using the given state restorer, conversation manager, and snapshot factory.

Method Summary
`protected FlowExecutionSnapshotGroup` | `createFlowExecutionSnapshotGroup()`
`FlowExecution` | `getFlowExecution(FlowExecutionKey key)` Return the `FlowExecution` indexed by the provided key.
`int` | `getMaxSnapshots()` Returns the max number of snapshots allowed per flow execution by this repository.
`protected FlowExecutionSnapshotGroup` | `getSnapshotGroup(Conversation conversation)` Returns the snapshot group associated with the governing conversation.
`protected java.io.Serializable` | `nextSnapshotId(java.io.Serializable executionId)` The next snapshot id to use for a `FlowExecution` instance.
`void` | `putFlowExecution(FlowExecution flowExecution)` Place the `FlowExecution` in this repository under the provided key.
`void` | `removeAllFlowExecutionSnapshots(FlowExecution execution)` Remove all snapshots associated with the flow execution from storage, invalidating all history.
`void` | `removeFlowExecutionSnapshot(FlowExecution execution)` Remove the snapshot that was used to restore this flow execution, discarding it for future use.
`void` | `setMaxSnapshots(int maxSnapshots)` Sets the maximum number of snapshots allowed per flow execution by this repository.
`void` | `updateFlowExecutionSnapshot(FlowExecution execution)` Capture the current state of the flow execution by updating its snapshot in storage.

Methods inherited from class org.springframework.webflow.execution.repository.snapshot.AbstractSnapshottingFlowExecutionRepository
`getSnapshotFactory, getSnapshotId, putConversationScope, restoreFlowExecution, snapshot`

Methods inherited from class org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository
`assertKeySet, createConversationParameters, getAlwaysGenerateNewNextKey, getConversation, getConversation, getConversationManager, getKey, getLock, parseFlowExecutionKey, removeFlowExecution, setAlwaysGenerateNewNextKey`

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

Constructor Detail

### DefaultFlowExecutionRepository

    public DefaultFlowExecutionRepository(ConversationManager conversationManager,
                                          FlowExecutionSnapshotFactory snapshotFactory)

  Create a new default flow execution repository using the given state restorer, conversation manager, and snapshot factory.

  Parameters:
    `conversationManager` - the conversation manager to use
    `snapshotFactory` - the flow execution snapshot factory to use

Method Detail

### getMaxSnapshots

    public int getMaxSnapshots()

  Returns the max number of snapshots allowed per flow execution by this repository.

### setMaxSnapshots

    public void setMaxSnapshots(int maxSnapshots)

  Sets the maximum number of snapshots allowed per flow execution by this repository. Use -1 for unlimited. The default is 30.

### nextSnapshotId

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

  Description copied from class: `AbstractFlowExecutionRepository`
  The next snapshot id to use for a `FlowExecution` instance. Called when `getting a flow execution key`.

  Specified by:
    `nextSnapshotId` in class `AbstractFlowExecutionRepository`
  Returns:
    the id of the flow execution

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

  Specified by:
    `getFlowExecution` in interface `FlowExecutionRepository`
  Specified by:
    `getFlowExecution` in class `AbstractFlowExecutionRepository`
  Parameters:
    `key` - the flow execution key
  Returns:
    the flow execution, fully hydrated and ready to resume

### putFlowExecution

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

  Specified by:
    `putFlowExecution` in interface `FlowExecutionRepository`
  Specified by:
    `putFlowExecution` in class `AbstractFlowExecutionRepository`
  Parameters:
    `flowExecution` - the flow execution

### updateFlowExecutionSnapshot

    public void updateFlowExecutionSnapshot(FlowExecution execution)

  Description copied from interface: `FlowExecutionKeyFactory`
  Capture the current state of the flow execution by updating its snapshot in storage. Does nothing if the no key has been assigned or no snapshot has already been taken.

  Parameters:
    `execution` - the flow execution

### removeFlowExecutionSnapshot

    public void removeFlowExecutionSnapshot(FlowExecution execution)

  Description copied from interface: `FlowExecutionKeyFactory`
  Remove the snapshot that was used to restore this flow execution, discarding it for future use. Does nothing if the no key been assigned or no snapshot has been taken.

  Parameters:
    `execution` - the flow execution

### removeAllFlowExecutionSnapshots

    public void removeAllFlowExecutionSnapshots(FlowExecution execution)

  Description copied from interface: `FlowExecutionKeyFactory`
  Remove all snapshots associated with the flow execution from storage, invalidating all history. Does nothing if no key has been assigned or no snapshots have been taken.

  Parameters:
    `execution` - the flow execution

### createFlowExecutionSnapshotGroup

    protected FlowExecutionSnapshotGroup createFlowExecutionSnapshotGroup()

### getSnapshotGroup

    protected FlowExecutionSnapshotGroup getSnapshotGroup(Conversation conversation)

  Returns the snapshot group associated with the governing conversation.

  Parameters:
    `conversation` - the conversation where the snapshot group is stored
  Returns:
    the snapshot group

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