Class ContextManagerImpl

java.lang.Object
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
  • 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:
      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