|
eXo Kernel :: Container 2.5.0-GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exoplatform.container.AbstractContainer
public abstract class AbstractContainer
This class is the root class of all the implementations of a Container.
It implements by default all the methods by delegating the call the the successor.
| Field Summary | |
|---|---|
protected Interceptor |
delegate
|
| Constructor Summary | |
|---|---|
protected |
AbstractContainer()
|
protected |
AbstractContainer(Interceptor successor)
|
| Method Summary | ||
|---|---|---|
void |
accept(ContainerVisitor visitor)
Accepts a visitor that should visit the child containers, component adapters and component instances. |
|
|
createComponent(Class<T> clazz,
InitParams params)
Creates a component corresponding to the given Class with the
given InitParams |
|
void |
dispose()
Dispose this component. |
|
|
getComponentAdapter(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
Find a component adapter associated with the specified key. |
|
|
getComponentAdapterOfType(Class<T> componentType,
boolean autoRegistration)
Find a component adapter associated with the specified type. |
|
Collection<ComponentAdapter<?>> |
getComponentAdapters()
Retrieve all the component adapters inside this container. |
|
|
getComponentAdaptersOfType(Class<T> componentType)
Retrieve all component adapters inside this container that are associated with the specified type. |
|
|
getComponentInstance(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
Retrieve a component instance registered with a specific key. |
|
|
getComponentInstanceOfType(Class<T> componentType,
boolean autoRegistration)
Find a component instance matching the specified type. |
|
|
getComponentInstancesOfType(Class<T> componentType)
Returns a List of components of a certain componentType. |
|
ManagementContext |
getManagementContext()
Gives the corresponding ManagementContext |
|
MBeanServer |
getMBeanServer()
Provides the MBeanServer this method is needed for backward compatibility |
|
ObjectName |
getScopingObjectName()
Gives the ObjectName of the container build from the scoping data |
|
Interceptor |
getSuccessor()
Retrieve the successor of this container in the chain of Interceptor. |
|
void |
initialize()
Initializes the container |
|
|
registerComponentImplementation(Object componentKey,
Class<T> componentImplementation)
Register a component. |
|
|
registerComponentInstance(Object componentKey,
T componentInstance)
Register an arbitrary object as a component in the container. |
|
void |
start()
Start this component. |
|
void |
stop()
Stop this component. |
|
ComponentAdapter<?> |
unregisterComponent(Object componentKey)
Unregister a component by key. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Interceptor delegate
| Constructor Detail |
|---|
protected AbstractContainer()
protected AbstractContainer(Interceptor successor)
| Method Detail |
|---|
public void start()
start in interface Startablepublic void stop()
Disposable if you need a single call at the definite end of the lifecycle.
stop in interface Startablepublic void dispose()
dispose in interface Disposable
public <T> T getComponentInstance(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
getComponentInstance in interface ContainercomponentKey - the key that the component was registered with.bindType - the expected type of the instance if one can be found.autoRegistration - indicates whether the auto registration should be performed or not
null if no component has been registered for the specified
key.
public <T> T getComponentInstanceOfType(Class<T> componentType,
boolean autoRegistration)
getComponentInstanceOfType in interface ContainercomponentType - the type of the component.autoRegistration - indicates whether the auto registration should be performed or not
public Interceptor getSuccessor()
Interceptor.
getSuccessor in interface ContainerInterceptor instance, or null if this container does not have a successor.
public <T> ComponentAdapter<T> getComponentAdapter(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
getComponentAdapter in interface ContainercomponentKey - the key that the component was registered with.bindType - the expected raw type of the adapter if one can be found.autoRegistration - indicates whether the auto registration should be performed or not
null if no component has been registered
for the specified key.
public <T> ComponentAdapter<T> getComponentAdapterOfType(Class<T> componentType,
boolean autoRegistration)
getComponentAdapterOfType in interface ContainercomponentType - the type of the component.autoRegistration - indicates whether the auto registration should be performed or not
null if no component has been
registered for the specified key.public Collection<ComponentAdapter<?>> getComponentAdapters()
getComponentAdapters in interface ContainerComponentAdapters inside this container. The collection will
not be modifiable.a variant of this method which returns the component adapters inside this
container that are associated with the specified type.public <T> List<ComponentAdapter<T>> getComponentAdaptersOfType(Class<T> componentType)
getComponentAdaptersOfType in interface ContainercomponentType - the type of the components.
ComponentAdapters inside this container that are associated with
the specified type. Changes to this collection will not be reflected in the container itself.
public <T> List<T> getComponentInstancesOfType(Class<T> componentType)
throws ContainerException
getComponentInstancesOfType in interface ContainercomponentType - the searched type.
ContainerExceptionpublic void accept(ContainerVisitor visitor)
accept in interface Containervisitor - the visitor
public <T> ComponentAdapter<T> registerComponentImplementation(Object componentKey,
Class<T> componentImplementation)
throws ContainerException
registerComponentImplementation in interface ContainercomponentKey - a key that identifies the component. Must be unique within the container. The type
of the key object has no semantic significance unless explicitly specified in the
documentation of the implementing container.componentImplementation - the component's implementation class. This must be a concrete class (ie, a
class that can be instantiated).
getXXX() methods of the
Container interface can be used to retrieve a reference to the component later on.
ContainerException
public <T> ComponentAdapter<T> registerComponentInstance(Object componentKey,
T componentInstance)
throws ContainerException
registerComponentInstance in interface ContainercomponentKey - a key that identifies the component. Must be unique within the container. The type of the
key object has no semantic significance unless explicitly specified in the implementing
container.componentInstance - an arbitrary object.
getXXX() methods of the
Container interface can be used to retrieve a reference to the component later on.
ContainerException - if registration fails.public ComponentAdapter<?> unregisterComponent(Object componentKey)
unregisterComponent in interface ContainercomponentKey - key of the component to unregister.
public ManagementContext getManagementContext()
ManagementContext
getManagementContext in interface Containerpublic MBeanServer getMBeanServer()
MBeanServer this method is needed for backward compatibility
getMBeanServer in interface Containerpublic ObjectName getScopingObjectName()
getScopingObjectName in interface Container
public <T> T createComponent(Class<T> clazz,
InitParams params)
throws Exception
Class with the
given InitParams
createComponent in interface Containerclazz - the Class of the object to createparams - the parameters to use to create the component
Exception - if any issue occurs while creating the component.public void initialize()
initialize in interface Container
|
eXo Kernel :: Container 2.5.0-GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||