org.springframework.conversation.manager
Interface ConversationRepository

All Known Implementing Classes:
AbstractConversationRepository, LocalTransientConversationRepository, SessionBasedConversationRepository

public interface ConversationRepository

The conversation repository is responsible for creating new conversation objects, store them within its own storage and finally remove the after they have been ended.
The repository might be transient (most likely in a web environment) but might support long running, persisted conversations as well.
The repository is responsible for the timeout management of the conversation objects as well and might use an existing mechanism to do so (in a distributed, cached storage for instance).
Depending on the underlying storage mechanism, the repository might support destruction callbacks within the conversation objects or not. If they are not supported, make sure an appropriate warning will be logged if registering a destruction callback.

Since:
3.1
Author:
Micha Kiener

Method Summary
 MutableConversation createNewChildConversation(MutableConversation parentConversation, boolean isIsolated)
          Creates a new child conversation and attaches it as a child to the given parent conversation.
 MutableConversation createNewConversation()
          Creates a new root conversation object and returns it.
 MutableConversation getConversation(String id)
          Returns the conversation with the given id which has to be registered before.
 void removeConversation(String id, boolean root)
          Removes the conversation with the given id from this store.
 void storeConversation(MutableConversation conversation)
          Stores the given conversation object within this repository.
 

Method Detail

createNewConversation

MutableConversation createNewConversation()
Creates a new root conversation object and returns it. Be aware that this method does not store the conversation, this has to be done using the storeConversation(MutableConversation) method. The id of the conversation will typically be set within the store method rather than the creation method.

Returns:
the newly created conversation object

createNewChildConversation

MutableConversation createNewChildConversation(MutableConversation parentConversation,
                                               boolean isIsolated)
Creates a new child conversation and attaches it as a child to the given parent conversation. Like the createNewConversation() method, this one does not store the new child conversation object, this has to be done using the storeConversation(MutableConversation) method. The id of the new child conversation will typically be set within the store method rather than the creation method.

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

getConversation

MutableConversation getConversation(String id)
Returns the conversation with the given id which has to be registered before. If no such conversation is found, null is returned rather than throwing an exception.

Parameters:
id - the id to return the conversation from this store
Returns:
the conversation, if found, null otherwise

storeConversation

void storeConversation(MutableConversation conversation)
Stores the given conversation object within this repository. Depending on its implementation, the storage might be transient or persistent, it might relay on other mechanisms like a session (in the area of web conversations for instance). After the conversation has been stored, its id must be set hence the id of the conversation will be available only after the store method has been invoked.

Parameters:
conversation - the conversation to be stored within the repository

removeConversation

void removeConversation(String id,
                        boolean root)
Removes the conversation with the given id from this store. Depending on the root flag, the whole conversation hierarchy is removed or just the specified conversation.

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 (false)