Class ExoContainerContext

java.lang.Object
org.exoplatform.container.ExoContainerContext
All Implemented Interfaces:
Serializable

public final class ExoContainerContext extends Object implements Serializable
The ExoContainerContext helper to invoke a service of a container from any location.
See Also:
  • Constructor Details

    • ExoContainerContext

      public ExoContainerContext(ExoContainer container)
    • ExoContainerContext

      public ExoContainerContext(ExoContainer container, String name)
  • Method Details

    • getContainer

      public ExoContainer getContainer()
    • getPortalContainerName

      public String getPortalContainerName()
      Returns:
      if the embedded container is a PortalContainer, it will return the name the portal container otherwise it will return null
    • getRestContextName

      public String getRestContextName()
      Returns:
      if the embedded container is a PortalContainer, it will return the name of the rest context related to the portal container otherwise it will return the default name
    • getRealmName

      public String getRealmName()
      Returns:
      if the embedded container is a PortalContainer, it will return the name of the realm related to the portal container otherwise it will return the default name
    • getSetting

      public Object getSetting(String settingName)
      Returns:
      if the embedded container is a PortalContainer, it will return the value of the setting related to the portal container otherwise it will return null
    • getName

      public String getName()
      Returns:
      returns the container name
    • setName

      public void setName(String name)
      sets the name of the container name
      Parameters:
      name - the container name
    • getTopContainer

      public static ExoContainer getTopContainer()
      Returns:
      returns the top container that will be the root container in portal mode and the standalone container in standalone mode
    • getCurrentContainer

      public static ExoContainer getCurrentContainer()
      Returns:
      returns the current container
    • getCurrentContainerIfPresent

      public static ExoContainer getCurrentContainerIfPresent()
      Returns:
      returns the current container if present, otherwise it returns the top container
    • setCurrentContainer

      public static void setCurrentContainer(ExoContainer instance)
      Sets the current container
      Parameters:
      instance - the current container
    • getContainerByName

      public static ExoContainer getContainerByName(String name)
      Parameters:
      name - the container name
      Returns:
      the ExoContainer instance
    • getAttributeNames

      public Set<String> getAttributeNames()
      Returns:
      returns the list of the name of all the attributes available in the context
    • getAttribute

      public Object getAttribute(String name)
      Returns:
      returns the value of the attribute
    • setAttribute

      public void setAttribute(String name, Object value)
      Parameters:
      name - the name of the attribute to set
      value - the value of the attribute to set
    • getService

      public static <T> T getService(Class<T> clazz)
      Gets a service from current container.
      Parameters:
      clazz - the clazz
      Returns:
      the service
    • getService

      public static <T> T getService(Class<T> clazz, String containerName)
      Gets the service.
      Parameters:
      clazz - the class
      containerName - the container's name
      Returns:
      the service