eXo Kernel :: Container 2.4.11-UXP01

org.exoplatform.container
Class PortalContainer

java.lang.Object
  extended by org.exoplatform.container.ConcurrentPicoContainer
      extended by org.exoplatform.container.mc.MCIntegrationContainer
          extended by org.exoplatform.container.CachingContainer
              extended by org.exoplatform.container.TenantsContainer
                  extended by org.exoplatform.container.management.ManageableContainer
                      extended by org.exoplatform.container.ExoContainer
                          extended by org.exoplatform.container.PortalContainer
All Implemented Interfaces:
Serializable, SessionManagerContainer, org.picocontainer.Disposable, org.picocontainer.MutablePicoContainer, org.picocontainer.PicoContainer, org.picocontainer.Startable

public class PortalContainer
extends ExoContainer
implements SessionManagerContainer

Created by The eXo Platform SAS
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:
Serialized Form

Nested Class Summary
static class PortalContainer.RegisterTask
          This class is used to register a portal container
static class PortalContainer.UnregisterTask
          This class is used to unregister a portal container
 
Nested classes/interfaces inherited from class org.exoplatform.container.ConcurrentPicoContainer
ConcurrentPicoContainer.ContainerVisitor
 
Field Summary
static String DEFAULT_PORTAL_CONTAINER_NAME
          The default name of the portal container
static String DEFAULT_REALM_NAME
          The default name of a the realm
static String DEFAULT_REST_CONTEXT_NAME
          The default name of a the ServletContext of the rest web application
 
Fields inherited from class org.exoplatform.container.ExoContainer
context, LOG, parent, stopping
 
Fields inherited from class org.exoplatform.container.TenantsContainer
tenantsContainerContext
 
Fields inherited from class org.exoplatform.container.ConcurrentPicoContainer
componentAdapterFactory
 
Constructor Summary
PortalContainer(RootContainer parent, javax.servlet.ServletContext portalContext)
           
 
Method Summary
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
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 is null other it will execute the task only of this portal container if the ServletContext is on of its dependencies
 SessionContainer createSessionContainer(String id, String owner)
           
static Object getComponent(Class key)
           
 String getConfigurationXML()
           
static PortalContainer getCurrentInstance(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 context
static String getCurrentPortalContainerName()
          Returns the name of the current portal container that has been stored into the ThreadLocal.
static String getCurrentRealmName()
          Returns the name of the current realm corresponding to the portal container that has been stored into the ThreadLocal.
static String getCurrentRestContextName()
          Returns the name of the current rest context corresponding to the portal container that has been stored into the ThreadLocal.
static Object getCurrentSetting(String settingName)
          Returns the current value of the setting corresponding to the portal container that has been stored into the ThreadLocal.
static PortalContainer getInstance()
           
static PortalContainer getInstance(javax.servlet.ServletContext context)
          Gives the first portal container instance related to the given ServletContext
static PortalContainer getInstanceIfPresent()
           
 List<SessionContainer> getLiveSessions()
           
 String getName()
           
 ClassLoader getPortalClassLoader()
           
 PortalContainerInfo getPortalContainerInfo()
           
 javax.servlet.ServletContext getPortalContext()
           
 String getRealmName()
          Returns the name of the realm corresponding to the current portal container
static String getRealmName(String portalContainerName)
          Returns the name of the realm corresponding to the given portal container name
 String getRestContextName()
          Returns the name of the rest context corresponding to the current portal container
static String getRestContextName(String portalContainerName)
          Returns the name of the rest context corresponding to the given portal container name
 SessionManager getSessionManager()
           
 Object getSetting(String settingName)
          Returns the value of the setting corresponding to the current portal container
static Object getSetting(String portalContainerName, String settingName)
          Returns the value of the setting corresponding to the given portal container name and the given setting name
 ClassLoader getWebAppClassLoader(javax.servlet.ServletContext context)
          This gives the merged ClassLoader between the PortalContainerClassLoader and the ClassLoader of the web application.
static boolean isPortalContainerName(String name)
           
static boolean isPortalContainerNameDisabled(String name)
           
static boolean isScopeValid(PortalContainer container, javax.servlet.ServletContext context)
          Indicates if the given servlet context is a dependency of the given portal container
 boolean isStarted()
           
 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
 void removeSessionContainer(String sessionID)
           
static void setInstance(PortalContainer instance)
           
 void start()
          Start the components of this PicoContainer and all its logical child containers.
 void stop()
          Stop the components of this PicoContainer and all its logical child containers.
 void unregisterContext(javax.servlet.ServletContext context)
          Unregister a servlet context that contains configuration files and potentially resource files
 
Methods inherited from class org.exoplatform.container.ExoContainer
addComponentLifecylePlugin, addContainerLifecylePlugin, createComponent, createComponent, destroyContainer, dispose, getConfiguration, getContext, getProfiles, hasProfile, initContainer, start, startContainer, stopContainer, unregisterAllComponents
 
Methods inherited from class org.exoplatform.container.management.ManageableContainer
getManagementContext, getMBeanServer, getRegisteredComponentNames, getScopingObjectName, registerComponentInstance, unregisterComponent
 
Methods inherited from class org.exoplatform.container.TenantsContainer
getComponentAdapterOfType, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstancesOfType, registerComponent
 
Methods inherited from class org.exoplatform.container.CachingContainer
registerComponentImplementation, registerComponentImplementation, registerComponentImplementation, registerComponentImplementation, registerComponentInstance
 
Methods inherited from class org.exoplatform.container.mc.MCIntegrationContainer
hasMCKernel
 
Methods inherited from class org.exoplatform.container.ConcurrentPicoContainer
accept, accept, addChildContainer, addComponentToCtx, canBeDisposed, canBeStarted, canBeStopped, getComponentAdapter, getComponentAdapters, getComponentInstances, getParent, makeChildContainer, removeChildContainer, removeComponentFromCtx, unregisterComponentByInstance, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORTAL_CONTAINER_NAME

public static String DEFAULT_PORTAL_CONTAINER_NAME
The default name of the portal container


DEFAULT_REST_CONTEXT_NAME

public static String DEFAULT_REST_CONTEXT_NAME
The default name of a the ServletContext of the rest web application


DEFAULT_REALM_NAME

public static String DEFAULT_REALM_NAME
The default name of a the realm

Constructor Detail

PortalContainer

public PortalContainer(RootContainer parent,
                       javax.servlet.ServletContext portalContext)
Method Detail

getWebAppClassLoader

public ClassLoader getWebAppClassLoader(javax.servlet.ServletContext context)
This gives the merged ClassLoader between the PortalContainerClassLoader and the ClassLoader of the web application.

Parameters:
context - the ServletContext of the web application
Returns:
the merged ClassLoader between the PortalContainerClassLoader and the ClassLoader of the web application that allows us to override resources contained into the ClassLoader of the web application

getPortalClassLoader

public ClassLoader getPortalClassLoader()
Returns:
the full ClassLoader of the portal container after merging all the ClassLoader of all ServletContext that have been registered

getPortalContext

public javax.servlet.ServletContext getPortalContext()
Returns:
the full ServletContext of the portal container after merging all the ServletContext that 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 - the ServletContext of 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 - the ServletContext of the web application to unregister

getName

public String getName()
Returns:
returns the portal container name

getConfigurationXML

public String getConfigurationXML()
Returns:
returns the configuration of the container in XML format

createSessionContainer

public SessionContainer createSessionContainer(String id,
                                               String owner)
Specified by:
createSessionContainer in interface SessionManagerContainer
Parameters:
id - the session container identifier
owner - the owner name

removeSessionContainer

public void removeSessionContainer(String sessionID)
Specified by:
removeSessionContainer in interface SessionManagerContainer
Parameters:
sessionID - the identifier of session to remove

getLiveSessions

public List<SessionContainer> getLiveSessions()
Specified by:
getLiveSessions in interface SessionManagerContainer
Returns:
returns a collection containing all the live sessions

getSessionManager

public SessionManager getSessionManager()
Specified by:
getSessionManager in interface SessionManagerContainer
Returns:
returns session manager

getPortalContainerInfo

public PortalContainerInfo getPortalContainerInfo()

getInstance

public static PortalContainer getInstance()
Returns:
the current instance of PortalContainer that has been stored into the related ThreadLocal. If no value has been set the default portal container will be returned

getInstanceIfPresent

public static PortalContainer getInstanceIfPresent()
Returns:
the current instance of ExoContainer that has been stored into the ThreadLocal of ExoContainerContext. If no PortalContainer has been set, it will return null

isPortalContainerName

public static boolean isPortalContainerName(String name)
Parameters:
name - the portal container name
See Also:
PortalContainerConfig.isPortalContainerName(String)

isPortalContainerNameDisabled

public static boolean isPortalContainerNameDisabled(String name)
Parameters:
name - the portal container name
See Also:
PortalContainerConfig.isPortalContainerNameDisabled(String)

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 name
task - 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 is null other it will execute the task only of this portal container if the ServletContext is on of its dependencies

Parameters:
context - the context from which we extract the context name
task - the task to execute
portalContainerName - the name of the portal container for which we want to execute the task

getInstance

public static PortalContainer getInstance(javax.servlet.ServletContext context)
Gives the first portal container instance related to the given ServletContext

Parameters:
context - the context from which we extract the context name

getCurrentInstance

public static PortalContainer getCurrentInstance(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 context

Parameters:
context - the context from which we extract the portal container name

getCurrentPortalContainerName

public static String 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

public static String 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

public static String getRestContextName(String portalContainerName)
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 rest ServletContext

getRestContextName

public String getRestContextName()
Returns the name of the rest context corresponding to the current portal container

Returns:
returns the name of the rest context

getCurrentRealmName

public static String 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

public static String getRealmName(String portalContainerName)
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

public String 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

public static Object getCurrentSetting(String settingName)
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, null will be returned

Parameters:
settingName - the name of the setting wanted
Returns:
returns the current value of the setting corresponding to the portal container

getSetting

public static Object getSetting(String portalContainerName,
                                String settingName)
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 setting
settingName - the name of the setting wanted
Returns:
returns the value of the setting corresponding to the given portal container name

getSetting

public Object getSetting(String settingName)
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

public static boolean isScopeValid(PortalContainer container,
                                   javax.servlet.ServletContext context)
Indicates if the given servlet context is a dependency of the given portal container

Parameters:
container - the portal container
context - the ServletContext
Returns:
true if the dependencies matches, false otherwise;

isStarted

public boolean isStarted()

start

public void start()
Description copied from class: ConcurrentPicoContainer
Start the components of this PicoContainer and all its logical child containers. Any component implementing the lifecycle interface Startable will be started.

Specified by:
start in interface org.picocontainer.Startable
Overrides:
start in class ExoContainer
See Also:
ConcurrentPicoContainer.makeChildContainer(), ConcurrentPicoContainer.addChildContainer(PicoContainer), ConcurrentPicoContainer.removeChildContainer(PicoContainer)

stop

public void stop()
Description copied from class: ConcurrentPicoContainer
Stop the components of this PicoContainer and all its logical child containers. Any component implementing the lifecycle interface Startable will be stopped.

Specified by:
stop in interface org.picocontainer.Startable
Overrides:
stop in class ExoContainer
See Also:
ConcurrentPicoContainer.makeChildContainer(), ConcurrentPicoContainer.addChildContainer(PicoContainer), ConcurrentPicoContainer.removeChildContainer(PicoContainer)

setInstance

public static void setInstance(PortalContainer instance)

getComponent

public static Object getComponent(Class key)

eXo Kernel :: Container 2.4.11-UXP01

Copyright © 2014 eXo Platform SAS. All Rights Reserved.