Class ManageableContainer
- java.lang.Object
-
- org.exoplatform.container.AbstractContainer
-
- org.exoplatform.container.AbstractInterceptor
-
- org.exoplatform.container.management.ManageableContainer
-
- All Implemented Interfaces:
Serializable,Container,Interceptor,Disposable,Startable
public class ManageableContainer extends AbstractInterceptor
- Version:
- $Revision$
- Author:
- Julien Viet
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.exoplatform.container.AbstractInterceptor
holder, parent
-
Fields inherited from class org.exoplatform.container.AbstractContainer
delegate
-
-
Constructor Summary
Constructors Constructor Description ManageableContainer()ManageableContainer(ExoContainer holder, ExoContainer parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExoContainergetHolder()StringgetId()Gives an identifier to the Container, allowing to inject anInterceptorinto theInterceptorchain.ManagementContextgetManagementContext()Gives the correspondingManagementContextMBeanServergetMBeanServer()Provides theMBeanServerthis method is needed for backward compatibilityObjectNamegetScopingObjectName()Gives the ObjectName of the container build from the scoping data<T> ComponentAdapter<T>registerComponentInstance(Object componentKey, T componentInstance)Register an arbitrary object as a component in the container.voidsetParent(ExoContainer parent)Sets the parent containervoidstop()Stop this component.ComponentAdapter<?>unregisterComponent(Object componentKey)Unregister a component by key.-
Methods inherited from class org.exoplatform.container.AbstractInterceptor
setHolder, setSuccessor
-
Methods inherited from class org.exoplatform.container.AbstractContainer
accept, createComponent, dispose, getComponentAdapter, getComponentAdapterOfType, getComponentAdapters, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstancesOfType, getSuccessor, initialize, registerComponentImplementation, start
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.exoplatform.container.spi.Container
accept, createComponent, getComponentAdapter, getComponentAdapterOfType, getComponentAdapters, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstancesOfType, getSuccessor, initialize, registerComponentImplementation
-
Methods inherited from interface org.picocontainer.Disposable
dispose
-
-
-
-
Constructor Detail
-
ManageableContainer
public ManageableContainer()
-
ManageableContainer
public ManageableContainer(ExoContainer holder, ExoContainer parent)
-
-
Method Detail
-
setParent
public void setParent(ExoContainer parent)
Sets the parent container- Specified by:
setParentin interfaceInterceptor- Overrides:
setParentin classAbstractInterceptor- Parameters:
parent- the parent container
-
getManagementContext
public ManagementContext getManagementContext()
Gives the correspondingManagementContext- Specified by:
getManagementContextin interfaceContainer- Overrides:
getManagementContextin classAbstractContainer
-
getMBeanServer
public final MBeanServer getMBeanServer()
Provides theMBeanServerthis method is needed for backward compatibility- Specified by:
getMBeanServerin interfaceContainer- Overrides:
getMBeanServerin classAbstractContainer
-
getScopingObjectName
public ObjectName getScopingObjectName()
Gives the ObjectName of the container build from the scoping data- Specified by:
getScopingObjectNamein interfaceContainer- Overrides:
getScopingObjectNamein classAbstractContainer- Returns:
-
registerComponentInstance
public <T> ComponentAdapter<T> registerComponentInstance(Object componentKey, T componentInstance) throws ContainerException
Register an arbitrary object as a component in the container. This is handy when other components in the same container have dependencies on this kind of object, but where letting the container manage and instantiate it is impossible.
Beware that too much use of this method is an antipattern.- Specified by:
registerComponentInstancein interfaceContainer- Overrides:
registerComponentInstancein classAbstractContainer- Parameters:
componentKey- 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.- Returns:
- the ComponentAdapter that has been associated with this component. In the majority of cases, this return
value can be safely ignored, as one of the
getXXX()methods of theContainerinterface can be used to retrieve a reference to the component later on. - Throws:
ContainerException- if registration fails.
-
unregisterComponent
public ComponentAdapter<?> unregisterComponent(Object componentKey)
Unregister a component by key.- Specified by:
unregisterComponentin interfaceContainer- Overrides:
unregisterComponentin classAbstractContainer- Parameters:
componentKey- key of the component to unregister.- Returns:
- the ComponentAdapter that was associated with this component.
-
stop
public void stop()
Stop this component. Called near the end of the lifecycle. It can be called again after a further start. ImplementDisposableif you need a single call at the definite end of the lifecycle.- Specified by:
stopin interfaceStartable- Overrides:
stopin classAbstractContainer
-
getHolder
public ExoContainer getHolder()
- Returns:
- the holder
-
getId
public String getId()
Gives an identifier to the Container, allowing to inject anInterceptorinto theInterceptorchain.- Specified by:
getIdin interfaceInterceptor- Overrides:
getIdin classAbstractInterceptor
-
-