org.granite.client.tide.impl
Class SimpleContextManager

java.lang.Object
  extended by org.granite.client.tide.impl.SimpleContextManager
All Implemented Interfaces:
ContextManager
Direct Known Subclasses:
CDIContextManager, SpringContextManager

public class SimpleContextManager
extends Object
implements ContextManager

Author:
William DRAI

Nested Class Summary
static class SimpleContextManager.DefaultInstanceStoreFactory
           
 
Field Summary
static String CONTEXT_CREATE
           
static String CONTEXT_DESTROY
           
protected  EventBus eventBus
           
protected  Platform platform
           
 
Constructor Summary
protected SimpleContextManager()
           
  SimpleContextManager(Platform platform)
           
  SimpleContextManager(Platform platform, EventBus eventBus)
           
 
Method Summary
 void addToContextsToDestroy(String contextId)
           
protected  Context createContext(Context parentCtx, String contextId)
           
 void destroyContext(String contextId, boolean force)
           
 void destroyContexts(boolean force)
           
 void destroyFinishedContexts()
           
 List<Context> getAllContexts()
          Returns the list of conversation contexts
 Context getContext()
          Return the global context
 Context getContext(String contextId)
          Return a context from its id
 Context getContext(String contextId, String parentContextId, boolean create)
          Return a context from its id
 boolean isGlobal(Context context)
          Determine if the specified context is the global one
 Context newContext(String contextId, String parentContextId)
           
 void removeFromContextsToDestroy(String contextId)
           
 Context retrieveContext(Context sourceContext, String contextId, boolean wasConversationCreated, boolean wasConversationEnded)
           
 void setBeanManager(BeanManager beanManager)
           
 void setInstanceStoreFactory(InstanceStoreFactory instanceStoreFactory)
           
 void updateContextId(String previousContextId, Context context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_CREATE

public static final String CONTEXT_CREATE
See Also:
Constant Field Values

CONTEXT_DESTROY

public static final String CONTEXT_DESTROY
See Also:
Constant Field Values

platform

protected final Platform platform

eventBus

protected final EventBus eventBus
Constructor Detail

SimpleContextManager

protected SimpleContextManager()

SimpleContextManager

public SimpleContextManager(Platform platform)

SimpleContextManager

public SimpleContextManager(Platform platform,
                            EventBus eventBus)
Method Detail

setInstanceStoreFactory

public void setInstanceStoreFactory(InstanceStoreFactory instanceStoreFactory)
Specified by:
setInstanceStoreFactory in interface ContextManager

setBeanManager

public void setBeanManager(BeanManager beanManager)
Specified by:
setBeanManager in interface ContextManager

isGlobal

public boolean isGlobal(Context context)
Determine if the specified context is the global one

Parameters:
context -
Returns:
true if global

getContext

public Context getContext()
Return the global context

Specified by:
getContext in interface ContextManager
Returns:
context

getContext

public Context getContext(String contextId)
Return a context from its id

Specified by:
getContext in interface ContextManager
Parameters:
contextId - context id
Returns:
context

createContext

protected Context createContext(Context parentCtx,
                                String contextId)

getContext

public Context getContext(String contextId,
                          String parentContextId,
                          boolean create)
Return a context from its id

Specified by:
getContext in interface ContextManager
Parameters:
contextId - context id
create - should create when not existing
Returns:
context

newContext

public Context newContext(String contextId,
                          String parentContextId)
Specified by:
newContext in interface ContextManager
Parameters:
contextId - the requested context id
Returns:
the context

destroyContext

public void destroyContext(String contextId,
                           boolean force)
Specified by:
destroyContext in interface ContextManager
Parameters:
contextId - context id
force - force complete destruction of context

getAllContexts

public List<Context> getAllContexts()
Returns the list of conversation contexts

Specified by:
getAllContexts in interface ContextManager
Returns:
conversation contexts

destroyContexts

public void destroyContexts(boolean force)
Specified by:
destroyContexts in interface ContextManager
Parameters:
force - force complete destruction of contexts (all event listeners...), used for testing

destroyFinishedContexts

public void destroyFinishedContexts()
Specified by:
destroyFinishedContexts in interface ContextManager

removeFromContextsToDestroy

public void removeFromContextsToDestroy(String contextId)
Specified by:
removeFromContextsToDestroy in interface ContextManager
Parameters:
contextId - context id

addToContextsToDestroy

public void addToContextsToDestroy(String contextId)
Specified by:
addToContextsToDestroy in interface ContextManager
Parameters:
contextId - context id

retrieveContext

public Context retrieveContext(Context sourceContext,
                               String contextId,
                               boolean wasConversationCreated,
                               boolean wasConversationEnded)
Specified by:
retrieveContext in interface ContextManager

updateContextId

public void updateContextId(String previousContextId,
                            Context context)
Specified by:
updateContextId in interface ContextManager
Parameters:
previousContextId - existing id
context - new context