Author: nfilotto
Date: 2010-03-04 12:40:20 -0500 (Thu, 04 Mar 2010)
New Revision: 2010
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/default-settings.properties
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-default-portal-def.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-empty-default-portal-def.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/default-settings.properties
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Deserializer.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties
Log:
EXOJCR-565: Allow to define a default portal container definition
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
---
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-03-04
15:11:28 UTC (rev 2009)
+++
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-03-04
17:40:20 UTC (rev 2010)
@@ -19,12 +19,14 @@
package org.exoplatform.container.definition;
import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.PropertyConfigurator;
import org.exoplatform.container.RootContainer;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.monitor.jvm.J2EEServerInfo;
import org.exoplatform.container.util.ContainerUtil;
import org.exoplatform.container.xml.Deserializer;
import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ObjectParameter;
import org.exoplatform.container.xml.ValueParam;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -36,6 +38,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -76,34 +79,27 @@
/**
* The default name of a portal container
*/
- public static final String DEFAULT_PORTAL_CONTAINER_NAME = "portal";
+ // We use new String to create a new object in order to use the operator ==
+ public static final String DEFAULT_PORTAL_CONTAINER_NAME = new
String("portal");
/**
* The default name of a the {@link ServletContext} of the rest web application
*/
- public static final String DEFAULT_REST_CONTEXT_NAME = "rest";
+ // We use new String to create a new object in order to use the operator ==
+ public static final String DEFAULT_REST_CONTEXT_NAME = new String("rest");
/**
* The default realm name
*/
- public static final String DEFAULT_REALM_NAME = "exo-domain";
+ // We use new String to create a new object in order to use the operator ==
+ public static final String DEFAULT_REALM_NAME = new String("exo-domain");
/**
- * The name of the default portal container
+ * The default {@link PortalContainerDefinition}
*/
- private String defaultPortalContainerName;
+ private final PortalContainerDefinition defaultDefinition;
/**
- * The name of the default rest {@link ServletContext}
- */
- private String defaultRestContextName;
-
- /**
- * The name of the default realm
- */
- private String defaultRealmName;
-
- /**
* Indicates if the component has already been initialized
*/
private volatile boolean initialized;
@@ -134,47 +130,189 @@
*/
private final J2EEServerInfo serverInfo;
+ /**
+ * Indicates if new system properties have been added
+ */
+ private final PropertyConfigurator pc;
+
public PortalContainerConfig(ConfigurationManager cm)
{
- this(null, cm, new J2EEServerInfo());
+ this(null, cm, new J2EEServerInfo(), null);
}
+ public PortalContainerConfig(ConfigurationManager cm, PropertyConfigurator pc)
+ {
+ this(null, cm, new J2EEServerInfo(), pc);
+ }
+
public PortalContainerConfig(ConfigurationManager cm, J2EEServerInfo serverInfo)
{
- this(null, cm, serverInfo);
+ this(null, cm, serverInfo, null);
}
+ public PortalContainerConfig(ConfigurationManager cm, J2EEServerInfo serverInfo,
PropertyConfigurator pc)
+ {
+ this(null, cm, serverInfo, pc);
+ }
+
+ public PortalContainerConfig(InitParams params, ConfigurationManager cm)
+ {
+ this(params, cm, new J2EEServerInfo(), null);
+ }
+
+ public PortalContainerConfig(InitParams params, ConfigurationManager cm,
PropertyConfigurator pc)
+ {
+ this(params, cm, new J2EEServerInfo(), pc);
+ }
+
public PortalContainerConfig(InitParams params, ConfigurationManager cm,
J2EEServerInfo serverInfo)
{
+ this(params, cm, serverInfo, null);
+ }
+
+ /**
+ * We add the {@link PropertyConfigurator} in the constructor, in order to make sure
that it is
+ * created before since it could define some JVM parameters that could be used
internally by the
+ * {@link PortalContainerConfig}
+ */
+ public PortalContainerConfig(InitParams params, ConfigurationManager cm,
J2EEServerInfo serverInfo,
+ PropertyConfigurator pc)
+ {
+ this.pc = pc;
this.cm = cm;
this.serverInfo = serverInfo;
- if (params == null)
+ this.defaultDefinition = create(params);
+ }
+
+ /**
+ * Create the default {@link PortalContainerDefinition} corresponding to the given
parameters
+ * @param params the parameter to initialize
+ */
+ private PortalContainerDefinition create(InitParams params)
+ {
+ ObjectParameter oDpd = null;
+ if (params != null)
{
- return;
+ oDpd = params.getObjectParam("default.portal.definition");
}
- final ValueParam vDpc =
params.getValueParam("default.portal.container");
- if (vDpc != null && vDpc.getValue().trim().length() > 0)
+ PortalContainerDefinition def = null;
+ if (oDpd != null)
{
- this.defaultPortalContainerName = vDpc.getValue().trim();
+ // A default portal definition has been found
+ final Object o = oDpd.getObject();
+ if (o instanceof PortalContainerDefinition)
+ {
+ // The nested object is of the right type
+ def = (PortalContainerDefinition)o;
+ }
+ else
+ {
+ // The nested object is not of the right type, thus it will be ignored
+ log.warn("The object parameter 'default.portal.definition'
should be of type "
+ + PortalContainerDefinition.class);
+ }
}
- final ValueParam vRc = params.getValueParam("default.rest.context");
- if (vRc != null && vRc.getValue().trim().length() > 0)
+ if (def == null)
{
- this.defaultRestContextName = vRc.getValue().trim();
+ def = new PortalContainerDefinition();
}
- final ValueParam vRn = params.getValueParam("default.realm.name");
- if (vRn != null && vRn.getValue().trim().length() > 0)
+ initName(params, def);
+ initRestContextName(params, def);
+ initRealmName(params, def);
+ initializeSettings(def, false);
+ return def;
+ }
+
+ /**
+ * Initialize the value of the realm name
+ */
+ private void initRealmName(InitParams params, PortalContainerDefinition def)
+ {
+ if (def.getRealmName() == null || def.getRealmName().trim().length() == 0)
{
- this.defaultRealmName = vRn.getValue().trim();
+ // The realm name is empty
+ // We first set the default value
+ def.setRealmName(DEFAULT_REALM_NAME);
+ if (params == null)
+ {
+ return;
+ }
+ final ValueParam vp = params.getValueParam("default.realm.name");
+ if (vp != null && vp.getValue().trim().length() > 0)
+ {
+ // A realm name has been defined in the value parameter, thus we use it
+ def.setRealmName(vp.getValue().trim());
+ }
}
+ else
+ {
+ // We ensure that the realm name doesn't contain any useless characters
+ def.setRealmName(def.getRealmName().trim());
+ }
}
/**
+ * Initialize the value of the rest context name
+ */
+ private void initRestContextName(InitParams params, PortalContainerDefinition def)
+ {
+ if (def.getRestContextName() == null || def.getRestContextName().trim().length() ==
0)
+ {
+ // The rest context name is empty
+ // We first set the default value
+ def.setRestContextName(DEFAULT_REST_CONTEXT_NAME);
+ if (params == null)
+ {
+ return;
+ }
+ final ValueParam vp = params.getValueParam("default.rest.context");
+ if (vp != null && vp.getValue().trim().length() > 0)
+ {
+ // A rest context name has been defined in the value parameter, thus we use
it
+ def.setRestContextName(vp.getValue().trim());
+ }
+ }
+ else
+ {
+ // We ensure that the rest context name doesn't contain any useless
characters
+ def.setRestContextName(def.getRestContextName().trim());
+ }
+ }
+
+ /**
+ * Initialize the value of the portal container name
+ */
+ private void initName(InitParams params, PortalContainerDefinition def)
+ {
+ if (def.getName() == null || def.getName().trim().length() == 0)
+ {
+ // The name is empty
+ // We first set the default value
+ def.setName(DEFAULT_PORTAL_CONTAINER_NAME);
+ if (params == null)
+ {
+ return;
+ }
+ final ValueParam vp =
params.getValueParam("default.portal.container");
+ if (vp != null && vp.getValue().trim().length() > 0)
+ {
+ // A name has been defined in the value parameter, thus we use it
+ def.setName(vp.getValue().trim());
+ }
+ }
+ else
+ {
+ // We ensure that the name doesn't contain any useless characters
+ def.setName(def.getName().trim());
+ }
+ }
+
+ /**
* @return the default name of the portal container
*/
public String getDefaultPortalContainer()
{
- return defaultPortalContainerName;
+ return defaultDefinition.getName();
}
/**
@@ -182,7 +320,7 @@
*/
public String getDefaultRestContext()
{
- return defaultRestContextName;
+ return defaultDefinition.getRestContextName();
}
/**
@@ -190,7 +328,7 @@
*/
public String getDefaultRealmName()
{
- return defaultRealmName;
+ return defaultDefinition.getRealmName();
}
/**
@@ -259,7 +397,7 @@
{
// we assume the old behavior is expected
final String portalContainerName =
- portalContainerNames.contains(contextName) ? contextName :
defaultPortalContainerName;
+ portalContainerNames.contains(contextName) ? contextName :
defaultDefinition.getName();
return Collections.singletonList(portalContainerName);
}
return result;
@@ -286,7 +424,7 @@
if (result == null || result.isEmpty())
{
// we assume the old behavior is expected
- return defaultPortalContainerName;
+ return defaultDefinition.getName();
}
return result.get(0);
}
@@ -299,7 +437,12 @@
public List<String> getDependencies(String portalContainerName)
{
final PortalContainerDefinition definition = definitions.get(portalContainerName);
- return definition == null ? null : definition.getDependencies();
+ List<String> result = null;
+ if (definition != null)
+ {
+ result = definition.getDependencies();
+ }
+ return result == null ? defaultDefinition.getDependencies() : result;
}
/**
@@ -316,31 +459,35 @@
throw new IllegalArgumentException("The setting name cannot be
null");
}
final PortalContainerDefinition definition = definitions.get(portalContainerName);
- if (definition == null)
+ if (definition != null)
{
- return null;
+ final Map<String, Object> settings = definition.getSettings();
+ if (settings != null)
+ {
+ return settings.get(settingName);
+ }
}
- final Map<String, Object> settings = definition.getSettings();
- return settings == null ? null : settings.get(settingName);
+ final Map<String, Object> defaultSettings = defaultDefinition.getSettings();
+ return defaultSettings == null ? null : defaultSettings.get(settingName);
}
/**
* Gives the name of the rest {@link ServletContext} related to the given portal
container
* @param portalContainerName the name of the portal container for which we want the
rest context name
* @return the name of the related rest context name. It tries to get it from the
{@link PortalContainerDefinition}
- * if it has not been set it will return
<code>defaultRestContextName</code>
+ * if it has not been set it will return
<code>defaultDefinition.getRestContextName()</code>
*/
public String getRestContextName(String portalContainerName)
{
final PortalContainerDefinition definition = definitions.get(portalContainerName);
if (definition == null)
{
- return defaultRestContextName;
+ return defaultDefinition.getRestContextName();
}
else
{
String contextName = definition.getRestContextName();
- return contextName == null ? defaultRestContextName : contextName;
+ return contextName == null ? defaultDefinition.getRestContextName() :
contextName;
}
}
@@ -348,19 +495,19 @@
* Gives the name of the realm related to the given portal container
* @param portalContainerName the name of the portal container for which we want the
realm name
* @return the name of the related realm name. It tries to get it from the {@link
PortalContainerDefinition}
- * if it has not been set it will return <code>defaultRealmName</code>
+ * if it has not been set it will return
<code>defaultDefinition.getRealmName()</code>
*/
public String getRealmName(String portalContainerName)
{
final PortalContainerDefinition definition = definitions.get(portalContainerName);
if (definition == null)
{
- return defaultRealmName;
+ return defaultDefinition.getRealmName();
}
else
{
String realmName = definition.getRealmName();
- return realmName == null ? defaultRealmName : realmName;
+ return realmName == null ? defaultDefinition.getRealmName() : realmName;
}
}
@@ -406,7 +553,7 @@
String name = def.getName();
if (name == null || (name = name.trim()).length() == 0)
{
- log.warn("A PortalContainerDefinition cannot have empty
name");
+ log.warn("A PortalContainerDefinition cannot have an empty
name");
continue;
}
else
@@ -429,10 +576,15 @@
*/
private void registerDependencies(PortalContainerDefinition definition, Map<String,
List<String>> scopes)
{
- final List<String> dependencies = definition.getDependencies();
+ List<String> dependencies = definition.getDependencies();
if (dependencies == null || dependencies.isEmpty())
{
- return;
+ // Try to get the default dependencies
+ dependencies = defaultDefinition.getDependencies();
+ if (dependencies == null || dependencies.isEmpty())
+ {
+ return;
+ }
}
for (String context : dependencies)
{
@@ -467,25 +619,38 @@
* portal container name, the realm name and the rest context name.
* @param def the {@link PortalContainerDefinition} from which we have the extract the
* settings and in which we have to re-inject the final settings
+ * @param addDefaultSettings indicates whether the settings of the default portal
+ * container definition has to be loaded first
*/
- private void initializeSettings(PortalContainerDefinition def)
+ private void initializeSettings(PortalContainerDefinition def, boolean
addDefaultSettings)
{
+ // The list of portal container definition for which we want to load the settings
+ final PortalContainerDefinition[] defs;
+ if (addDefaultSettings)
+ {
+ // We need to load the default settings then the settings of the current portal
+ // container definition
+ defs = new PortalContainerDefinition[]{defaultDefinition, def};
+ }
+ else
+ {
+ // We only need to load the settings of the current portal container definition
+ defs = new PortalContainerDefinition[]{def};
+ }
final Map<String, Object> settings = new HashMap<String, Object>();
- // We first load the settings of the PortalContainerDefinition if they exist
- final Map<String, Object> tmpSettings = def.getSettings();
- if (tmpSettings != null && !tmpSettings.isEmpty())
+ loadInternalSettings(defs, settings);
+ if (pc != null)
{
- settings.putAll(tmpSettings);
+ resolveInternalSettings(settings);
}
- // We then load the external settings, if they exists
- String path = def.getExternalSettingsPath();
- if (path != null && (path = path.trim()).length() > 0)
+
+ final Map<String, String> externalSettings = new LinkedHashMap<String,
String>();
+ loadExternalSettings(def, defs, externalSettings);
+ if (!externalSettings.isEmpty())
{
- final Map<String, String> props = loadExternalSettings(path, def);
- if (props != null && !props.isEmpty())
- {
- mergeSettings(settings, props);
- }
+ resolveExternalSettings(def, settings, externalSettings);
+ // Merge the settings
+ mergeSettings(settings, externalSettings);
}
// We then add the main settings
settings.putAll(getMainSettings(def));
@@ -494,6 +659,86 @@
}
/**
+ * Creates a context from the internal settings, external settings and the main
settings and
+ * try to resolve variables defined in the external settings
+ */
+ private void resolveExternalSettings(PortalContainerDefinition def, final
Map<String, Object> settings,
+ final Map<String, String> externalSettings)
+ {
+ // Create the context for variable resolution
+ final Map<String, Object> ctx = new LinkedHashMap<String, Object>();
+ ctx.putAll(settings);
+ ctx.putAll(externalSettings);
+ ctx.putAll(getMainSettings(def));
+ // Resolve variables
+ for (Map.Entry<String, String> entry : externalSettings.entrySet())
+ {
+ String propertyName = entry.getKey();
+ String propertyValue = entry.getValue();
+ propertyValue = Deserializer.resolveVariables(propertyValue, ctx);
+ externalSettings.put(propertyName, propertyValue);
+ }
+ }
+
+ /**
+ * Loads the external settings of all the given {@link PortalContainerDefinition}
+ */
+ private void loadExternalSettings(PortalContainerDefinition def, final
PortalContainerDefinition[] defs,
+ final Map<String, String> externalSettings)
+ {
+ for (PortalContainerDefinition pcd : defs)
+ {
+ // We then load the external settings, if they exists
+ String path = pcd.getExternalSettingsPath();
+ if (path != null && (path = path.trim()).length() > 0)
+ {
+ final Map<String, String> props =
+ loadExternalSettings(path, defaultDefinition == null || pcd ==
defaultDefinition, def);
+ if (props != null && !props.isEmpty())
+ {
+ externalSettings.putAll(props);
+ }
+ }
+ }
+ }
+
+ /**
+ * Try to resolve all the String values to ensure that there is no variables
unresolved
+ * The {@link PropertyConfigurator} cans create new system property so it could be
+ * necessary to resolve the {@link String} settings one more time
+ */
+ private void resolveInternalSettings(final Map<String, Object> settings)
+ {
+ // New System properties have been added so we will try to re-resolve the String
variables
+ for (Map.Entry<String, Object> entry : settings.entrySet())
+ {
+ String propertyName = entry.getKey();
+ Object propertyValue = entry.getValue();
+ if (propertyValue instanceof String)
+ {
+ propertyValue = Deserializer.resolveVariables((String)propertyValue);
+ settings.put(propertyName, propertyValue);
+ }
+ }
+ }
+
+ /**
+ * Loads all the internal settings related to the given array of {@link
PortalContainerDefinition}
+ */
+ private void loadInternalSettings(final PortalContainerDefinition[] defs, final
Map<String, Object> settings)
+ {
+ for (PortalContainerDefinition pcd : defs)
+ {
+ // We first load the internal settings if they exists
+ final Map<String, Object> tmpSettings = pcd.getSettings();
+ if (tmpSettings != null && !tmpSettings.isEmpty())
+ {
+ settings.putAll(tmpSettings);
+ }
+ }
+ }
+
+ /**
* This method gives the main settings such as the portal container name, the rest
context name
* and the realm name into a {@link Map}
* @param def the {@link PortalContainerDefinition} from which we extract the value of
the main
@@ -506,10 +751,11 @@
// We add the portal container name
settings.put(PORTAL_CONTAINER_SETTING_NAME, def.getName());
// We add the rest context name
- settings.put(REST_CONTEXT_SETTING_NAME, def.getRestContextName() == null ?
defaultRestContextName : def
- .getRestContextName());
+ settings.put(REST_CONTEXT_SETTING_NAME, def.getRestContextName() == null ?
defaultDefinition.getRestContextName()
+ : def.getRestContextName());
// We add the realm name
- settings.put(REALM_SETTING_NAME, def.getRealmName() == null ? defaultRealmName :
def.getRealmName());
+ settings.put(REALM_SETTING_NAME, def.getRealmName() == null ?
defaultDefinition.getRealmName() : def
+ .getRealmName());
return settings;
}
@@ -520,8 +766,12 @@
* <li>The path doesn't contain any prefix of type "classpath:",
"jar:" or "file:", we
* assume that the file could be externalized so we apply the following rules:
* <ol>
- * <li>A file exists at ${exo-conf-dir}/portal/${portalContainerName}/${path},
we
- * will load this file</li>
+ * <li>The value of the parameter <code>isPath4DefaultPCD</code> is
<code>true</code> which
+ * means that the given url comes from the default portal container definition and a
file
+ * exists at ${exo-conf-dir}/portal/${path}, we will load this file</li>
+ * <li>The value of the parameter <code>isPath4DefaultPCD</code> is
<code>false</code> which
+ * means that the given url doesn't come from the default portal container
definition and a file
+ * exists at ${exo-conf-dir}/portal/${portalContainerName}/${path}, we will load this
file</li>
* <li>No file exists at the previous path, we then assume that the path cans be
* interpreted by the {@link ConfigurationManager}</li>
* </ol>
@@ -530,10 +780,13 @@
* by the {@link ConfigurationManager}</li>
* </ol>
* @param path the path of the external settings to load
+ * @param isPath4DefaultPCD indicates if the given path comes from the default portal
+ * container definition
* @param def the {@link PortalContainerDefinition} for which we load the external
settings
* @return A {@link Map} of settings if the file could be loaded,
<code>null</code> otherwise
*/
- private Map<String, String> loadExternalSettings(String path,
PortalContainerDefinition def)
+ private Map<String, String> loadExternalSettings(String path, boolean
isPath4DefaultPCD,
+ PortalContainerDefinition def)
{
try
{
@@ -541,7 +794,9 @@
if (path.indexOf(':') == -1)
{
// We first check if the file is not in eXo configuration directory
- String fullPath = serverInfo.getExoConfigurationDirectory() +
"/portal/" + def.getName() + "/" + path;
+ String fullPath =
+ serverInfo.getExoConfigurationDirectory() + "/portal/" +
(isPath4DefaultPCD ? "" : def.getName() + "/")
+ + path;
File file = new File(fullPath);
if (file.exists())
{
@@ -555,7 +810,7 @@
url = cm.getURL(path);
}
// We load the properties from the url found
- return ContainerUtil.loadProperties(url, getMainSettings(def));
+ return ContainerUtil.loadProperties(url, false);
}
catch (Exception e)
{
@@ -667,54 +922,45 @@
*/
private void initialize(Map<String, PortalContainerDefinition> mDefinitions)
{
- if (mDefinitions.isEmpty())
- {
- // No definitions have been found, the default values will be set
- if (defaultPortalContainerName == null)
- {
- this.defaultPortalContainerName = DEFAULT_PORTAL_CONTAINER_NAME;
- }
- }
final List<String> lPortalContainerNames = new
ArrayList<String>(mDefinitions.size() + 1);
// Add the default portal container name
- if (defaultPortalContainerName != null)
- {
- lPortalContainerNames.add(defaultPortalContainerName);
- }
+ lPortalContainerNames.add(defaultDefinition.getName());
final Map<String, List<String>> mScopes = new HashMap<String,
List<String>>();
for (Map.Entry<String, PortalContainerDefinition> entry :
mDefinitions.entrySet())
{
PortalContainerDefinition definition = entry.getValue();
String name = definition.getName();
- if (!name.equals(defaultPortalContainerName))
+ boolean hasChanged = false;
+ if (!name.equals(defaultDefinition.getName()))
{
- if (defaultPortalContainerName == null)
+ if (defaultDefinition.getName() == DEFAULT_PORTAL_CONTAINER_NAME)
{
- this.defaultPortalContainerName = name;
+ defaultDefinition.setName(name);
+ hasChanged = true;
}
lPortalContainerNames.add(name);
}
- if (defaultRestContextName == null)
+ if (defaultDefinition.getRestContextName() == DEFAULT_REST_CONTEXT_NAME
+ && definition.getRestContextName() != null &&
definition.getRestContextName().trim().length() > 0)
{
- this.defaultRestContextName = definition.getRestContextName();
+
defaultDefinition.setRestContextName(definition.getRestContextName().trim());
+ hasChanged = true;
}
- if (defaultRealmName == null)
+ if (defaultDefinition.getRealmName() == DEFAULT_REALM_NAME &&
definition.getRealmName() != null
+ && definition.getRealmName().trim().length() > 0)
{
- this.defaultRealmName = definition.getRealmName();
+ defaultDefinition.setRealmName(definition.getRealmName().trim());
+ hasChanged = true;
}
registerDependencies(definition, mScopes);
- initializeSettings(definition);
+ if (hasChanged)
+ {
+ initializeSettings(defaultDefinition, false);
+ }
+ initializeSettings(definition, true);
}
this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
this.scopes = Collections.unmodifiableMap(mScopes);
- if (defaultRestContextName == null)
- {
- this.defaultRestContextName = DEFAULT_REST_CONTEXT_NAME;
- }
- if (defaultRealmName == null)
- {
- this.defaultRealmName = DEFAULT_REALM_NAME;
- }
}
/**
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java
===================================================================
---
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2010-03-04
15:11:28 UTC (rev 2009)
+++
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2010-03-04
17:40:20 UTC (rev 2010)
@@ -208,16 +208,16 @@
*/
public static Map<String, String> loadProperties(URL url)
{
- return loadProperties(url, null);
+ return loadProperties(url, true);
}
/**
* Loads the properties file corresponding to the given url
* @param url the url of the properties file
- * @param initEnv the initial environment that is composed of a set of initial
variables
+ * @param resolveVariables indicates if the variables must be resolved
* @return a {@link Map} of properties
*/
- public static Map<String, String> loadProperties(URL url, Map<String,
String> initEnv)
+ public static Map<String, String> loadProperties(URL url, boolean
resolveVariables)
{
LinkedHashMap<String, String> props = null;
String path = null;
@@ -251,15 +251,10 @@
{
log.debug("Will not load property file" + path + " because
its format is not recognized");
}
- if (props != null)
+ if (props != null && resolveVariables)
{
// Those properties are used for variables resolution
- final Map<String, String> currentProps = new
HashMap<String,String>();
- if (initEnv != null && !initEnv.isEmpty())
- {
- // There are a set of initial variables to load into the environment
- currentProps.putAll(initEnv);
- }
+ final Map<String, Object> currentProps = new HashMap<String,
Object>();
for (Map.Entry<String, String> entry : props.entrySet())
{
String propertyName = entry.getKey();
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Deserializer.java
===================================================================
---
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Deserializer.java 2010-03-04
15:11:28 UTC (rev 2009)
+++
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Deserializer.java 2010-03-04
17:40:20 UTC (rev 2010)
@@ -178,7 +178,7 @@
/**
* Resolve the variables of type ${my.var} for the current context which is composed
- * of the system properties and the portal container properties
+ * of the system properties and the portal container settings
* @param input the input value
* @return the resolve value
*/
@@ -189,12 +189,12 @@
/**
* Resolve the variables of type ${my.var} for the current context which is composed
- * of the system properties, the portal container properties and the given properties
+ * of the system properties, the portal container settings and the given settings
* @param input the input value
- * @param props a set of properties to add for the variable resolution
+ * @param props a set of parameters to add for the variable resolution
* @return the resolve value
*/
- public static String resolveVariables(String input, Map<String, String> props)
+ public static String resolveVariables(String input, Map<String, Object> props)
{
final int NORMAL = 0;
final int SEEN_DOLLAR = 1;
@@ -257,8 +257,9 @@
{
if (props != null)
{
- // Some properties have been given thus we need to check inside
first
- value = props.get(key);
+ // Some parameters have been given thus we need to check inside
first
+ Object oValue = props.get(key);
+ value = oValue == null ? null : oValue.toString();
}
if (value == null)
{
Modified:
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-03-04
15:11:28 UTC (rev 2009)
+++
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-03-04
17:40:20 UTC (rev 2010)
@@ -54,6 +54,15 @@
assertEquals("my-exo-domain", config.getDefaultRealmName());
assertFalse(config.hasDefinition());
+ rootContainer =
+
createRootContainer("portal-container-config-with-default-values-and-with-default-portal-def.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+
+ assertEquals("myPortal-dpcdef", config.getDefaultPortalContainer());
+ assertEquals("myRest-dpcdef", config.getDefaultRestContext());
+ assertEquals("my-exo-domain-dpcdef", config.getDefaultRealmName());
+ assertFalse(config.hasDefinition());
+
rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -62,6 +71,15 @@
assertEquals("my-exo-domain", config.getDefaultRealmName());
assertTrue(config.hasDefinition());
+ rootContainer =
+
createRootContainer("portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+
+ assertEquals("myPortal-dpcdef", config.getDefaultPortalContainer());
+ assertEquals("myRest-dpcdef", config.getDefaultRestContext());
+ assertEquals("my-exo-domain-dpcdef", config.getDefaultRealmName());
+ assertTrue(config.hasDefinition());
+
rootContainer =
createRootContainer("portal-container-config-with-no-default-values-but-with-portal-def.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -107,7 +125,7 @@
assertTrue(config.isScopeValid("myPortal", "foo"));
assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
assertTrue(config.hasDefinition());
-
+
// Without dependencies and with no portal container name
rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-empty-portal-def.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -135,7 +153,7 @@
assertFalse(config.isPortalContainerName("foo"));
assertTrue(config.isPortalContainerName("myPortal"));
assertFalse(config.isPortalContainerName("myPortal-pcdef"));
-
+
// Without dependencies and with no rest context name an realm name
rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-empty-portal-def2.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -168,13 +186,48 @@
assertTrue(config.isScopeValid("myPortal", "foo"));
assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
assertTrue(config.hasDefinition());
-
+
+ // Without dependencies and with default portal container definition
+ rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ List<String> deps = config.getDependencies("foo");
+ assertTrue(deps != null && deps.size() == 1 &&
deps.contains("fooX"));
+ deps = config.getDependencies("myPortal");
+ assertTrue(deps != null && deps.size() == 1 &&
deps.contains("fooX"));
+ deps = config.getDependencies("myPortal-pcdef");
+ assertTrue(deps != null && deps.size() == 1 &&
deps.contains("fooX"));
+ names = config.getPortalContainerNames("foo");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-dpcdef", names.get(0));
+ names = config.getPortalContainerNames("myPortal");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-dpcdef", names.get(0));
+ names = config.getPortalContainerNames("myPortal-pcdef");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-pcdef", names.get(0));
+ assertEquals("myPortal-dpcdef",
config.getPortalContainerName("foo"));
+ assertEquals("myPortal-dpcdef",
config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal-pcdef",
config.getPortalContainerName("myPortal-pcdef"));
+ assertEquals("myRest-dpcdef",
config.getRestContextName("foo"));
+ assertEquals("myRest-dpcdef",
config.getRestContextName("myPortal"));
+ assertEquals("myRest-pcdef",
config.getRestContextName("myPortal-pcdef"));
+ assertEquals("my-exo-domain-dpcdef",
config.getRealmName("foo"));
+ assertEquals("my-exo-domain-dpcdef",
config.getRealmName("myPortal"));
+ assertEquals("my-exo-domain-pcdef",
config.getRealmName("myPortal-pcdef"));
+ assertFalse(config.isPortalContainerName("foo"));
+ assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal-pcdef"));
+ assertFalse(config.isScopeValid("foo", "fooX"));
+ assertFalse(config.isScopeValid("myPortal", "fooX"));
+ assertTrue(config.isScopeValid("myPortal-pcdef", "fooX"));
+ assertTrue(config.hasDefinition());
+
// With dependencies
rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-portal-def2.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
assertNull(config.getDependencies("foo"));
assertNull(config.getDependencies("myPortal"));
- List<String> deps = config.getDependencies("myPortal-pcdef");
+ deps = config.getDependencies("myPortal-pcdef");
assertTrue(deps != null && deps.size() == 3);
names = config.getPortalContainerNames("foo");
assertTrue(names != null && !names.isEmpty());
@@ -201,44 +254,176 @@
assertFalse(config.isScopeValid("myPortal", "foo"));
assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
assertTrue(config.hasDefinition());
+
+ // With dependencies and with default portal container definition
+ rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ deps = config.getDependencies("foo");
+ assertTrue(deps != null && deps.size() == 1 &&
deps.contains("fooX"));
+ deps = config.getDependencies("myPortal");
+ assertTrue(deps != null && deps.size() == 1 &&
deps.contains("fooX"));
+ deps = config.getDependencies("myPortal-pcdef");
+ assertTrue(deps != null && deps.size() == 3);
+ names = config.getPortalContainerNames("foo");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-pcdef", names.get(0));
+ names = config.getPortalContainerNames("myPortal");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal", names.get(0));
+ names = config.getPortalContainerNames("myPortal-pcdef");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-pcdef", names.get(0));
+ assertEquals("myPortal-pcdef",
config.getPortalContainerName("foo"));
+ assertEquals("myPortal",
config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal-pcdef",
config.getPortalContainerName("myPortal-pcdef"));
+ assertEquals("myRest", config.getRestContextName("foo"));
+ assertEquals("myRest", config.getRestContextName("myPortal"));
+ assertEquals("myRest-pcdef",
config.getRestContextName("myPortal-pcdef"));
+ assertEquals("my-exo-domain", config.getRealmName("foo"));
+ assertEquals("my-exo-domain",
config.getRealmName("myPortal"));
+ assertEquals("my-exo-domain-pcdef",
config.getRealmName("myPortal-pcdef"));
+ assertFalse(config.isPortalContainerName("foo"));
+ assertTrue(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal-pcdef"));
+ assertFalse(config.isScopeValid("foo", "foo"));
+ assertFalse(config.isScopeValid("myPortal", "foo"));
+ assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
+ assertTrue(config.hasDefinition());
}
public void testSettings()
{
- // Without settings and without portal definition
- RootContainer rootContainer =
createRootContainer("portal-container-config-with-default-values.xml");
+ // Without settings, without portal definition and without default values
+ RootContainer rootContainer =
createRootContainer("portal-container-config-with-no-default-values.xml");
PortalContainerConfig config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
assertNull(config.getSetting("foo", "foo"));
assertNull(config.getSetting("myPortal", "foo"));
assertNull(config.getSetting("myPortal-pcdef", "foo"));
- assertNull(config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal-pcdef",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME,
config.getSetting("foo",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME,
config.getSetting("myPortal",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME,
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME,
config.getSetting("foo",
+ PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME,
config.getSetting("myPortal",
+ PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME,
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME,
config.getSetting("foo",
+ PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME,
config.getSetting("myPortal",
+ PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME,
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.REALM_SETTING_NAME));
+ // Without settings and without portal definition
+ rootContainer =
createRootContainer("portal-container-config-with-default-values.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
+ // Without settings, without portal definition and with empty default portal
container definition
+ rootContainer =
+
createRootContainer("portal-container-config-with-default-values-and-with-empty-default-portal-def.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
+ // Without settings, without portal definition and with default portal container
definition
+ rootContainer =
+
createRootContainer("portal-container-config-with-default-values-and-with-default-portal-def.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("myPortal-dpcdef", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-dpcdef", config
+ .getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-dpcdef",
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config
+ .getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef",
config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config
+ .getSetting("myPortal-pcdef",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("value0", config.getSetting("foo",
"string"));
+ assertEquals(new Integer(100), config.getSetting("foo",
"int"));
+ assertEquals(new Long(100), config.getSetting("foo", "long"));
+ assertEquals(new Double(100), config.getSetting("foo",
"double"));
+ assertEquals(new Boolean(false), config.getSetting("foo",
"boolean"));
+ assertEquals("value0", config.getSetting("myPortal",
"string"));
+ assertEquals(new Integer(100), config.getSetting("myPortal",
"int"));
+ assertEquals(new Long(100), config.getSetting("myPortal",
"long"));
+ assertEquals(new Double(100), config.getSetting("myPortal",
"double"));
+ assertEquals(new Boolean(false), config.getSetting("myPortal",
"boolean"));
+ assertEquals("value0", config.getSetting("myPortal-pcdef",
"string"));
+ assertEquals(new Integer(100), config.getSetting("myPortal-pcdef",
"int"));
+ assertEquals(new Long(100), config.getSetting("myPortal-pcdef",
"long"));
+ assertEquals(new Double(100), config.getSetting("myPortal-pcdef",
"double"));
+ assertEquals(new Boolean(false), config.getSetting("myPortal-pcdef",
"boolean"));
+
// Without settings and with portal definition
rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
assertNull(config.getSetting("foo", "foo"));
assertNull(config.getSetting("myPortal", "foo"));
assertNull(config.getSetting("myPortal-pcdef", "foo"));
- assertNull(config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ // Without settings, with portal definition and with default portal definition
+ rootContainer =
+
createRootContainer("portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("myPortal-dpcdef", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-dpcdef", config
+ .getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef",
config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
// With internal settings
rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-settings.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -253,17 +438,57 @@
assertEquals(new Long(10), config.getSetting("myPortal-pcdef",
"long"));
assertEquals(new Double(10), config.getSetting("myPortal-pcdef",
"double"));
assertEquals(new Boolean(true), config.getSetting("myPortal-pcdef",
"boolean"));
- assertNull(config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ // With internal settings and default portal definition
+ rootContainer =
+
createRootContainer("portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertEquals("value", config.getSetting("myPortal-pcdef",
"foo"));
+ assertEquals("value", config.getSetting("foo",
"foo2"));
+ assertEquals("value", config.getSetting("myPortal",
"foo2"));
+ assertEquals("value", config.getSetting("myPortal-pcdef",
"foo2"));
+ assertNull(config.getSetting("foo", "foo3"));
+ assertNull(config.getSetting("myPortal", "foo3"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo3"));
+ assertEquals("myPortal-dpcdef", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-dpcdef", config
+ .getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef",
config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("value0", config.getSetting("foo",
"string"));
+ assertEquals(new Integer(100), config.getSetting("foo",
"int"));
+ assertEquals(new Long(100), config.getSetting("foo", "long"));
+ assertEquals(new Double(100), config.getSetting("foo",
"double"));
+ assertEquals(new Boolean(false), config.getSetting("foo",
"boolean"));
+ assertEquals("value0", config.getSetting("myPortal",
"string"));
+ assertEquals(new Integer(100), config.getSetting("myPortal",
"int"));
+ assertEquals(new Long(100), config.getSetting("myPortal",
"long"));
+ assertEquals(new Double(100), config.getSetting("myPortal",
"double"));
+ assertEquals(new Boolean(false), config.getSetting("myPortal",
"boolean"));
+ assertEquals("value", config.getSetting("myPortal-pcdef",
"string"));
+ assertEquals(new Integer(10), config.getSetting("myPortal-pcdef",
"int"));
+ assertEquals(new Long(10), config.getSetting("myPortal-pcdef",
"long"));
+ assertEquals(new Double(10), config.getSetting("myPortal-pcdef",
"double"));
+ assertEquals(new Boolean(true), config.getSetting("myPortal-pcdef",
"boolean"));
+
// With external settings
rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-external-settings.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -278,27 +503,92 @@
assertEquals("20", config.getSetting("myPortal-pcdef",
"long"));
assertEquals("20", config.getSetting("myPortal-pcdef",
"double"));
assertEquals("false", config.getSetting("myPortal-pcdef",
"boolean"));
- assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value-new
value", config.getSetting("myPortal-pcdef", "complex-value"));
- assertNull(config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value-new
value", config.getSetting(
+ "myPortal-pcdef", "complex-value"));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
- // With external settings in exo-conf directory
- String path =
TestPortalContainerConfig.class.getResource("portal-container-config-with-default-values-and-with-external-settings2.xml").getPath();
+ // With external settings, with several portal container definitions and with
+ // default portal container definition
+ rootContainer =
+
createRootContainer("portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertEquals("value0", config.getSetting("foo",
"foo"));
+ assertEquals("value0", config.getSetting("myPortal",
"foo"));
+ assertEquals("value0", config.getSetting("myPortal0",
"foo"));
+ assertEquals("value0", config.getSetting("myPortal-pcdef",
"foo"));
+ assertEquals("value0", config.getSetting("myPortal2",
"foo"));
+ assertNull(config.getSetting("foo", "foo2"));
+ assertNull(config.getSetting("myPortal", "foo2"));
+ assertNull(config.getSetting("myPortal0", "foo2"));
+ assertEquals("value", config.getSetting("myPortal-pcdef",
"foo2"));
+ assertNull(config.getSetting("myPortal2", "foo2"));
+ assertEquals("new value0", config.getSetting("foo",
"string"));
+ assertEquals("200", config.getSetting("foo",
"int"));
+ assertEquals("200", config.getSetting("foo",
"long"));
+ assertEquals("200", config.getSetting("foo",
"double"));
+ assertEquals("true", config.getSetting("foo",
"boolean"));
+ assertEquals("myPortal-myRest-my-exo-domain-value0-new value0",
config.getSetting("foo", "complex-value2"));
+ assertEquals("new value0", config.getSetting("myPortal",
"string"));
+ assertEquals("200", config.getSetting("myPortal",
"int"));
+ assertEquals("200", config.getSetting("myPortal",
"long"));
+ assertEquals("200", config.getSetting("myPortal",
"double"));
+ assertEquals("true", config.getSetting("myPortal",
"boolean"));
+ assertEquals("myPortal-myRest-my-exo-domain-value0-new value0",
config.getSetting("myPortal", "complex-value2"));
+ assertEquals("new value0", config.getSetting("myPortal0",
"string"));
+ assertEquals("200", config.getSetting("myPortal0",
"int"));
+ assertEquals("200", config.getSetting("myPortal0",
"long"));
+ assertEquals("200", config.getSetting("myPortal0",
"double"));
+ assertEquals("true", config.getSetting("myPortal0",
"boolean"));
+ assertEquals("myPortal0-myRest0-my-exo-domain0-value0-new value0",
config.getSetting("myPortal0",
+ "complex-value2"));
+ assertEquals("new value", config.getSetting("myPortal-pcdef",
"string"));
+ assertEquals("20", config.getSetting("myPortal-pcdef",
"int"));
+ assertEquals("20", config.getSetting("myPortal-pcdef",
"long"));
+ assertEquals("20", config.getSetting("myPortal-pcdef",
"double"));
+ assertEquals("false", config.getSetting("myPortal-pcdef",
"boolean"));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value-new
value", config.getSetting(
+ "myPortal-pcdef", "complex-value"));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value0-new
value", config.getSetting(
+ "myPortal-pcdef", "complex-value2"));
+ assertEquals("new value0", config.getSetting("myPortal2",
"string"));
+ assertEquals("200", config.getSetting("myPortal2",
"int"));
+ assertEquals("200", config.getSetting("myPortal2",
"long"));
+ assertEquals("200", config.getSetting("myPortal2",
"double"));
+ assertEquals("true", config.getSetting("myPortal2",
"boolean"));
+ assertEquals("myPortal2-myRest2-my-exo-domain2-value0-new value0",
config.getSetting("myPortal2",
+ "complex-value2"));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
+ String path =
+ TestPortalContainerConfig.class.getResource(
+
"portal-container-config-with-default-values-and-with-external-settings2.xml").getPath();
path = path.substring(0, path.lastIndexOf('/'));
String oldPath = System.getProperty(J2EEServerInfo.EXO_CONF_PARAM);
-
+
try
{
System.setProperty(J2EEServerInfo.EXO_CONF_PARAM, path);
- rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-external-settings2.xml");
+ // With external settings in exo-conf directory
+ rootContainer =
+
createRootContainer("portal-container-config-with-default-values-and-with-external-settings2.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
assertNull(config.getSetting("foo", "foo"));
assertNull(config.getSetting("myPortal", "foo"));
@@ -311,17 +601,82 @@
assertEquals("22", config.getSetting("myPortal-pcdef",
"long"));
assertEquals("22", config.getSetting("myPortal-pcdef",
"double"));
assertEquals("true", config.getSetting("myPortal-pcdef",
"boolean"));
- assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value 2-new
value 2", config.getSetting("myPortal-pcdef", "complex-value"));
- assertNull(config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value 2-new
value 2", config.getSetting(
+ "myPortal-pcdef", "complex-value"));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.REALM_SETTING_NAME));
+
+ // With external settings in exo-conf directory, with several portal container
definitions
+ // and with default portal container definition
+ rootContainer =
+
createRootContainer("portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertEquals("value01", config.getSetting("foo",
"foo"));
+ assertEquals("value01", config.getSetting("myPortal",
"foo"));
+ assertEquals("value01", config.getSetting("myPortal0",
"foo"));
+ assertEquals("value01", config.getSetting("myPortal-pcdef",
"foo"));
+ assertEquals("value01", config.getSetting("myPortal2",
"foo"));
+ assertNull(config.getSetting("foo", "foo2"));
+ assertNull(config.getSetting("myPortal", "foo2"));
+ assertNull(config.getSetting("myPortal0", "foo2"));
+ assertEquals("value 2", config.getSetting("myPortal-pcdef",
"foo2"));
+ assertNull(config.getSetting("myPortal2", "foo2"));
+ assertEquals("new value01", config.getSetting("foo",
"string"));
+ assertEquals("2001", config.getSetting("foo",
"int"));
+ assertEquals("2001", config.getSetting("foo",
"long"));
+ assertEquals("2001", config.getSetting("foo",
"double"));
+ assertEquals("false", config.getSetting("foo",
"boolean"));
+ assertEquals("myPortal-myRest-my-exo-domain-value01-new value01",
config.getSetting("foo", "complex-value2"));
+ assertEquals("new value01", config.getSetting("myPortal",
"string"));
+ assertEquals("2001", config.getSetting("myPortal",
"int"));
+ assertEquals("2001", config.getSetting("myPortal",
"long"));
+ assertEquals("2001", config.getSetting("myPortal",
"double"));
+ assertEquals("false", config.getSetting("myPortal",
"boolean"));
+ assertEquals("myPortal-myRest-my-exo-domain-value01-new value01",
config.getSetting("myPortal", "complex-value2"));
+ assertEquals("new value01", config.getSetting("myPortal0",
"string"));
+ assertEquals("2001", config.getSetting("myPortal0",
"int"));
+ assertEquals("2001", config.getSetting("myPortal0",
"long"));
+ assertEquals("2001", config.getSetting("myPortal0",
"double"));
+ assertEquals("false", config.getSetting("myPortal0",
"boolean"));
+ assertEquals("myPortal0-myRest0-my-exo-domain0-value01-new value01",
config.getSetting("myPortal0",
+ "complex-value2"));
+ assertEquals("new value 2",
config.getSetting("myPortal-pcdef", "string"));
+ assertEquals("22", config.getSetting("myPortal-pcdef",
"int"));
+ assertEquals("22", config.getSetting("myPortal-pcdef",
"long"));
+ assertEquals("22", config.getSetting("myPortal-pcdef",
"double"));
+ assertEquals("true", config.getSetting("myPortal-pcdef",
"boolean"));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value 2-new
value 2", config.getSetting(
+ "myPortal-pcdef", "complex-value"));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value01-new
value 2", config.getSetting(
+ "myPortal-pcdef", "complex-value2"));
+ assertEquals("new value01", config.getSetting("myPortal2",
"string"));
+ assertEquals("2001", config.getSetting("myPortal2",
"int"));
+ assertEquals("2001", config.getSetting("myPortal2",
"long"));
+ assertEquals("2001", config.getSetting("myPortal2",
"double"));
+ assertEquals("false", config.getSetting("myPortal2",
"boolean"));
+ assertEquals("myPortal2-myRest2-my-exo-domain2-value01-new value01",
config.getSetting("myPortal2",
+ "complex-value2"));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
}
finally
{
@@ -334,7 +689,7 @@
System.setProperty(J2EEServerInfo.EXO_CONF_PARAM, oldPath);
}
}
-
+
// With both settings internal and external
rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-both-settings.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -349,17 +704,98 @@
assertEquals(new Long(20), config.getSetting("myPortal-pcdef",
"long"));
assertEquals(new Double(20), config.getSetting("myPortal-pcdef",
"double"));
assertEquals(new Boolean(false), config.getSetting("myPortal-pcdef",
"boolean"));
- assertNull(config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
- assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
-
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
+ try
+ {
+ System.setProperty("TestPortalContainerConfig-string", "system
value");
+ System.setProperty("TestPortalContainerConfig-int", "50");
+ // With both settings internal and external and default portal container
definition
+ rootContainer =
createRootContainer("portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml");
+ config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertEquals("value0", config.getSetting("foo",
"foo"));
+ assertEquals("value0", config.getSetting("myPortal",
"foo"));
+ assertEquals("value0", config.getSetting("myPortal-pcdef",
"foo"));
+ assertEquals("value", config.getSetting("foo",
"foo2"));
+ assertEquals("value", config.getSetting("myPortal",
"foo2"));
+ assertEquals("value", config.getSetting("myPortal-pcdef",
"foo2"));
+ assertNull(config.getSetting("foo", "foo3"));
+ assertNull(config.getSetting("myPortal", "foo3"));
+ assertEquals("value", config.getSetting("myPortal-pcdef",
"foo3"));
+ assertEquals("-${foo3}-", config.getSetting("foo",
"complex-value3"));
+ assertEquals("-${foo3}-", config.getSetting("myPortal",
"complex-value3"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef",
"complex-value3"));
+ assertNull(config.getSetting("foo", "complex-value4"));
+ assertNull(config.getSetting("myPortal",
"complex-value4"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef",
"complex-value4"));
+ assertEquals("-value-", config.getSetting("foo",
"complex-value5"));
+ assertEquals("-value-", config.getSetting("myPortal",
"complex-value5"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef",
"complex-value5"));
+ assertNull(config.getSetting("foo", "complex-value6"));
+ assertNull(config.getSetting("myPortal",
"complex-value6"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef",
"complex-value6"));
+ assertNull(config.getSetting("foo", "complex-value7"));
+ assertNull(config.getSetting("myPortal",
"complex-value7"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef",
"complex-value7"));
+ assertEquals("-${foo6}-", config.getSetting("foo",
"complex-value8"));
+ assertEquals("-${foo6}-", config.getSetting("myPortal",
"complex-value8"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef",
"complex-value8"));
+ assertEquals("-property_value_1-", config.getSetting("foo",
"complex-value9"));
+ assertEquals("-property_value_1-",
config.getSetting("myPortal", "complex-value9"));
+ assertEquals("-property_value_1-",
config.getSetting("myPortal-pcdef", "complex-value9"));
+ assertEquals("-system value-", config.getSetting("foo",
"cpv1"));
+ assertEquals("-system value-", config.getSetting("myPortal",
"cpv1"));
+ assertEquals("-system value-",
config.getSetting("myPortal-pcdef", "cpv1"));
+ assertEquals(new Integer(50), config.getSetting("foo",
"cpv2"));
+ assertEquals(new Integer(50), config.getSetting("myPortal",
"cpv2"));
+ assertEquals(new Integer(50), config.getSetting("myPortal-pcdef",
"cpv2"));
+ assertEquals("-property_value_1-", config.getSetting("foo",
"cpv3"));
+ assertEquals("-property_value_1-",
config.getSetting("myPortal", "cpv3"));
+ assertEquals("-property_value_1-",
config.getSetting("myPortal-pcdef", "cpv3"));
+ assertEquals("new value0", config.getSetting("foo",
"string"));
+ assertEquals(new Integer(200), config.getSetting("foo",
"int"));
+ assertEquals(new Integer(60), config.getSetting("foo",
"int2"));
+ assertEquals(new Long(200), config.getSetting("foo",
"long"));
+ assertEquals(new Double(200), config.getSetting("foo",
"double"));
+ assertEquals(new Boolean(true), config.getSetting("foo",
"boolean"));
+ assertEquals("new value0", config.getSetting("myPortal",
"string"));
+ assertEquals(new Integer(200), config.getSetting("myPortal",
"int"));
+ assertEquals(new Integer(60), config.getSetting("myPortal",
"int2"));
+ assertEquals(new Long(200), config.getSetting("myPortal",
"long"));
+ assertEquals(new Double(200), config.getSetting("myPortal",
"double"));
+ assertEquals(new Boolean(true), config.getSetting("myPortal",
"boolean"));
+ assertEquals("new value",
config.getSetting("myPortal-pcdef", "string"));
+ assertEquals(new Integer(20), config.getSetting("myPortal-pcdef",
"int"));
+ assertEquals(new Integer(60), config.getSetting("myPortal-pcdef",
"int2"));
+ assertEquals(new Long(20), config.getSetting("myPortal-pcdef",
"long"));
+ assertEquals(new Double(20), config.getSetting("myPortal-pcdef",
"double"));
+ assertEquals(new Boolean(false), config.getSetting("myPortal-pcdef",
"boolean"));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ }
+ finally
+ {
+ System.getProperties().remove("TestPortalContainerConfig-string");
+ System.getProperties().remove("TestPortalContainerConfig-int");
+ }
+
// With both settings internal and external, and with invalid values
rootContainer =
createRootContainer("portal-container-config-with-invalid-values.xml");
config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -368,15 +804,15 @@
assertEquals("", config.getSetting("myPortal-pcdef",
"fake-value-4-string"));
assertEquals(new Integer(10), config.getSetting("myPortal-pcdef",
"fake-value-4-int"));
assertEquals(new Integer(10), config.getSetting("myPortal-pcdef",
"invalid-value-4-int"));
- assertNull(config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("foo",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef",
config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest", config.getSetting("myPortal-pcdef",
PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
- assertEquals("my-exo-domain",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal",
PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain",
config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
}
}
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/default-settings.properties
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/default-settings.properties
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/default-settings.properties 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,13 @@
+foo=value0
+foo4=value
+string=new value0
+int=200
+int2=${property_Int}
+long=200
+double=200
+boolean=true
+complex-value2=${name}-${rest}-${realm}-${foo}-${string}
+complex-value3=-${foo3}-
+complex-value5=-${foo5}-
+complex-value8=-${foo6}-
+complex-value9=-${property_String}-
\ No newline at end of file
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/default-settings.properties
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/default-settings.properties
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/default-settings.properties 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,7 @@
+foo=value01
+string=new value01
+int=2001
+long=2001
+double=2001
+boolean=false
+complex-value2=${name}-${rest}-${realm}-${foo}-${string}
\ No newline at end of file
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the
GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- A map of settings tied to the default portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>cpv1</string>
+ </key>
+ <value>
+ <string>-${TestPortalContainerConfig-string}-</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>cpv2</string>
+ </key>
+ <value>
+ <int>${TestPortalContainerConfig-int}</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>cpv3</string>
+ </key>
+ <value>
+ <string>-${property_String}-</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>foo2</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>foo5</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value0</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>100</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int2</string>
+ </key>
+ <value>
+ <int>100</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>100</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>100</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>classpath:/org/exoplatform/container/definition/default-settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <component>
+ <key>PropertyManagerConfigurator</key>
+ <type>org.exoplatform.container.PropertyConfigurator</type>
+ <init-params>
+ <properties-param>
+ <name>properties</name>
+ <property name="property_String" value="property_value_1"
/>
+ <property name="property_Int" value="60" />
+ </properties-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to
register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- A map of settings tied to the portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>foo</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>foo6</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>10</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>10</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>10</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>classpath:/org/exoplatform/container/definition/settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-default-portal-def.xml
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-default-portal-def.xml
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-default-portal-def.xml 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the
GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.portal.container" -->
+ <field name="name">
+ <string>myPortal-dpcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.rest.context" -->
+ <field name="restContextName">
+ <string>myRest-dpcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.realm.name" -->
+ <field name="realmName">
+ <string>my-exo-domain-dpcdef</string>
+ </field>
+ <!-- A map of settings tied to the default portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value0</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>100</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>100</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>100</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+</configuration>
\ No newline at end of file
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-empty-default-portal-def.xml
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-empty-default-portal-def.xml
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-empty-default-portal-def.xml 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the
GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+</configuration>
\ No newline at end of file
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the
GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>classpath:/org/exoplatform/container/definition/default-settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to
register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal0</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal0</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest0</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain0</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>portal</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>classpath:/org/exoplatform/container/definition/settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>portal2</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal2</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest2</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain2</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the
GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>default-settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to
register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal0</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal0</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest0</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain0</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>portal</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>portal2</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal2</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest2</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain2</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the
GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.portal.container" -->
+ <field name="name">
+ <string>myPortal-dpcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.rest.context" -->
+ <field name="restContextName">
+ <string>myRest-dpcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.realm.name" -->
+ <field name="realmName">
+ <string>my-exo-domain-dpcdef</string>
+ </field>
+ <field name="dependencies">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>fooX</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to
register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the
GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <field name="dependencies">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>fooX</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to
register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- All the dependencies of the portal container ordered by loading priority
-->
+ <field name="dependencies">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>foo</string>
+ </value>
+ <value>
+ <string>foo2</string>
+ </value>
+ <value>
+ <string>foo3</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Added:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml
(rev 0)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml 2010-03-04
17:40:20 UTC (rev 2010)
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the
GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.portal.container" -->
+ <field name="name">
+ <string>myPortal-dpcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.rest.context" -->
+ <field name="restContextName">
+ <string>myRest-dpcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.realm.name" -->
+ <field name="realmName">
+ <string>my-exo-domain-dpcdef</string>
+ </field>
+ <!-- A map of settings tied to the default portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>foo2</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value0</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>100</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>100</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>100</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to
register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal</name>
+ <object
type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- A map of settings tied to the portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>foo</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>10</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>10</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>10</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Modified:
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties
===================================================================
---
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties 2010-03-04
15:11:28 UTC (rev 2009)
+++
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties 2010-03-04
17:40:20 UTC (rev 2010)
@@ -1,7 +1,11 @@
foo2=value
+foo3=value
string=new value
int=20
long=20
double=20
boolean=false
-complex-value=${name}-${rest}-${realm}-${foo2}-${string}
\ No newline at end of file
+complex-value=${name}-${rest}-${realm}-${foo2}-${string}
+complex-value4=-${foo4}-
+complex-value6=-${foo6}-
+complex-value7=-${foo5}-
\ No newline at end of file