org.springframework.conversation.manager
Class AbstractConversationRepository

java.lang.Object
  extended by org.springframework.conversation.manager.AbstractConversationRepository
All Implemented Interfaces:
ConversationRepository
Direct Known Subclasses:
LocalTransientConversationRepository, SessionBasedConversationRepository

public abstract class AbstractConversationRepository
extends Object
implements ConversationRepository

An abstract implementation for a conversation repository. Its implementation is based on the DefaultConversation and manages its initial timeout and provides easy removal functionality. Internally, there is no explicit check for the conversation object implementing the MutableConversation interface, it is assumed to be implemented as the abstract repository also creates the conversation objects.

Since:
3.1
Author:
Micha Kiener

Constructor Summary
AbstractConversationRepository()
           
 
Method Summary
 MutableConversation createNewChildConversation(MutableConversation parentConversation, boolean isIsolated)
          Creates a new conversation, attaches it to the parent and initializes its timeout as being set on the parent.
 MutableConversation createNewConversation()
          Creates a new conversation object and initializes its timeout by using the default timeout being set on this repository.
 int getDefaultConversationTimeout()
           
protected  void removeConversation(MutableConversation conversation)
          Internal, final method recursively invoking this method for all children of the given conversation.
 void removeConversation(String id, boolean root)
          Generic implementation of the remove method of a repository, handling the root flag automatically by invoking the #removeConversation(org.springframework.conversation.Conversation) by either passing in the root conversation or just the given conversation.
Concrete repository implementations can overwrite the #removeConversation(org.springframework.conversation.Conversation) method to finally remove the conversation object or they might provide their own custom implementation for the remove operation by overwriting this method completely.
protected abstract  void removeSingleConversationObject(MutableConversation conversation)
          Abstract removal method to be implemented by concrete repository implementations to remove the given, single conversation object.
 void setDefaultConversationTimeout(int defaultTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.conversation.manager.ConversationRepository
getConversation, storeConversation
 

Constructor Detail

AbstractConversationRepository

public AbstractConversationRepository()
Method Detail

createNewConversation

public MutableConversation createNewConversation()
Creates a new conversation object and initializes its timeout by using the default timeout being set on this repository.

Specified by:
createNewConversation in interface ConversationRepository
Returns:
the newly created conversation object

createNewChildConversation

public MutableConversation createNewChildConversation(MutableConversation parentConversation,
                                                      boolean isIsolated)
Creates a new conversation, attaches it to the parent and initializes its timeout as being set on the parent.

Specified by:
createNewChildConversation in interface ConversationRepository
Parameters:
parentConversation - the parent conversation to create and attach a new child conversation to
isIsolated - true if the new child conversation has to be isolated from its parent state, false if it will inherit the state from the given parent
Returns:
the newly created child conversation, attached to the given parent conversation

removeConversation

public void removeConversation(String id,
                               boolean root)
Generic implementation of the remove method of a repository, handling the root flag automatically by invoking the #removeConversation(org.springframework.conversation.Conversation) by either passing in the root conversation or just the given conversation.
Concrete repository implementations can overwrite the #removeConversation(org.springframework.conversation.Conversation) method to finally remove the conversation object or they might provide their own custom implementation for the remove operation by overwriting this method completely.

Specified by:
removeConversation in interface ConversationRepository
Parameters:
id - the id of the conversation to be removed
root - flag indicating whether the whole conversation hierarchy should be removed (true) or just the specified conversation

removeConversation

protected final void removeConversation(MutableConversation conversation)
Internal, final method recursively invoking this method for all children of the given conversation.

Parameters:
conversation - the conversation to be removed, including its children, if any

removeSingleConversationObject

protected abstract void removeSingleConversationObject(MutableConversation conversation)
Abstract removal method to be implemented by concrete repository implementations to remove the given, single conversation object. Any parent and child relations must not be handled within this method, just the removal of the given object.

Parameters:
conversation - the single conversation object to be removed from this repository

setDefaultConversationTimeout

public void setDefaultConversationTimeout(int defaultTimeout)

getDefaultConversationTimeout

public int getDefaultConversationTimeout()