eXo Kernel :: Container Multi-Threaded 2.5.0-CR2

org.exoplatform.container
Class ComponentTaskContext

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

public class ComponentTaskContext
extends Object

Version:
$Id$
Author:
Nicolas Filotto

Constructor Summary
ComponentTaskContext(Object componentKey, ComponentTaskType type)
          Default constructor
 
Method Summary
<T> ConcurrentContainer.CreationalContextComponentAdapter<T>
addComponentToContext(Object key, ConcurrentContainer.CreationalContextComponentAdapter<T> ctx)
          Adds the CreationalContext of the component corresponding to the given key, to the dependency resolution context
 ComponentTaskContext addToContext(Object componentKey)
          This method will call addToContext(Object, ComponentTaskType) with the lastTaskType as type
 ComponentTaskContext addToContext(Object componentKey, ComponentTaskType type)
          Creates a new ComponentTaskContext based on the given dependency and the already registered ones.
 void checkDependency(Object componentKey, ComponentTaskType type)
          Checks if the given dependency has already been defined, if so a CyclicDependencyException will be thrown.
<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
 boolean isLast(Object componentKey)
          Indicates whether the provided componentKey is the last dependency that has been added to the context.
 boolean isRoot()
           
 ConcurrentContainer.CreationalContextComponentAdapter<?> removeComponentFromContext(Object key)
          Removes the CreationalContext of the component corresponding to the given key, from the dependency resolution context
 ComponentTaskContext resetDependencies(Object key, ComponentTaskType type)
          Resets the dependencies but keeps the current dependency resolution context.
 ComponentTaskContext setLastTaskType(ComponentTaskType lastTaskType)
          Defines explicitly the last task type known
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentTaskContext

public ComponentTaskContext(Object componentKey,
                            ComponentTaskType type)
Default constructor

Method Detail

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> ConcurrentContainer.CreationalContextComponentAdapter<T> addComponentToContext(Object key,
                                                                                          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 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

eXo Kernel :: Container Multi-Threaded 2.5.0-CR2

Copyright © 2014 eXo Platform SAS. All Rights Reserved.