Package org.exoplatform.container
Class PortalContainer
java.lang.Object
org.exoplatform.container.AbstractContainer
org.exoplatform.container.ExoContainer
org.exoplatform.container.PortalContainer
- All Implemented Interfaces:
Serializable,Container,Disposable,Startable
Created by The eXo Platform SAS
The Portal Container is an object responsible for loading services/components.
The Portal Container is an object responsible for loading services/components.
- Author:
- Mestrallet Benjamin Date: Jul 31, 2003 Time: 12:15:28 AM
- See Also:
- eXo level API
- Provisional
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class is used to register a portal containerstatic classThis class is used to unregister a portal container -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringThe default name of the portal containerstatic StringThe default name of a the realmstatic StringThe default name of a theServletContextof the rest web applicationFields inherited from class org.exoplatform.container.ExoContainer
context, LOG, parent, stoppingFields inherited from class org.exoplatform.container.AbstractContainer
delegate -
Constructor Summary
ConstructorsConstructorDescriptionPortalContainer(RootContainer parent, javax.servlet.ServletContext portalContext) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddInitTask(javax.servlet.ServletContext context, RootContainer.PortalContainerInitTask task) Add an init-task to all the portal container instances related to the given ServletContextstatic voidaddInitTask(javax.servlet.ServletContext context, RootContainer.PortalContainerInitTask task, String portalContainerName) Add an init-task to all the portal container instances related to the given ServletContext if the given portal container name isnullother it will execute the task only of this portal container if theServletContextis on of its dependenciesstatic ObjectgetComponent(Class<?> key) static PortalContainergetCurrentInstance(javax.servlet.ServletContext context) We first try to get the ExoContainer that has been stored into the ThreadLocal if the value is of type PortalContainer, we return it otherwise we get the portal container corresponding the given servlet contextstatic StringReturns the name of the current portal container that has been stored into the ThreadLocal.static StringReturns the name of the current realm corresponding to the portal container that has been stored into the ThreadLocal.static StringReturns the name of the current rest context corresponding to the portal container that has been stored into the ThreadLocal.static ObjectgetCurrentSetting(String settingName) Returns the current value of the setting corresponding to the portal container that has been stored into the ThreadLocal.static PortalContainerstatic PortalContainergetInstance(javax.servlet.ServletContext context) Gives the first portal container instance related to the given ServletContextstatic PortalContainergetName()javax.servlet.ServletContextReturns the name of the realm corresponding to the current portal containerstatic StringgetRealmName(String portalContainerName) Returns the name of the realm corresponding to the given portal container nameReturns the name of the rest context corresponding to the current portal containerstatic StringgetRestContextName(String portalContainerName) Returns the name of the rest context corresponding to the given portal container namegetSetting(String settingName) Returns the value of the setting corresponding to the current portal containerstatic ObjectgetSetting(String portalContainerName, String settingName) Returns the value of the setting corresponding to the given portal container name and the given setting namegetWebAppClassLoader(javax.servlet.ServletContext context) This gives the mergedClassLoaderbetween thePortalContainerClassLoaderand theClassLoaderof the web application.static booleanisPortalContainerName(String name) static booleanstatic booleanisScopeValid(PortalContainer container, javax.servlet.ServletContext context) Indicates if the given servlet context is a dependency of the given portal containerbooleanvoidregisterContext(javax.servlet.ServletContext context) Register a new servlet context that contains configuration files and potentially resource files We assume that this method is called within the initialization context of the related web applicationstatic voidsetInstance(PortalContainer instance) voidstart()Start this component.voidstop()Stop this component.voidunregisterContext(javax.servlet.ServletContext context) Unregister a servlet context that contains configuration files and potentially resource filesMethods inherited from class org.exoplatform.container.ExoContainer
addComponentLifecylePlugin, addContainerLifecylePlugin, canBeDisposed, canBeInitialized, canBeStarted, canBeStopped, createComponent, dispose, getComponentAdapter, getComponentAdapter, getComponentAdapter, getComponentAdapterOfType, getComponentAdapterOfType, getComponentInstance, getComponentInstance, getComponentInstance, getComponentInstanceOfType, getComponentInstanceOfType, getConfiguration, getContext, getContextManager, getExternalComponentPluginsUnused, getParent, getProfiles, getProfilesFromProperty, getRegisteredComponentNames, hasProfile, hasProfileInProperty, initContainerInternal, initialize, isContextManagerLoaded, registerComponentImplementation, registerComponentInstance, start, unregisterAllComponentsMethods inherited from class org.exoplatform.container.AbstractContainer
accept, createComponent, getComponentAdapters, getComponentAdaptersOfType, getComponentInstancesOfType, getManagementContext, getMBeanServer, getScopingObjectName, getSuccessor, registerComponentImplementation, registerComponentInstance, unregisterComponent
-
Field Details
-
DEFAULT_PORTAL_CONTAINER_NAME
The default name of the portal container -
DEFAULT_REST_CONTEXT_NAME
The default name of a theServletContextof the rest web application -
DEFAULT_REALM_NAME
The default name of a the realm
-
-
Constructor Details
-
PortalContainer
-
-
Method Details
-
getWebAppClassLoader
This gives the mergedClassLoaderbetween thePortalContainerClassLoaderand theClassLoaderof the web application.- Parameters:
context- theServletContextof the web application- Returns:
- the merged
ClassLoaderbetween thePortalContainerClassLoaderand theClassLoaderof the web application that allows us to override resources contained into theClassLoaderof the web application
-
getPortalClassLoader
- Returns:
- the full
ClassLoaderof the portal container after merging all theClassLoaderof allServletContextthat have been registered
-
getPortalContext
public javax.servlet.ServletContext getPortalContext()- Returns:
- the full
ServletContextof the portal container after merging all theServletContextthat have been registered
-
registerContext
public void registerContext(javax.servlet.ServletContext context) Register a new servlet context that contains configuration files and potentially resource files We assume that this method is called within the initialization context of the related web application- Parameters:
context- theServletContextof the web application to register
-
unregisterContext
public void unregisterContext(javax.servlet.ServletContext context) Unregister a servlet context that contains configuration files and potentially resource files- Parameters:
context- theServletContextof the web application to unregister
-
getName
- Returns:
- returns the portal container name
-
getConfigurationXML
- Returns:
- returns the configuration of the container in XML format
-
getPortalContainerInfo
-
getInstance
- Returns:
- the current instance of
PortalContainerthat has been stored into the relatedThreadLocal. If no value has been set the default portal container will be returned
-
getInstanceIfPresent
- Returns:
- the current instance of
ExoContainerthat has been stored into theThreadLocalofExoContainerContext. If noPortalContainerhas been set, it will returnnull
-
isPortalContainerName
- Parameters:
name- the portal container name- See Also:
-
isPortalContainerNameDisabled
- Parameters:
name- the portal container name- See Also:
-
addInitTask
public static void addInitTask(javax.servlet.ServletContext context, RootContainer.PortalContainerInitTask task) Add an init-task to all the portal container instances related to the given ServletContext- Parameters:
context- the context from which we extract the context nametask- the task to execute
-
addInitTask
public static void addInitTask(javax.servlet.ServletContext context, RootContainer.PortalContainerInitTask task, String portalContainerName) Add an init-task to all the portal container instances related to the given ServletContext if the given portal container name isnullother it will execute the task only of this portal container if theServletContextis on of its dependencies- Parameters:
context- the context from which we extract the context nametask- the task to executeportalContainerName- the name of the portal container for which we want to execute the task
-
getInstance
Gives the first portal container instance related to the given ServletContext- Parameters:
context- the context from which we extract the context name
-
getCurrentInstance
We first try to get the ExoContainer that has been stored into the ThreadLocal if the value is of type PortalContainer, we return it otherwise we get the portal container corresponding the given servlet context- Parameters:
context- the context from which we extract the portal container name
-
getCurrentPortalContainerName
Returns the name of the current portal container that has been stored into the ThreadLocal. If no value can be found the value of PortalContainer.DEFAULT_PORTAL_CONTAINER_NAME will be used -
getCurrentRestContextName
Returns the name of the current rest context corresponding to the portal container that has been stored into the ThreadLocal. If no value can be found the value of PortalContainer.DEFAULT_REST_CONTEXT_NAME will be used -
getRestContextName
Returns the name of the rest context corresponding to the given portal container name- Parameters:
portalContainerName- the name of the portal container for which we want the name of the restServletContext
-
getRestContextName
Returns the name of the rest context corresponding to the current portal container- Returns:
- returns the name of the rest context
-
getCurrentRealmName
Returns the name of the current realm corresponding to the portal container that has been stored into the ThreadLocal. If no value can be found the value of PortalContainer.DEFAULT_REALM_NAME will be used- Returns:
- returns the name of the current realm corresponding to the portal container
-
getRealmName
Returns the name of the realm corresponding to the given portal container name- Parameters:
portalContainerName- the name of the portal container for which we want the name of the realm- Returns:
- returns the name of the realm corresponding to the given portal container name
-
getRealmName
Returns the name of the realm corresponding to the current portal container- Returns:
- returns the name of the realm corresponding to the current portal container
-
getCurrentSetting
Returns the current value of the setting corresponding to the portal container that has been stored into the ThreadLocal. If no value can be found,nullwill be returned- Parameters:
settingName- the name of the setting wanted- Returns:
- returns the current value of the setting corresponding to the portal container
-
getSetting
Returns the value of the setting corresponding to the given portal container name and the given setting name- Parameters:
portalContainerName- the name of the portal container for which we want the name of the value of the settingsettingName- the name of the setting wanted- Returns:
- returns the value of the setting corresponding to the given portal container name
-
getSetting
Returns the value of the setting corresponding to the current portal container- Parameters:
settingName- the name of the setting wanted- Returns:
- returns the value of the setting
-
isScopeValid
Indicates if the given servlet context is a dependency of the given portal container- Parameters:
container- the portal containercontext- theServletContext- Returns:
trueif the dependencies matches,falseotherwise;
-
isStarted
public boolean isStarted() -
start
public void start()Description copied from class:AbstractContainerStart this component. Called initially at the begin of the lifecycle. It can be called again after a stop.- Specified by:
startin interfaceStartable- Overrides:
startin classExoContainer
-
stop
public void stop()Description copied from class:AbstractContainerStop 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 classExoContainer
-
setInstance
-
getComponent
-