public class SimpleContextManager extends Object implements ContextManager
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleContextManager.DefaultInstanceStoreFactory |
| Modifier and Type | Field and Description |
|---|---|
protected Application |
application |
static String |
CONTEXT_CREATE |
static String |
CONTEXT_DESTROY |
protected EventBus |
eventBus |
| Constructor and Description |
|---|
SimpleContextManager() |
SimpleContextManager(Application application)
Create a simple context manager using the specified application
|
SimpleContextManager(Application application,
EventBus eventBus)
Create a simple context manager using the specified application and event bus
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToContextsToDestroy(String contextId)
Add context to the list of contexts to destroy
|
protected Context |
createContext(Context parentCtx,
String contextId) |
void |
destroyContext(String contextId)
Destroy a context
|
void |
destroyContexts()
Destroy all contexts
|
void |
destroyFinishedContexts()
Destroy finished contexts and reset current pending contexts
|
List<Context> |
getAllContexts()
Get a list of all conversation contexts
|
Context |
getContext()
Get the global context
|
Context |
getContext(String contextId)
Get the context from its id
|
Context |
getContext(String contextId,
String parentContextId,
boolean create)
Get a context from its id with the specified parent id, and create it if it does not exist
|
boolean |
isGlobal(Context context)
Determine if the specified context is the global one
|
Context |
newContext(String contextId,
String parentContextId)
Create a context with the specified id and parent id if it does not exist
|
void |
removeFromContextsToDestroy(String contextId)
Remove context from the list of contexts to destroy
|
Context |
retrieveContext(Context sourceContext,
String contextId,
boolean wasConversationCreated,
boolean wasConversationEnded)
Get or create the context for the specified context id and server conversation flags
|
void |
setInstanceStoreFactory(InstanceStoreFactory instanceStoreFactory)
Set the instance store factory for this context manager
|
void |
updateContextId(String previousContextId,
Context context)
Defines new context for existing id
|
public static final String CONTEXT_CREATE
public static final String CONTEXT_DESTROY
protected final Application application
public SimpleContextManager()
public SimpleContextManager(Application application)
application - applicationpublic SimpleContextManager(Application application, EventBus eventBus)
application - applicationeventBus - event buspublic void setInstanceStoreFactory(InstanceStoreFactory instanceStoreFactory)
instanceStoreFactory - instance store factorypublic boolean isGlobal(Context context)
context - public Context getContext()
ContextManagergetContext in interface ContextManagerpublic Context getContext(String contextId)
ContextManagergetContext in interface ContextManagercontextId - context idprotected Context createContext(Context parentCtx, String contextId)
public Context getContext(String contextId, String parentContextId, boolean create)
ContextManagergetContext in interface ContextManagercontextId - context idparentContextId - parent context idcreate - if true, create a context if not existpublic Context newContext(String contextId, String parentContextId)
ContextManagernewContext in interface ContextManagercontextId - context idparentContextId - parent context idpublic void destroyContext(String contextId)
ContextManagerdestroyContext in interface ContextManagercontextId - context idpublic List<Context> getAllContexts()
ContextManagergetAllContexts in interface ContextManagerpublic void destroyContexts()
ContextManagerdestroyContexts in interface ContextManagerpublic void destroyFinishedContexts()
ContextManagerdestroyFinishedContexts in interface ContextManagerpublic void removeFromContextsToDestroy(String contextId)
removeFromContextsToDestroy in interface ContextManagercontextId - context idpublic void addToContextsToDestroy(String contextId)
addToContextsToDestroy in interface ContextManagercontextId - context idpublic Context retrieveContext(Context sourceContext, String contextId, boolean wasConversationCreated, boolean wasConversationEnded)
ContextManagerretrieveContext in interface ContextManagersourceContext - source contextcontextId - conversation context idwasConversationCreated - true if the conversation was just created by the last request on the serverwasConversationEnded - true if the conversation was just ended by the last request on the serverpublic void updateContextId(String previousContextId, Context context)
updateContextId in interface ContextManagerpreviousContextId - existing idcontext - new context