eXo Kernel :: Container 2.5.0-GA

org.exoplatform.container.context
Class ContextManagerImpl

java.lang.Object
  extended by org.exoplatform.container.context.ContextManagerImpl
All Implemented Interfaces:
ThreadContextHolder, ContextManager

public class ContextManagerImpl
extends Object
implements ContextManager, ThreadContextHolder

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
ContextManagerImpl()
           
 
Method Summary
<K> void
addContext(AdvancedContext<K> ctx)
          Registers a context
 void addContexts(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 scope
 ThreadContext getThreadContext()
          Gives the value corresponding to the context of the thread
 boolean hasContext(Class<? extends Annotation> scope)
          Indicates whether or not a context has a been registered for the given scope
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextManagerImpl

public ContextManagerImpl()
Method Detail

getContext

public <K> AdvancedContext<K> getContext(Class<? extends Annotation> scope)
                              throws IllegalStateException
Gives the context corresponding to the given scope

Specified by:
getContext in interface ContextManager
Parameters:
scope - the annotation class corresponding to the scope
Returns:
the Context corresponding to the given scope
Throws:
IllegalStateException

hasContext

public boolean hasContext(Class<? extends Annotation> scope)
Indicates whether or not a context has a been registered for the given scope

Specified by:
hasContext in interface ContextManager
Parameters:
scope - the scope of the context
Returns:
true if it exists a context for the given scope, false otherwise

addContext

public <K> void addContext(AdvancedContext<K> ctx)
Registers a context

Specified by:
addContext in interface ContextManager
Parameters:
ctx - the Context to register

addContexts

public void addContexts(ContextPlugin plugin)
Adds all the contexts defined in the given plugin


getThreadContext

public ThreadContext getThreadContext()
Gives the value corresponding to the context of the thread

Specified by:
getThreadContext in interface ThreadContextHolder
Returns:
a new instance of ThreadContext if there are some valuable ThreadLocal variables to share otherwise null is expected

eXo Kernel :: Container 2.5.0-GA

Copyright © 2014 eXo Platform SAS. All Rights Reserved.