Class PortalContainer

    • 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
      • 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
      • 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: AbstractContainer
        Start this component. Called initially at the begin of the lifecycle. It can be called again after a stop.
        Specified by:
        start in interface Startable
        Overrides:
        start in class ExoContainer
      • stop

        public void stop()
        Description copied from class: AbstractContainer
        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 ExoContainer
      • setInstance

        public static void setInstance​(PortalContainer instance)
      • getComponent

        public static Object getComponent​(Class<?> key)