|
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
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. |
|
|
getComponentAdapter(Object componentKey,
Class<T> bindType)
This method is equivalent to getComponentAdapter(Object, Class, boolean) with true for the parameter
autoRegistration |
|
|
getComponentAdapter(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
Find a component adapter associated with the specified key. |
|
|
getComponentAdapterOfType(Class<T> componentType)
This method is equivalent to getComponentAdapterOfType(Class, boolean) with true for the parameter
autoRegistration |
|
|
getComponentAdapterOfType(Class<T> componentType,
boolean autoRegistration)
Find a component adapter associated with the specified type. |
|
Object |
getComponentInstance(Object componentKey)
Retrieve a component instance registered with a specific key. |
|
|
getComponentInstance(Object componentKey,
Class<T> bindType)
This method is equivalent to getComponentInstance(Object, Class, boolean) with true for the parameter
autoRegistration |
|
|
getComponentInstance(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
Retrieve a component instance registered with a specific key. |
|
|
getComponentInstanceOfType(Class<T> componentType)
This method is equivalent to getComponentInstanceOfType(Class, boolean) with true for the parameter
autoRegistration |
|
|
getComponentInstanceOfType(Class<T> componentType,
boolean autoRegistration)
Find a component instance matching the specified type. |
|
protected Configuration |
getConfiguration()
Gets the ConfigurationManager from the given ExoContainer if it exists,
then returns the nested Configuration otherwise it returns null |
|
ExoContainerContext |
getContext()
|
|
ContextManager |
getContextManager()
Gives the ContextManager that has been registered |
|
protected Collection<ExternalComponentPlugins> |
getExternalComponentPluginsUnused()
Gives all the ExternalComponentPlugins that have not been used, null
if there are all used. |
|
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 |
|
protected void |
initContainerInternal()
|
|
void |
initialize()
Initializes the container |
|
boolean |
isContextManagerLoaded()
Indicates whether or not the ContextManager has already been loaded |
|
|
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, getComponentAdapters, getComponentAdaptersOfType, 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()
protected void initContainerInternal()
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 Collection<ExternalComponentPlugins> getExternalComponentPluginsUnused()
ExternalComponentPlugins that have not been used, null
if there are all used.
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 - the instance of the component to register
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.public ContextManager getContextManager()
ContextManager that has been registered
ContextManager related to this container, null otherwise.public boolean isContextManagerLoaded()
ContextManager has already been loaded
true if the ContextManager has been loaded,
false otherwise.public <T> T getComponentInstanceOfType(Class<T> componentType)
getComponentInstanceOfType(Class, boolean) with true for the parameter
autoRegistration
public <T> T getComponentInstanceOfType(Class<T> componentType,
boolean autoRegistration)
DefinitionByType if the parameter
autoRegistration has been set to true.
getComponentInstanceOfType in interface ContainergetComponentInstanceOfType in class AbstractContainercomponentType - the type of the component.autoRegistration - indicates whether the auto registration should be performed or not
public <T> ComponentAdapter<T> getComponentAdapterOfType(Class<T> componentType)
getComponentAdapterOfType(Class, boolean) with true for the parameter
autoRegistration
componentType - the type of the component.
null if no component has been
registered for the specified key.
public <T> ComponentAdapter<T> getComponentAdapterOfType(Class<T> componentType,
boolean autoRegistration)
DefinitionByType if the parameter
autoRegistration has been set to true.
getComponentAdapterOfType in interface ContainergetComponentAdapterOfType in class AbstractContainercomponentType - 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 <T> T getComponentInstance(Object componentKey,
Class<T> bindType)
getComponentInstance(Object, Class, boolean) with true for the parameter
autoRegistration
componentKey - the key that the component was registered with.bindType - the expected type of the instance if one can be found.
null if no component has been registered for the specified
key.
public <T> T getComponentInstance(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
autoRegistration has been set to true, it will try to auto register the
component according to the content of:
DefinitionByType if the componentKey is a
classDefinitionByName if the componentKey is a
stringDefinitionByQualifier if the componentKey
is a qualifier
getComponentInstance in interface ContainergetComponentInstance in class AbstractContainercomponentKey - 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> ComponentAdapter<T> getComponentAdapter(Object componentKey,
Class<T> bindType)
getComponentAdapter(Object, Class, boolean) with true for the parameter
autoRegistration
componentKey - the key that the component was registered with.bindType - the expected raw type of the adapter if one can be found.
null if no component has been registered
for the specified key.
public <T> ComponentAdapter<T> getComponentAdapter(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
autoRegistration has been set to true, it will try to auto
register the component according to the content of:
DefinitionByType if the componentKey is a
classDefinitionByName if the componentKey is a
stringDefinitionByQualifier if the componentKey
is a qualifier
getComponentAdapter in interface ContainergetComponentAdapter in class AbstractContainercomponentKey - 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.
|
eXo Kernel :: Container 2.5.0-GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||