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
- Version:
- $Revision$
- Author:
- Julien Viet
- See Also:
-
Field Summary
Fields inherited from class org.exoplatform.container.AbstractInterceptor
holder, parentFields inherited from class org.exoplatform.container.AbstractContainer
delegate -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()Gives an identifier to the Container, allowing to inject anInterceptorinto theInterceptorchain.Gives the correspondingManagementContextfinal MBeanServerProvides theMBeanServerthis method is needed for backward compatibilityGives 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.unregisterComponent(Object componentKey) Unregister a component by key.Methods inherited from class org.exoplatform.container.AbstractInterceptor
setHolder, setSuccessorMethods inherited from class org.exoplatform.container.AbstractContainer
accept, createComponent, dispose, getComponentAdapter, getComponentAdapterOfType, getComponentAdapters, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstancesOfType, getSuccessor, initialize, registerComponentAdapter, registerComponentImplementation, startMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.exoplatform.container.spi.Container
accept, createComponent, getComponentAdapter, getComponentAdapterOfType, getComponentAdapters, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstancesOfType, getSuccessor, initialize, registerComponentAdapter, registerComponentImplementationMethods inherited from interface org.picocontainer.Disposable
dispose
-
Constructor Details
-
ManageableContainer
public ManageableContainer() -
ManageableContainer
-
-
Method Details
-
setParent
Sets the parent container- Specified by:
setParentin interfaceInterceptor- Overrides:
setParentin classAbstractInterceptor- Parameters:
parent- the parent container
-
getManagementContext
Gives the correspondingManagementContext- Specified by:
getManagementContextin interfaceContainer- Overrides:
getManagementContextin classAbstractContainer
-
getMBeanServer
Provides theMBeanServerthis method is needed for backward compatibility- Specified by:
getMBeanServerin interfaceContainer- Overrides:
getMBeanServerin classAbstractContainer
-
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
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
- Returns:
- the holder
-
getId
Gives an identifier to the Container, allowing to inject anInterceptorinto theInterceptorchain.- Specified by:
getIdin interfaceInterceptor- Overrides:
getIdin classAbstractInterceptor
-