|
eXo Kernel :: Container 2.5.0-Alpha1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exoplatform.container.AbstractContainer
org.exoplatform.container.ExoContainer
public class ExoContainer
Created by The eXo Platform SAS
The Exo Container is an object responsible for loading services/components.
The eXoContainer class is inherited by all the containers, including RootContainer, PortalContainer,
and StandaloneContainer. It itself inherits from a Container which allows eXo to apply
the Inversion of Control (also known as IoC) principles.
| Field Summary | |
|---|---|
protected ExoContainerContext |
context
|
protected static Log |
LOG
|
protected ExoContainer |
parent
|
protected AtomicBoolean |
stopping
|
| Fields inherited from class org.exoplatform.container.AbstractContainer |
|---|
delegate |
| Constructor Summary | |
|---|---|
ExoContainer()
|
|
ExoContainer(ExoContainer parent)
|
|
| Method Summary | ||
|---|---|---|
void |
addComponentLifecylePlugin(ComponentLifecyclePlugin plugin)
|
|
void |
addContainerLifecylePlugin(ContainerLifecyclePlugin plugin)
|
|
boolean |
canBeDisposed()
Indicates whether or not the container can be disposed |
|
protected boolean |
canBeInitialized()
Indicates whether or not the container can be initialized |
|
boolean |
canBeStarted()
Indicates whether or not the container can be started |
|
boolean |
canBeStopped()
Indicates whether or not the container can be stopped |
|
|
createComponent(Class<T> clazz)
Creates a component corresponding to the given Class with no parameters
This is equivalent to call AbstractContainer.createComponent(Class, InitParams) with
null as InitParams |
|
void |
dispose()
Dispose this component. |
|
ComponentAdapter<?> |
getComponentAdapter(Object componentKey)
Find a component adapter associated with the specified key. |
|
Object |
getComponentInstance(Object componentKey)
Retrieve a component instance registered with a specific key. |
|
protected Configuration |
getConfiguration()
Gets the ConfigurationManager from the given ExoContainer if it exists,
then returns the nested Configuration otherwise it returns null |
|
ExoContainerContext |
getContext()
|
|
ExoContainer |
getParent()
Gives the parent container of this container. |
|
static Set<String> |
getProfiles()
Returns an unmodifiable set of profiles defined by the value returned by invoking PropertyManager.getProperty(String) with the PropertyManager.RUNTIME_PROFILES
property. |
|
Set<String> |
getRegisteredComponentNames()
|
|
static boolean |
hasProfile(String profileName)
Indicates whether or not a given profile exists |
|
void |
initialize()
Initializes the container |
|
|
registerComponentImplementation(Class<T> componentImplementation)
Register a component using the componentImplementation as key. |
|
|
registerComponentInstance(T componentInstance)
Register an arbitrary object. |
|
void |
start()
Start this component. |
|
void |
start(boolean init)
Starts the container |
|
void |
stop()
Stop this component. |
|
protected void |
unregisterAllComponents()
Unregister all components from container to avoid keeping instances in memory. |
|
| Methods inherited from class org.exoplatform.container.AbstractContainer |
|---|
accept, createComponent, getComponentAdapter, getComponentAdapterOfType, getComponentAdapters, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstancesOfType, getManagementContext, getMBeanServer, getScopingObjectName, getSuccessor, registerComponentImplementation, registerComponentInstance, unregisterComponent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final AtomicBoolean stopping
protected static final Log LOG
protected final ExoContainerContext context
protected final ExoContainer parent
| Constructor Detail |
|---|
public ExoContainer()
public ExoContainer(ExoContainer parent)
| Method Detail |
|---|
public static Set<String> getProfiles()
PropertyManager.getProperty(String) with the PropertyManager.RUNTIME_PROFILES
property.
public static boolean hasProfile(String profileName)
profileName - the name of the profile to check
true if the profile exists, false otherwise.public ExoContainerContext getContext()
public void dispose()
AbstractContainer
dispose in interface Disposabledispose in class AbstractContainerpublic void start(boolean init)
init - indicates if the container must be initialized firstpublic void initialize()
AbstractContainer
initialize in interface Containerinitialize in class AbstractContainerpublic void start()
AbstractContainer
start in interface Startablestart in class AbstractContainerpublic void stop()
AbstractContainerDisposable if you need a single call at the definite end of the lifecycle.
stop in interface Startablestop in class AbstractContainerpublic void addComponentLifecylePlugin(ComponentLifecyclePlugin plugin)
public void addContainerLifecylePlugin(ContainerLifecyclePlugin plugin)
protected Configuration getConfiguration()
ConfigurationManager from the given ExoContainer if it exists,
then returns the nested Configuration otherwise it returns null
protected void unregisterAllComponents()
public <T> ComponentAdapter<T> registerComponentImplementation(Class<T> componentImplementation)
throws ContainerException
registerComponentImplementation(componentImplementation, componentImplementation).
componentImplementation - the concrete component class.
getXXX() methods of the
Container interface can be used to retrieve a reference to the component later on.
ContainerException - if registration fails.
public <T> ComponentAdapter<T> registerComponentInstance(T componentInstance)
throws ContainerException
registerComponentImplementation(componentImplementation, componentImplementation).
componentInstance -
getXXX() methods of the
Container interface can be used to retrieve a reference to the component later on.
ContainerException - if registration fails.
public <T> T createComponent(Class<T> clazz)
throws Exception
Class with no parameters
This is equivalent to call AbstractContainer.createComponent(Class, InitParams) with
null as InitParams
clazz - the Class of the object to create
Exception - if any issue occurs while creating the component.public ComponentAdapter<?> getComponentAdapter(Object componentKey)
componentKey - the key that the component was registered with.
null if no component has been registered
for the specified key.public Object getComponentInstance(Object componentKey)
componentKey - the key that the component was registered with.
null if no component has been registered for the specified
key.
public Set<String> getRegisteredComponentNames()
throws ContainerException
ContainerExceptionpublic ExoContainer getParent()
ExoContainer instance, or null if this container does not have a parent.public boolean canBeStarted()
true if it can be started, false otherwise.public boolean canBeStopped()
true if it can be stopped, false otherwise.public boolean canBeDisposed()
true if it can be disposed, false otherwise.protected boolean canBeInitialized()
true if it can be initialized, false otherwise.
|
eXo Kernel :: Container 2.5.0-Alpha1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||