[exo-jcr-commits] exo-jcr SVN: r1915 - in kernel/trunk/exo.kernel.container/src: main/java/org/exoplatform/container/configuration and 9 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Feb 18 12:56:36 EST 2010


Author: nfilotto
Date: 2010-02-18 12:56:36 -0500 (Thu, 18 Feb 2010)
New Revision: 1915

Added:
   kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/
   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/
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/empty-config.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings2.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def2.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-no-default-values-but-with-portal-def.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-no-default-values.xml
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/myPortal-pcdef/
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/myPortal-pcdef/settings.properties
   kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties
Modified:
   kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainerContext.java
   kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainer.java
   kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
   kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
   kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java
   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/PortalContainerDefinition.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
Log:
EXOJCR-528

Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainerContext.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainerContext.java	2010-02-18 17:44:11 UTC (rev 1914)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainerContext.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -70,7 +70,7 @@
 
    /**
     * @return if the embedded container is a {@link PortalContainer}, it will return the name 
-    * of the rest context name related to the portal container otherwise it will return the default name
+    * of the rest context related to the portal container otherwise it will return the default name
     */
    public String getRestContextName()
    {
@@ -83,7 +83,7 @@
 
    /**
     * @return if the embedded container is a {@link PortalContainer}, it will return the name 
-    * of the realm name related to the portal container otherwise it will return the default name
+    * of the realm related to the portal container otherwise it will return the default name
     */
    public String getRealmName()
    {
@@ -94,6 +94,19 @@
       return PortalContainer.DEFAULT_REALM_NAME;
    }
 
+   /**
+    * @return if the embedded container is a {@link PortalContainer}, it will return the value 
+    * of the setting related to the portal container otherwise it will return <code>null</code>
+    */
+   public Object getSetting(String settingName)
+   {
+      if (container instanceof PortalContainer)
+      {
+         return ((PortalContainer)container).getSetting(settingName);
+      }
+      return null;
+   }
+   
    public String getName()
    {
       return name;

Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainer.java	2010-02-18 17:44:11 UTC (rev 1914)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainer.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -27,8 +27,6 @@
 import org.exoplatform.management.jmx.annotations.NameTemplate;
 import org.exoplatform.management.jmx.annotations.NamingContext;
 import org.exoplatform.management.jmx.annotations.Property;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
 
 import java.util.Collections;
 import java.util.Comparator;
@@ -47,16 +45,11 @@
  */
 @Managed
 @NamingContext(@Property(key = "portal", value = "{Name}"))
- at NameTemplate({@Property(key = "container", value = "portal"), at Property(key = "name", value = "{Name}")})
+ at NameTemplate({@Property(key = "container", value = "portal"), @Property(key = "name", value = "{Name}")})
 public class PortalContainer extends ExoContainer implements SessionManagerContainer
 {
 
    /**
-    * Logger
-    */
-   private static final Log log = ExoLogger.getLogger(PortalContainer.class);
-
-   /**
     * The default name of the portal container
     */
    public static final String DEFAULT_PORTAL_CONTAINER_NAME;
@@ -145,7 +138,8 @@
       pinfo_ = new PortalContainerInfo(portalContext);
       registerComponentInstance(PortalContainerInfo.class, pinfo_);
       this.name = portalContext.getServletContextName();
-      final List<String> dependencies = parent.getPortalContainerConfig().getDependencies(name);
+      final PortalContainerConfig config = parent.getPortalContainerConfig();
+      final List<String> dependencies = config == null ? null : config.getDependencies(name);
       if (dependencies == null || dependencies.isEmpty())
       {
          // No order is required
@@ -334,7 +328,7 @@
    public static PortalContainer getInstanceIfPresent()
    {
       ExoContainer container = ExoContainerContext.getCurrentContainerIfPresent();
-      if (container instanceof PortalContainer) 
+      if (container instanceof PortalContainer)
       {
          return (PortalContainer)container;
       }
@@ -412,7 +406,7 @@
    }
 
    /**
-    * We first try to get the ExoContainer that has been stored in the ThreadLocal
+    * We first try to get the ExoContainer that has been stored into the ThreadLocal
     * if the value is of type PortalContainer, we return it otherwise we get the
     * portal container corresponding the given servlet context
     * 
@@ -429,7 +423,7 @@
    }
 
    /**
-    * Returns the name of the current portal container that has been stored in the ThreadLocal. If no
+    * Returns the name of the current portal container that has been stored into the ThreadLocal. If no
     * value can be found the value of PortalContainer.DEFAULT_PORTAL_CONTAINER_NAME will be used
     */
    public static String getCurrentPortalContainerName()
@@ -447,7 +441,7 @@
 
    /**
     * Returns the name of the current rest context corresponding to the portal container
-    * that has been stored in the ThreadLocal. If no value can be found the value of 
+    * that has been stored into the ThreadLocal. If no value can be found the value of 
     * PortalContainer.DEFAULT_REST_CONTEXT_NAME will be used
     */
    public static String getCurrentRestContextName()
@@ -480,7 +474,7 @@
 
    /**
     * Returns the name of the current realm corresponding to the portal container
-    * that has been stored in the ThreadLocal. If no value can be found the value of 
+    * that has been stored into the ThreadLocal. If no value can be found the value of 
     * PortalContainer.DEFAULT_REALM_NAME will be used
     */
    public static String getCurrentRealmName()
@@ -512,6 +506,43 @@
    }
 
    /**
+    * Returns the current value of the setting corresponding to the portal container
+    * that has been stored into the ThreadLocal. If no value can be found, <code>null</code> will be
+    * returned
+    * @param settingName the name of the setting wanted
+    */
+   public static Object getCurrentSetting(String settingName)
+   {
+      final String containerName = getCurrentPortalContainerName();
+      return getSetting(containerName, settingName);
+   }
+
+   /**
+    * Returns the value of the setting corresponding to the given portal container name
+    * and the given setting name
+    * @param portalContainerName the name of the portal container for which we want the
+    * name of the value of the setting
+    * @param settingName the name of the setting wanted
+    */
+   public static Object getSetting(String portalContainerName, String settingName)
+   {
+      if (CONFIG == null)
+      {
+         return null;
+      }
+      return CONFIG.getSetting(portalContainerName, settingName);
+   }
+
+   /**
+    * Returns the value of the setting corresponding to the current portal container 
+    * @param settingName the name of the setting wanted
+    */
+   public Object getSetting(String settingName)
+   {
+      return getSetting(getName(), settingName);
+   }
+
+   /**
     * Indicates if the given servlet context is a dependency of the given portal container
     * @param container the portal container
     * @param context the {@link ServletContext}

Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java	2010-02-18 17:44:11 UTC (rev 1914)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -18,11 +18,9 @@
  */
 package org.exoplatform.container;
 
-import org.exoplatform.commons.utils.PropertiesLoader;
 import org.exoplatform.commons.utils.PropertyManager;
-import org.exoplatform.commons.utils.Tools;
 import org.exoplatform.container.configuration.ConfigurationManager;
-import org.exoplatform.container.xml.Deserializer;
+import org.exoplatform.container.util.ContainerUtil;
 import org.exoplatform.container.xml.InitParams;
 import org.exoplatform.container.xml.PropertiesParam;
 import org.exoplatform.container.xml.Property;
@@ -31,11 +29,8 @@
 import org.exoplatform.services.log.Log;
 import org.picocontainer.Startable;
 
-import java.io.IOException;
-import java.io.InputStream;
 import java.net.URL;
 import java.util.Iterator;
-import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Properties;
 
@@ -104,69 +99,24 @@
       if (path != null)
       {
          log.debug("Found property file path " + path);
-         InputStream in = null;
          try
          {
             URL url = confManager.getURL(path);
-
-            //
-            if (url != null)
+            Map<String, String> props = ContainerUtil.loadProperties(url);
+            if (props != null)
             {
-               in = url.openStream();
-            }
-
-            //
-            if (in != null)
-            {
-               LinkedHashMap<String, String> props = null;
-               String fileName = url.getFile();
-               if (Tools.endsWithIgnoreCase(path, ".properties"))
+               for (Map.Entry<String, String> entry : props.entrySet())
                {
-                  log.debug("Attempt to load property file " + path);
-                  props = PropertiesLoader.load(in);
+                  String propertyName = entry.getKey();
+                  String propertyValue = entry.getValue();
+                  PropertyManager.setProperty(propertyName, propertyValue);
                }
-               else if (Tools.endsWithIgnoreCase(fileName, ".xml"))
-               {
-                  log.debug("Attempt to load property file " + path + " with XML format");
-                  props = PropertiesLoader.loadFromXML(in);
-               }
-               else
-               {
-                  log.debug("Will not load property file" + path + " because its format is not recognized");
-               }
-               if (props != null)
-               {
-                  for (Map.Entry<String, String> entry : props.entrySet())
-                  {
-                     String propertyName = entry.getKey();
-                     String propertyValue = entry.getValue();
-                     propertyValue = Deserializer.resolveString(propertyValue);
-                     PropertyManager.setProperty(propertyName, propertyValue);
-                  }
-               }
             }
-            else
-            {
-               log.error("Could not load property file " + path);
-            }
          }
          catch (Exception e)
          {
             log.error("Cannot load property file " + path, e);
          }
-         finally
-         {
-            if (in != null)
-            {
-               try
-               {
-                  in.close();
-               }
-               catch (IOException ignore)
-               {
-               }
-            }
-         }
       }
    }
 

Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java	2010-02-18 17:44:11 UTC (rev 1914)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -162,7 +162,6 @@
                pcontainer.initContainer();
                registerComponentInstance(name, pcontainer);
                PortalContainer.setInstance(pcontainer);
-               ExoContainerContext.setCurrentContainer(pcontainer);
                pcontainer.start();
             }
             catch (Exception ex)

Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java	2010-02-18 17:44:11 UTC (rev 1914)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationManagerImpl.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -18,12 +18,9 @@
  */
 package org.exoplatform.container.configuration;
 
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.RootContainer;
 import org.exoplatform.container.xml.Component;
 import org.exoplatform.container.xml.Configuration;
+import org.exoplatform.container.xml.Deserializer;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 
@@ -55,8 +52,6 @@
 
    final static public boolean LOG_DEBUG = System.getProperty(LOG_DEBUG_PROPERTY) != null;
 
-   private static final String EXO_CONTAINER_PROP_NAME = "container.name.suffix";
-
    private static final Log log = ExoLogger.getLogger(ConfigurationManagerImpl.class);
 
    protected Configuration configurations_;
@@ -311,7 +306,7 @@
       }
       else if (url.startsWith("file:"))
       {
-         url = resolveSystemProperties(url);
+         url = Deserializer.resolveVariables(url);
          return new URL(url);
       }
       else if (url.indexOf(":") < 0 && contextPath != null)
@@ -321,79 +316,6 @@
       return null;
    }
 
-   /**
-    *
-    * @param input the input
-    * @return the resolved input
-    */
-   public static String resolveSystemProperties(String input)
-   {
-      final int NORMAL = 0;
-      final int SEEN_DOLLAR = 1;
-      final int IN_BRACKET = 2;
-      if (input == null)
-         return input;
-      char[] chars = input.toCharArray();
-      StringBuffer buffer = new StringBuffer();
-      boolean properties = false;
-      int state = NORMAL;
-      int start = 0;
-      for (int i = 0; i < chars.length; ++i)
-      {
-         char c = chars[i];
-         if (c == '$' && state != IN_BRACKET)
-            state = SEEN_DOLLAR;
-         else if (c == '{' && state == SEEN_DOLLAR)
-         {
-            buffer.append(input.substring(start, i - 1));
-            state = IN_BRACKET;
-            start = i - 1;
-         }
-         else if (state == SEEN_DOLLAR)
-            state = NORMAL;
-         else if (c == '}' && state == IN_BRACKET)
-         {
-            if (start + 2 == i)
-            {
-               buffer.append("${}");
-            }
-            else
-            {
-               String value = null;
-               String key = input.substring(start + 2, i);
-               if (key.equals(EXO_CONTAINER_PROP_NAME))
-               {
-                  // The requested key is the name of current container
-                  ExoContainer container = ExoContainerContext.getCurrentContainerIfPresent();
-                  if (container instanceof PortalContainer)
-                  {
-                     // The current container is a portal container
-                     RootContainer rootContainer = (RootContainer)ExoContainerContext.getTopContainer();
-                     value = rootContainer.isPortalContainerConfigAware() ? "_" + container.getContext().getName() : "";
-                  }
-               }
-               else
-               {
-                  value = System.getProperty(key);
-               }
-               if (value != null)
-               {
-                  properties = true;
-                  buffer.append(value);
-               }
-            }
-            start = i + 1;
-            state = NORMAL;
-         }
-      }
-      if (properties == false)
-         return input;
-      if (start != chars.length)
-         buffer.append(input.substring(start, chars.length));
-      return buffer.toString();
-
-   }
-
    public boolean isDefault(String value)
    {
       return value == null || value.length() == 0 || "default".equals(value);

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-02-18 17:44:11 UTC (rev 1914)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -20,10 +20,19 @@
 
 import org.exoplatform.container.PortalContainer;
 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.ValueParam;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
 import org.picocontainer.Startable;
 
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -44,8 +53,27 @@
  */
 public class PortalContainerConfig implements Startable
 {
+   /**
+    * The logger
+    */
+   private static final Log log = ExoLogger.getLogger(PortalContainerConfig.class);
 
    /**
+    * The name of the setting corresponding to the portal container name
+    */
+   public static final String PORTAL_CONTAINER_SETTING_NAME = "name";
+
+   /**
+    * The name of the setting corresponding to the rest context name
+    */
+   public static final String REST_CONTEXT_SETTING_NAME = "rest.context";
+
+   /**
+    * The name of the setting corresponding to the relam name
+    */
+   public static final String REALM_SETTING_NAME = "realm";
+
+   /**
     * The default name of a portal container
     */
    public static final String DEFAULT_PORTAL_CONTAINER_NAME = "portal";
@@ -96,13 +124,30 @@
    private Map<String, PortalContainerDefinition> definitions =
       Collections.unmodifiableMap(new HashMap<String, PortalContainerDefinition>());
 
-   public PortalContainerConfig()
+   /**
+    * The configuration manager
+    */
+   private final ConfigurationManager cm;
+
+   /**
+    * Some info about the current server
+    */
+   private final J2EEServerInfo serverInfo;
+
+   public PortalContainerConfig(ConfigurationManager cm)
    {
-      this(null);
+      this(null, cm, new J2EEServerInfo());
    }
 
-   public PortalContainerConfig(InitParams params)
+   public PortalContainerConfig(ConfigurationManager cm, J2EEServerInfo serverInfo)
    {
+      this(null, cm, serverInfo);
+   }
+
+   public PortalContainerConfig(InitParams params, ConfigurationManager cm, J2EEServerInfo serverInfo)
+   {
+      this.cm = cm;
+      this.serverInfo = serverInfo;
       if (params == null)
       {
          return;
@@ -245,6 +290,7 @@
       }
       return result.get(0);
    }
+
    /**
     * Gives all the dependencies related to the given portal container
     * @param portalContainerName the name of the portal container for which we want the dependencies
@@ -257,6 +303,28 @@
    }
 
    /**
+    * Give the value of a given setting for a given portal container name
+    * @param portalContainerName the name of the portal container for which we want the value of the
+    * setting
+    * @param settingName the name of the setting that we seek
+    * @return the value of the setting, <code>null</code> if it cans not be found.
+    */
+   public Object getSetting(String portalContainerName, String settingName)
+   {
+      if (settingName == null)
+      {
+         throw new IllegalArgumentException("The setting name cannot be null");
+      }
+      final PortalContainerDefinition definition = definitions.get(portalContainerName);
+      if (definition == null)
+      {
+         return null;
+      }
+      final Map<String, Object> settings = definition.getSettings();
+      return settings == null ? null : settings.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}
@@ -361,7 +429,7 @@
    private void registerDependencies(PortalContainerDefinition definition, Map<String, List<String>> scopes)
    {
       final List<String> dependencies = definition.getDependencies();
-      if (definition == null || dependencies.isEmpty())
+      if (dependencies == null || dependencies.isEmpty())
       {
          return;
       }
@@ -388,6 +456,121 @@
    }
 
    /**
+    * Initialize all the settings tied to the corresponding portal container. It will first initialize
+    * a new {@link Map} of settings from the settings retrieved from PortalContainerDefinition.getSettings(),
+    * then it will add the external settings corresponding the properties file found at the path
+    *  PortalContainerDefinition.getExternalSettingsPath(), if such file exists. If the same key has been
+    *  defined in both, the value defined in the external settings will be kept. Then we will add the main
+    *  settings such as the 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
+    */
+   private void initializeSettings(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())
+      {
+         settings.putAll(tmpSettings);
+      }
+      // We then load the external settings, if they exists
+      String path = def.getExternalSettingsPath();
+      if (path != null && (path = path.trim()).length() > 0)
+      {
+         try
+         {
+            URL url = null;
+            if (path.indexOf(':') == -1)
+            {
+               // We first check if the file is not in eXo configuration directory
+               String fullPath = serverInfo.getExoConfigurationDirectory() + "/portal/" + def.getName() + "/" + path;
+               File file = new File(fullPath);
+               if (file.exists())
+               {
+                  // The file exists so we will use it
+                  url = file.toURI().toURL();
+               }
+            }
+            if (url == null)
+            {
+               // We assume that the path is an eXo standard path
+               url = cm.getURL(path);
+            }
+            // We load the properties from the url found
+            final Map<String, String> props = ContainerUtil.loadProperties(url);
+            if (props != null && !props.isEmpty())
+            {
+               if (settings.isEmpty())
+               {
+                  // No settings exist so we can add everything
+                  settings.putAll(props);
+               }
+               else
+               {
+                  // Some settings exists so we need to be careful if we override properties
+                  // We need to try to keep the same type if possible
+                  for (Map.Entry<String, String> entry : props.entrySet())
+                  {
+                     String propertyName = entry.getKey();
+                     Object propertyValue = entry.getValue();
+                     propertyValue = Deserializer.resolveString((String)propertyValue);
+                     Object oldValue = settings.get(propertyName);
+                     if (oldValue != null)
+                     {
+                        // The value is not null so we need to convert the String into
+                        // the target type, we will convert thanks to the static method
+                        // valueOf(String value) if it exist for the target type
+                        Method m = null;
+                        try
+                        {
+                           // First we check if the method exists
+                           m = oldValue.getClass().getMethod("valueOf", String.class);
+                        }
+                        catch (Exception e)
+                        {
+                           if (log.isDebugEnabled())
+                           {
+                              log.debug("The static method valueOf(String) cannot be found for the class "
+                                 + oldValue.getClass(), e);
+                           }
+                        }
+                        if (m != null)
+                        {
+                           // The method could be found, thus we will try to convert the value
+                           try
+                           {
+                              propertyValue = m.invoke(null, propertyValue);
+                           }
+                           catch (Exception e)
+                           {
+                              log.error("Cannot convert the value '" + propertyValue + "' to an Object of type "
+                                 + oldValue.getClass(), e);
+                           }
+                        }
+                     }
+                     // We set the new value
+                     settings.put(propertyName, propertyValue);
+                  }
+               }
+            }
+         }
+         catch (Exception e)
+         {
+            log.error("Cannot load property file " + path, e);
+         }
+      }
+      // We then 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());
+      // We add the realm name
+      settings.put(REALM_SETTING_NAME, def.getRealmName());
+      // We re-inject the settings and we make sure it is thread safe
+      def.setSettings(Collections.unmodifiableMap(settings));
+   }
+
+   /**
     * Initialize the current component
     * @param mDefinitions the list of all the portal container definition to treat
     */
@@ -429,6 +612,7 @@
             this.defaultRealmName = definition.getRealmName();
          }
          registerDependencies(definition, mScopes);
+         initializeSettings(definition);
       }
       this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
       this.scopes = Collections.unmodifiableMap(mScopes);

Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java	2010-02-18 17:44:11 UTC (rev 1914)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerDefinition.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -21,6 +21,7 @@
 import org.exoplatform.container.PortalContainer;
 
 import java.util.List;
+import java.util.Map;
 
 import javax.servlet.ServletContext;
 
@@ -46,18 +47,29 @@
     * The realm name of the related {@link PortalContainer}
     */
    private String realmName;
-   
+
    /**
     * The name of the {@link ServletContext} of the rest web application
     */
    private String restContextName;
-   
+
    /**
     * The list of all the context names that are needed to initialized properly the
     * {@link PortalContainer}. The order of all the dependencies will define the initialization order 
     */
    private List<String> dependencies;
 
+   /**
+    * A {@link Map} of parameters that we would like to tie the portal container. Those parameters
+    * could have any type of value.
+    */
+   private Map<String, Object> settings;
+
+   /**
+    * The path of the external properties file to load as default settings to the portal container. 
+    */
+   private String externalSettingsPath;
+
    public String getName()
    {
       return name;
@@ -97,4 +109,24 @@
    {
       this.restContextName = restContextName;
    }
+
+   public Map<String, Object> getSettings()
+   {
+      return settings;
+   }
+
+   public void setSettings(Map<String, Object> settings)
+   {
+      this.settings = settings;
+   }
+
+   public String getExternalSettingsPath()
+   {
+      return externalSettingsPath;
+   }
+
+   public void setExternalSettingsPath(String externalSettingsPath)
+   {
+      this.externalSettingsPath = externalSettingsPath;
+   }
 }

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-02-18 17:44:11 UTC (rev 1914)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -18,19 +18,27 @@
  */
 package org.exoplatform.container.util;
 
+import org.exoplatform.commons.utils.PropertiesLoader;
+import org.exoplatform.commons.utils.Tools;
 import org.exoplatform.container.ExoContainer;
 import org.exoplatform.container.configuration.ConfigurationManager;
 import org.exoplatform.container.xml.Component;
 import org.exoplatform.container.xml.ComponentLifecyclePlugin;
 import org.exoplatform.container.xml.ContainerLifecyclePlugin;
+import org.exoplatform.container.xml.Deserializer;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
 import org.picocontainer.defaults.ConstructorInjectionComponentAdapter;
 
+import java.io.IOException;
+import java.io.InputStream;
 import java.lang.reflect.Constructor;
 import java.net.URL;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 /**
@@ -40,6 +48,8 @@
  */
 public class ContainerUtil
 {
+   /** The logger. */
+   private static final Log log = ExoLogger.getExoLogger(ContainerUtil.class);
 
    static public Constructor<?>[] getSortedConstructors(Class<?> clazz) throws NoClassDefFoundError
    {
@@ -190,4 +200,79 @@
          }
       }
    }
+   
+   /**
+    * Loads the properties file corresponding to the given url
+    * @param url the url of the properties file
+    * @return a {@link Map} of properties
+    */
+   public static Map<String, String> loadProperties(URL url)
+   {
+      LinkedHashMap<String, String> props = null;
+      String path = null;
+      InputStream in = null;
+      try
+      {
+         //
+         if (url != null)
+         {
+            in = url.openStream();
+            path = url.getPath();
+         }
+
+         //
+         if (in != null)
+         {
+            String fileName = url.getFile();
+            if (Tools.endsWithIgnoreCase(path, ".properties"))
+            {
+               if (log.isDebugEnabled()) 
+                  log.debug("Attempt to load property file " + path);
+               props = PropertiesLoader.load(in);
+            }
+            else if (Tools.endsWithIgnoreCase(fileName, ".xml"))
+            {
+               if (log.isDebugEnabled())
+                  log.debug("Attempt to load property file " + path + " with XML format");
+               props = PropertiesLoader.loadFromXML(in);
+            }
+            else if (log.isDebugEnabled())
+            {
+               log.debug("Will not load property file" + path + " because its format is not recognized");
+            }
+            if (props != null)
+            {
+               for (Map.Entry<String, String> entry : props.entrySet())
+               {
+                  String propertyName = entry.getKey();
+                  String propertyValue = entry.getValue();
+                  propertyValue = Deserializer.resolveString(propertyValue);
+                  props.put(propertyName, propertyValue);
+               }
+            }
+         }
+         else
+         {
+            log.error("Could not load property file " + path);
+         }
+      }
+      catch (Exception e)
+      {
+         log.error("Cannot load property file " + path, e);
+      }
+      finally
+      {
+         if (in != null)
+         {
+            try
+            {
+               in.close();
+            }
+            catch (IOException ignore)
+            {
+            }
+         }
+      }
+      return props;
+   }
 }

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-02-18 17:44:11 UTC (rev 1914)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Deserializer.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -18,7 +18,10 @@
  */
 package org.exoplatform.container.xml;
 
-import org.exoplatform.container.configuration.ConfigurationManagerImpl;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer;
 
 /**
  * A deserializer used by JIBX that resolve system properties to allow runtime configuration.
@@ -28,8 +31,19 @@
  */
 public class Deserializer
 {
+   /**
+    * The name of the variable to use to get the current container name as a suffix
+    * if the current container is a portal container, the value of the variable
+    * will be "-${portal-container-name}", it will be an empty String otherwise 
+    */
+   public static final String EXO_CONTAINER_PROP_NAME = "container.name.suffix";
 
    /**
+    * The prefix of the name of all the variables tied to the current portal container
+    */
+   public static final String PORTAL_CONTAINER_VARIABLE_PREFIX = "portal.container.";
+   
+   /**
     * Resolve a string value.
     * If the input value is null then the returned value is null.
     *
@@ -38,7 +52,7 @@
     */
    public static String resolveString(String s)
    {
-      return ConfigurationManagerImpl.resolveSystemProperties(s);
+      return Deserializer.resolveVariables(s);
    }
 
    /**
@@ -61,7 +75,7 @@
       {
          return null;
       }
-      s = ConfigurationManagerImpl.resolveSystemProperties(s);
+      s = Deserializer.resolveVariables(s);
       if (s.equalsIgnoreCase("true"))
       {
          return true;
@@ -91,7 +105,7 @@
       {
          return null;
       }
-      s = ConfigurationManagerImpl.resolveSystemProperties(s);
+      s = Deserializer.resolveVariables(s);
       try
       {
          return Integer.parseInt(s);
@@ -120,7 +134,7 @@
       {
          return null;
       }
-      s = ConfigurationManagerImpl.resolveSystemProperties(s);
+      s = Deserializer.resolveVariables(s);
       try
       {
          return Long.parseLong(s);
@@ -149,7 +163,7 @@
       {
          return null;
       }
-      s = ConfigurationManagerImpl.resolveSystemProperties(s);
+      s = Deserializer.resolveVariables(s);
       try
       {
          return Double.parseDouble(s);
@@ -159,4 +173,91 @@
          throw new IllegalArgumentException("Cannot accept integer value " + s, e);
       }
    }
+
+   /**
+    * Resolve the variables of type ${my.var} for the current context which is composed
+    * of the system properties and the portal container properties
+    * @param input the input value
+    * @return the resolve value
+    */
+   public static String resolveVariables(String input)
+   {
+      final int NORMAL = 0;
+      final int SEEN_DOLLAR = 1;
+      final int IN_BRACKET = 2;
+      if (input == null)
+         return input;
+      char[] chars = input.toCharArray();
+      StringBuffer buffer = new StringBuffer();
+      boolean properties = false;
+      int state = NORMAL;
+      int start = 0;
+      for (int i = 0; i < chars.length; ++i)
+      {
+         char c = chars[i];
+         if (c == '$' && state != IN_BRACKET)
+            state = SEEN_DOLLAR;
+         else if (c == '{' && state == SEEN_DOLLAR)
+         {
+            buffer.append(input.substring(start, i - 1));
+            state = IN_BRACKET;
+            start = i - 1;
+         }
+         else if (state == SEEN_DOLLAR)
+            state = NORMAL;
+         else if (c == '}' && state == IN_BRACKET)
+         {
+            if (start + 2 == i)
+            {
+               buffer.append("${}");
+            }
+            else
+            {
+               String value = null;
+               String key = input.substring(start + 2, i);
+               if (key.equals(Deserializer.EXO_CONTAINER_PROP_NAME))
+               {
+                  // The requested key is the name of current container
+                  ExoContainer container = ExoContainerContext.getCurrentContainerIfPresent();
+                  if (container instanceof PortalContainer)
+                  {
+                     // The current container is a portal container
+                     RootContainer rootContainer = (RootContainer)ExoContainerContext.getTopContainer();
+                     value = rootContainer.isPortalContainerConfigAware() ? "_" + container.getContext().getName() : "";
+                  }
+               }
+               else if (key.startsWith(Deserializer.PORTAL_CONTAINER_VARIABLE_PREFIX))
+               {
+                  // We try to get a value tied to the current portal container.
+                  ExoContainer container = ExoContainerContext.getCurrentContainerIfPresent();
+                  if (container instanceof PortalContainer)
+                  {
+                     // The current container is a portal container
+                     Object oValue =
+                        ((PortalContainer)container).getSetting(key
+                           .substring(Deserializer.PORTAL_CONTAINER_VARIABLE_PREFIX.length()));
+                     value = oValue == null ? null : oValue.toString();
+                  }
+               }
+               else
+               {
+                  value = System.getProperty(key);
+               }
+               if (value != null)
+               {
+                  properties = true;
+                  buffer.append(value);
+               }
+            }
+            start = i + 1;
+            state = NORMAL;
+         }
+      }
+      if (properties == false)
+         return input;
+      if (start != chars.length)
+         buffer.append(input.substring(start, chars.length));
+      return buffer.toString();
+   
+   }
 }

Added: 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	                        (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,294 @@
+package org.exoplatform.container.definition;
+
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see&lt;http://www.gnu.org/licenses/&gt;.
+ */
+import org.exoplatform.container.RootContainer;
+import org.exoplatform.container.jmx.AbstractTestContainer;
+import org.exoplatform.container.monitor.jvm.J2EEServerInfo;
+
+import java.util.List;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : Nicolas Filotto 
+ *          nicolas.filotto at exoplatform.com
+ * 18 fŽvr. 2010  
+ */
+public class TestPortalContainerConfig extends AbstractTestContainer
+{
+
+   public void testInitValues() throws Exception
+   {
+      RootContainer rootContainer = createRootContainer("empty-config.xml");
+      PortalContainerConfig config =
+         (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+      assertNull(config);
+
+      rootContainer = createRootContainer("portal-container-config-with-no-default-values.xml");
+      config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+
+      assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getDefaultPortalContainer());
+      assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getDefaultRestContext());
+      assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME, config.getDefaultRealmName());
+      assertFalse(config.hasDefinition());
+
+      rootContainer = createRootContainer("portal-container-config-with-default-values.xml");
+      config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+
+      assertEquals("myPortal", config.getDefaultPortalContainer());
+      assertEquals("myRest", config.getDefaultRestContext());
+      assertEquals("my-exo-domain", config.getDefaultRealmName());
+      assertFalse(config.hasDefinition());
+
+      rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
+      config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+
+      assertEquals("myPortal", config.getDefaultPortalContainer());
+      assertEquals("myRest", config.getDefaultRestContext());
+      assertEquals("my-exo-domain", 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);
+
+      assertEquals("myPortal-pcdef", config.getDefaultPortalContainer());
+      assertEquals("myRest-pcdef", config.getDefaultRestContext());
+      assertEquals("my-exo-domain-pcdef", config.getDefaultRealmName());
+      assertTrue(config.hasDefinition());
+   }
+
+   public void testDependencies()
+   {
+      // Without dependencies
+      RootContainer rootContainer =
+         createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
+      PortalContainerConfig config =
+         (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+      assertNull(config.getDependencies("foo"));
+      assertNull(config.getDependencies("myPortal"));
+      assertNull(config.getDependencies("myPortal-pcdef"));
+      List<String> names = config.getPortalContainerNames("foo");
+      assertTrue(names != null && !names.isEmpty());
+      assertEquals("myPortal", 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", 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"));
+      // Needed for backward compatibility
+      assertTrue(config.isScopeValid("foo", "foo"));
+      assertTrue(config.isScopeValid("myPortal", "foo"));
+      assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
+
+      // 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");
+      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"));
+   }
+
+   public void testSettings()
+   {
+      // Without settings and without portal definition
+      RootContainer rootContainer = createRootContainer("portal-container-config-with-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));
+
+      // 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-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-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));
+
+      // With internal settings
+      rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-settings.xml");
+      config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+      assertNull(config.getSetting("foo", "foo"));
+      assertNull(config.getSetting("myPortal", "foo"));
+      assertEquals("value", config.getSetting("myPortal-pcdef", "foo"));
+      assertNull(config.getSetting("foo", "foo2"));
+      assertNull(config.getSetting("myPortal", "foo2"));
+      assertNull(config.getSetting("myPortal-pcdef", "foo2"));
+      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"));
+      assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+      assertNull(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-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));
+
+      // With external settings
+      rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-external-settings.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", "foo2"));
+      assertNull(config.getSetting("myPortal", "foo2"));
+      assertEquals("value", config.getSetting("myPortal-pcdef", "foo2"));
+      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"));
+      assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+      assertNull(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-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));
+
+      // With external settings in exo-conf directory
+      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");
+         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", "foo2"));
+         assertNull(config.getSetting("myPortal", "foo2"));
+         assertEquals("value 2", config.getSetting("myPortal-pcdef", "foo2"));
+         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"));
+         assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+         assertNull(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-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));
+      }
+      finally
+      {
+         if (oldPath != null)
+         {
+            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);
+      assertNull(config.getSetting("foo", "foo"));
+      assertNull(config.getSetting("myPortal", "foo"));
+      assertEquals("value", config.getSetting("myPortal-pcdef", "foo"));
+      assertNull(config.getSetting("foo", "foo2"));
+      assertNull(config.getSetting("myPortal", "foo2"));
+      assertEquals("value", config.getSetting("myPortal-pcdef", "foo2"));
+      assertEquals("new value", config.getSetting("myPortal-pcdef", "string"));
+      assertEquals(new Integer(20), config.getSetting("myPortal-pcdef", "int"));
+      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-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-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));      
+   }
+}

Added: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/empty-config.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/empty-config.xml	                        (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/empty-config.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,27 @@
+<?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">
+
+</configuration>
\ No newline at end of file

Added: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/myPortal-pcdef/settings.properties
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/myPortal-pcdef/settings.properties	                        (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/myPortal-pcdef/settings.properties	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,6 @@
+foo2=value 2
+string=new value 2
+int=22
+long=22
+double=22
+boolean=true
\ 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.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings.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.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,121 @@
+<?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>
+		</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>						
+						<!-- 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-external-settings.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings.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.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,68 @@
+<?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>
+		</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>
+						<!-- 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-external-settings2.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings2.xml	                        (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings2.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,68 @@
+<?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>
+		</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>
+						<!-- The path to the external properties file -->
+						<field name="externalSettingsPath">
+							<string>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-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.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.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,64 @@
+<?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>
+		</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-def2.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-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-def2.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,78 @@
+<?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>
+		</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.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings.xml	                        (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,117 @@
+<?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>
+		</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

Added: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values.xml	                        (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,34 @@
+<?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>
+		</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-no-default-values-but-with-portal-def.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-no-default-values-but-with-portal-def.xml	                        (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-no-default-values-but-with-portal-def.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,46 @@
+<?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>
+		<type>org.exoplatform.container.definition.PortalContainerConfig</type>
+	</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-no-default-values.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-no-default-values.xml	                        (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-no-default-values.xml	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,30 @@
+<?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>
+    <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+  </component>
+
+</configuration>
\ No newline at end of file

Added: 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	                        (rev 0)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties	2010-02-18 17:56:36 UTC (rev 1915)
@@ -0,0 +1,6 @@
+foo2=value
+string=new value
+int=20
+long=20
+double=20
+boolean=false
\ No newline at end of file



More information about the exo-jcr-commits mailing list