Package org.exoplatform.container
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.- Since:
- Jan 11, 2005
- Version:
- $Id: ExoContainerContext.java 6677 2006-07-03 10:49:59Z geaz $
- Author:
- Tuan Nguyen (tuan08@users.sourceforge.net)
- See Also:
- Serialized Form
- eXo level API
- Platform
-
-
Constructor Summary
Constructors Constructor Description ExoContainerContext(ExoContainer container)ExoContainerContext(ExoContainer container, String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetAttribute(String name)Set<String>getAttributeNames()ExoContainergetContainer()static ExoContainergetContainerByName(String name)static ExoContainergetCurrentContainer()static ExoContainergetCurrentContainerIfPresent()StringgetName()StringgetPortalContainerName()StringgetRealmName()StringgetRestContextName()static <T> TgetService(Class<T> clazz)Gets a service from current container.static <T> TgetService(Class<T> clazz, String containerName)Gets the service.ObjectgetSetting(String settingName)static ExoContainergetTopContainer()voidsetAttribute(String name, Object value)static voidsetCurrentContainer(ExoContainer instance)Sets the current containervoidsetName(String name)sets the name of the container name
-
-
-
Constructor Detail
-
ExoContainerContext
public ExoContainerContext(ExoContainer container)
-
ExoContainerContext
public ExoContainerContext(ExoContainer container, String name)
-
-
Method Detail
-
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 returnnull
-
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 returnnull
-
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
-
setAttribute
public void setAttribute(String name, Object value)
- Parameters:
name- the name of the attribute to setvalue- 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
-
-