Class ComponentTaskContext

java.lang.Object
org.exoplatform.container.ComponentTaskContext

public class ComponentTaskContext extends Object
Version:
$Id$
Author:
Nicolas Filotto
  • Constructor Details

    • ComponentTaskContext

      public ComponentTaskContext(Object componentKey, ComponentTaskType type)
      Default constructor
  • Method Details

    • setLastTaskType

      public ComponentTaskContext setLastTaskType(ComponentTaskType lastTaskType)
      Defines explicitly the last task type known
    • addToContext

      public ComponentTaskContext addToContext(Object componentKey) throws CyclicDependencyException
      This method will call addToContext(Object, ComponentTaskType) with the lastTaskType as type
      Throws:
      CyclicDependencyException
    • addToContext

      public ComponentTaskContext addToContext(Object componentKey, ComponentTaskType type) throws CyclicDependencyException
      Creates a new ComponentTaskContext based on the given dependency and the already registered ones. If the dependency has already been registered a CyclicDependencyException will be thrown.
      Throws:
      CyclicDependencyException
    • checkDependency

      public void checkDependency(Object componentKey, ComponentTaskType type) throws CyclicDependencyException
      Checks if the given dependency has already been defined, if so a CyclicDependencyException will be thrown.
      Throws:
      CyclicDependencyException
    • isLast

      public boolean isLast(Object componentKey)
      Indicates whether the provided componentKey is the last dependency that has been added to the context.
      Returns:
      true if the dependency is the last, false otherwise.
    • isRoot

      public boolean isRoot()
      Returns:
      indicates whether the current context is the root context or not.
    • addComponentToContext

      public <T> org.exoplatform.container.ConcurrentContainer.CreationalContextComponentAdapter<T> addComponentToContext(Object key, org.exoplatform.container.ConcurrentContainer.CreationalContextComponentAdapter<T> ctx)
      Adds the CreationalContext of the component corresponding to the given key, to the dependency resolution context
      Parameters:
      key - The key of the component to add to the context
      ctx - The CreationalContext of the component to add to the context
      Returns:
      ConcurrentContainer.CreationalContextComponentAdapter instance that has been put into the map
    • removeComponentFromContext

      public org.exoplatform.container.ConcurrentContainer.CreationalContextComponentAdapter<?> removeComponentFromContext(Object key)
      Removes the CreationalContext of the component corresponding to the given key, from the dependency resolution context
      Parameters:
      key - The key of the component to remove from the context
    • getComponentInstanceFromContext

      public <T> T getComponentInstanceFromContext(Object key, Class<T> bindType)
      Tries to get the component related to the given from the context, if it can be found the current state of the component instance is returned, otherwise null is returned
    • resetDependencies

      public ComponentTaskContext resetDependencies(Object key, ComponentTaskType type)
      Resets the dependencies but keeps the current dependency resolution context.
      Parameters:
      key - the key of the new first dependency
      type - the type of the corresponding task
      Returns:
      a ComponentTaskContext instance with the dependencies reseted
    • toString

      public String toString()
      Overrides:
      toString in class Object