eXo Kernel :: Container 2.5.0-GA

org.exoplatform.container.management
Class ManageableContainer

java.lang.Object
  extended by org.exoplatform.container.AbstractContainer
      extended by org.exoplatform.container.AbstractInterceptor
          extended by 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
ManageableContainer()
           
ManageableContainer(ExoContainer holder, ExoContainer parent)
           
 
Method Summary
 ExoContainer getHolder()
           
 String getId()
          Gives an identifier to the Container, allowing to inject an Interceptor into the Interceptor chain.
 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
<T> ComponentAdapter<T>
registerComponentInstance(Object componentKey, T componentInstance)
          Register an arbitrary object as a component in the container.
 void setParent(ExoContainer parent)
          Sets the parent container
 void stop()
          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.Startable
start
 
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:
setParent in interface Interceptor
Overrides:
setParent in class AbstractInterceptor
Parameters:
parent - the parent container

getManagementContext

public ManagementContext getManagementContext()
Gives the corresponding ManagementContext

Specified by:
getManagementContext in interface Container
Overrides:
getManagementContext in class AbstractContainer

getMBeanServer

public final MBeanServer getMBeanServer()
Provides the MBeanServer this method is needed for backward compatibility

Specified by:
getMBeanServer in interface Container
Overrides:
getMBeanServer in class AbstractContainer

getScopingObjectName

public ObjectName getScopingObjectName()
Gives the ObjectName of the container build from the scoping data

Specified by:
getScopingObjectName in interface Container
Overrides:
getScopingObjectName in class AbstractContainer
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:
registerComponentInstance in interface Container
Overrides:
registerComponentInstance in class AbstractContainer
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 the Container interface 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:
unregisterComponent in interface Container
Overrides:
unregisterComponent in class AbstractContainer
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. Implement Disposable if you need a single call at the definite end of the lifecycle.

Specified by:
stop in interface Startable
Overrides:
stop in class AbstractContainer

getHolder

public ExoContainer getHolder()
Returns:
the holder

getId

public String getId()
Gives an identifier to the Container, allowing to inject an Interceptor into the Interceptor chain.

Specified by:
getId in interface Interceptor
Overrides:
getId in class AbstractInterceptor

eXo Kernel :: Container 2.5.0-GA

Copyright © 2014 eXo Platform SAS. All Rights Reserved.