Package org.exoplatform.container
Class ComponentTaskContext
java.lang.Object
org.exoplatform.container.ComponentTaskContext
- Version:
- $Id$
- Author:
- Nicolas Filotto
-
Constructor Summary
ConstructorsConstructorDescriptionComponentTaskContext(Object componentKey, ComponentTaskType type) Default constructor -
Method Summary
Modifier and TypeMethodDescription<T> org.exoplatform.container.ConcurrentContainer.CreationalContextComponentAdapter<T>addComponentToContext(Object key, org.exoplatform.container.ConcurrentContainer.CreationalContextComponentAdapter<T> ctx) Adds theCreationalContextof the component corresponding to the given key, to the dependency resolution contextaddToContext(Object componentKey) This method will calladdToContext(Object, ComponentTaskType)with thelastTaskTypeas typeaddToContext(Object componentKey, ComponentTaskType type) Creates a newComponentTaskContextbased on the given dependency and the already registered ones.voidcheckDependency(Object componentKey, ComponentTaskType type) Checks if the given dependency has already been defined, if so aCyclicDependencyExceptionwill be thrown.<T> TgetComponentInstanceFromContext(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, otherwisenullis returnedbooleanIndicates whether the provided componentKey is the last dependency that has been added to the context.booleanisRoot()org.exoplatform.container.ConcurrentContainer.CreationalContextComponentAdapter<?>Removes theCreationalContextof the component corresponding to the given key, from the dependency resolution contextresetDependencies(Object key, ComponentTaskType type) Resets the dependencies but keeps the current dependency resolution context.setLastTaskType(ComponentTaskType lastTaskType) Defines explicitly the last task type knowntoString()
-
Constructor Details
-
ComponentTaskContext
Default constructor
-
-
Method Details
-
setLastTaskType
Defines explicitly the last task type known -
addToContext
This method will calladdToContext(Object, ComponentTaskType)with thelastTaskTypeas type- Throws:
CyclicDependencyException
-
addToContext
public ComponentTaskContext addToContext(Object componentKey, ComponentTaskType type) throws CyclicDependencyException Creates a newComponentTaskContextbased on the given dependency and the already registered ones. If the dependency has already been registered aCyclicDependencyExceptionwill 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 aCyclicDependencyExceptionwill be thrown.- Throws:
CyclicDependencyException
-
isLast
Indicates whether the provided componentKey is the last dependency that has been added to the context.- Returns:
trueif the dependency is the last,falseotherwise.
-
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 theCreationalContextof the component corresponding to the given key, to the dependency resolution context- Parameters:
key- The key of the component to add to the contextctx- TheCreationalContextof the component to add to the context- Returns:
ConcurrentContainer.CreationalContextComponentAdapterinstance that has been put into the map
-
removeComponentFromContext
public org.exoplatform.container.ConcurrentContainer.CreationalContextComponentAdapter<?> removeComponentFromContext(Object key) Removes theCreationalContextof 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
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, otherwisenullis returned -
resetDependencies
Resets the dependencies but keeps the current dependency resolution context.- Parameters:
key- the key of the new first dependencytype- the type of the corresponding task- Returns:
- a
ComponentTaskContextinstance with the dependencies reseted
-
toString
-