Class ContextManagerImpl
java.lang.Object
org.exoplatform.container.context.ContextManagerImpl
- All Implemented Interfaces:
ThreadContextHolder,ContextManager
The basic implementation of a
ContextManager based on a ConcurrentHashMap that is
filled thanks to a component plugins.- Version:
- $Id$
- Author:
- Nicolas Filotto
-
Field Summary
Fields inherited from interface org.exoplatform.container.component.ThreadContextHolder
MANAGE_THREAD_LOCAL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<K> voidaddContext(AdvancedContext<K> ctx) Registers a contextvoidaddContexts(ContextPlugin plugin) Adds all the contexts defined in the given plugin<K> AdvancedContext<K> getContext(Class<? extends Annotation> scope) Gives the context corresponding to the given scopeGives the value corresponding to the context of the threadbooleanhasContext(Class<? extends Annotation> scope) Indicates whether or not a context has a been registered for the given scope
-
Constructor Details
-
ContextManagerImpl
public ContextManagerImpl()
-
-
Method Details
-
getContext
public <K> AdvancedContext<K> getContext(Class<? extends Annotation> scope) throws IllegalStateException Gives the context corresponding to the given scope- Specified by:
getContextin interfaceContextManager- Parameters:
scope- the annotation class corresponding to the scope- Returns:
- the
Contextcorresponding to the given scope - Throws:
IllegalStateException
-
hasContext
Indicates whether or not a context has a been registered for the given scope- Specified by:
hasContextin interfaceContextManager- Parameters:
scope- the scope of the context- Returns:
trueif it exists a context for the given scope,falseotherwise
-
addContext
Registers a context- Specified by:
addContextin interfaceContextManager- Parameters:
ctx- theContextto register
-
addContexts
Adds all the contexts defined in the given plugin -
getThreadContext
Gives the value corresponding to the context of the thread- Specified by:
getThreadContextin interfaceThreadContextHolder- Returns:
- a new instance of
ThreadContextif there are some valuableThreadLocalvariables to share otherwisenullis expected
-