[exo-jcr-commits] exo-jcr SVN: r2052 - in kernel/tags/2.2.0-GA: exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea and 13 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Mar 11 06:49:06 EST 2010
Author: dkatayev
Date: 2010-03-11 06:49:03 -0500 (Thu, 11 Mar 2010)
New Revision: 2052
Added:
kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/
kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java
kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java
kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestEACache.java
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/default-settings.properties
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-default-portal-def.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-empty-default-portal-def.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/default-settings.properties
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.properties
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/test-trim-value.xml
Removed:
kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java
kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java
Modified:
kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java
kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/resources/conf/portal/test-configuration.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java
kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Deserializer.java
kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/management/rest/annotations/RESTEndpoint.java
kernel/tags/2.2.0-GA/exo.kernel.container/src/main/resources/binding.xml
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/java/org/exoplatform/xml/test/TestConfigurationXML.java
kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties
Log:
EXOJCR-483: Changes from EXOJCR-556 EXOJCR-565 EXOJCR-566 EXOJCR-576 EXOJCR-580 ported to Kernel 2.2.0-GA Tag
Modified: kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/AbstractExoCache.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -245,7 +245,7 @@
/**
* Only puts the data into the cache nothing more
*/
- private V putOnly(K key, V value)
+ protected V putOnly(K key, V value)
{
return cache.put(getFqn(key), key, value);
}
@@ -428,7 +428,7 @@
/**
* Returns the Fqn related to the given name
*/
- private Fqn<Serializable> getFqn(Serializable name)
+ protected Fqn<Serializable> getFqn(Serializable name)
{
return Fqn.fromElements(name);
}
Copied: kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea (from rev 2039, kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea)
Deleted: kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java 2010-03-08 11:16:32 UTC (rev 2039)
+++ kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -1,70 +0,0 @@
-/*
- * 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<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.cache.impl.jboss.ea;
-
-import org.exoplatform.services.cache.ExoCacheConfig;
-import org.jboss.cache.eviction.ExpirationAlgorithm;
-
-
-/**
- * The {@link org.exoplatform.services.cache.ExoCacheConfig} for the {@link ExpirationAlgorithm}
- * implementation
- *
- * Created by The eXo Platform SAS
- * Author : Nicolas Filotto
- * nicolas.filotto at exoplatform.com
- * 8 mars 2010
- */
-public class EAExoCacheConfig extends ExoCacheConfig
-{
-
- private int maxNodes;
-
- private long minTimeToLive;
-
- private long expirationTimeout;
-
- public int getMaxNodes()
- {
- return maxNodes;
- }
-
- public void setMaxNodes(int maxNodes)
- {
- this.maxNodes = maxNodes;
- }
-
- public long getMinTimeToLive()
- {
- return minTimeToLive;
- }
-
- public void setMinTimeToLive(long minTimeToLive)
- {
- this.minTimeToLive = minTimeToLive;
- }
-
- public long getExpirationTimeout()
- {
- return expirationTimeout;
- }
-
- public void setExpirationTimeout(long expirationTimeout)
- {
- this.expirationTimeout = expirationTimeout;
- }
-}
Copied: kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java (from rev 2039, kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheConfig.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,70 @@
+/*
+ * 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<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.cache.impl.jboss.ea;
+
+import org.exoplatform.services.cache.ExoCacheConfig;
+import org.jboss.cache.eviction.ExpirationAlgorithm;
+
+
+/**
+ * The {@link org.exoplatform.services.cache.ExoCacheConfig} for the {@link ExpirationAlgorithm}
+ * implementation
+ *
+ * Created by The eXo Platform SAS
+ * Author : Nicolas Filotto
+ * nicolas.filotto at exoplatform.com
+ * 8 mars 2010
+ */
+public class EAExoCacheConfig extends ExoCacheConfig
+{
+
+ private int maxNodes;
+
+ private long minTimeToLive;
+
+ private long expirationTimeout;
+
+ public int getMaxNodes()
+ {
+ return maxNodes;
+ }
+
+ public void setMaxNodes(int maxNodes)
+ {
+ this.maxNodes = maxNodes;
+ }
+
+ public long getMinTimeToLive()
+ {
+ return minTimeToLive;
+ }
+
+ public void setMinTimeToLive(long minTimeToLive)
+ {
+ this.minTimeToLive = minTimeToLive;
+ }
+
+ public long getExpirationTimeout()
+ {
+ return expirationTimeout;
+ }
+
+ public void setExpirationTimeout(long expirationTimeout)
+ {
+ this.expirationTimeout = expirationTimeout;
+ }
+}
Deleted: kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java 2010-03-08 11:16:32 UTC (rev 2039)
+++ kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -1,180 +0,0 @@
-/*
- * 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<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.cache.impl.jboss.ea;
-
-import org.exoplatform.management.annotations.Managed;
-import org.exoplatform.management.annotations.ManagedDescription;
-import org.exoplatform.management.annotations.ManagedName;
-import org.exoplatform.services.cache.ExoCache;
-import org.exoplatform.services.cache.ExoCacheConfig;
-import org.exoplatform.services.cache.ExoCacheInitException;
-import org.exoplatform.services.cache.impl.jboss.AbstractExoCache;
-import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.ExpirationAlgorithm;
-import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
-
-import java.io.Serializable;
-
-/**
- * The {@link ExpirationAlgorithm} Implementation of an {@link org.exoplatform.services.cache.impl.jboss.ExoCacheCreator}
- * Created by The eXo Platform SAS
- * Author : Nicolas Filotto
- * nicolas.filotto at exoplatform.com
- * 8 mars 2010
- */
-public class EAExoCacheCreator implements ExoCacheCreator
-{
-
- /**
- * The expected implementation name
- */
- public static final String EXPECTED_IMPL = "EA";
-
- /**
- * The default value for the parameter expirationTimeout
- */
- protected long defaultExpirationTimeout;
-
- /**
- * {@inheritDoc}
- */
- public String getExpectedImplementation()
- {
- return EXPECTED_IMPL;
- }
-
- /**
- * {@inheritDoc}
- */
- public Class<? extends ExoCacheConfig> getExpectedConfigType()
- {
- return EAExoCacheConfig.class;
- }
-
- /**
- * @see org.exoplatform.services.cache.impl.jboss.ExoCacheCreator#create(org.exoplatform.services.cache.ExoCacheConfig, org.jboss.cache.Cache)
- */
- public ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache)
- throws ExoCacheInitException
- {
- if (config instanceof EAExoCacheConfig)
- {
- final EAExoCacheConfig eaConfig = (EAExoCacheConfig)config;
- return create(config, cache, eaConfig.getMaxNodes(), eaConfig.getMinTimeToLive(), eaConfig
- .getExpirationTimeout());
- }
- else
- {
- final long period = config.getLiveTime();
- return create(config, cache, config.getMaxSize(), period > 0 ? period * 1000 : 0, defaultExpirationTimeout);
- }
- }
-
- /**
- * Creates a new ExoCache instance with the relevant parameters
- */
- private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache,
- int maxNodes, long minTimeToLive, long expirationTimeout) throws ExoCacheInitException
- {
- final Configuration configuration = cache.getConfiguration();
- final ExpirationAlgorithmConfig ea = new ExpirationAlgorithmConfig();
- ea.setMaxNodes(maxNodes);
- ea.setMinTimeToLive(minTimeToLive);
- ea.setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
- // Create an eviction region config
- final EvictionRegionConfig erc = new EvictionRegionConfig(Fqn.ROOT, ea);
-
- final EvictionConfig evictionConfig = configuration.getEvictionConfig();
- evictionConfig.setDefaultEvictionRegionConfig(erc);
-
- return new EAExoCache(config, cache, ea, expirationTimeout);
- }
-
- /**
- * The {@link ExpirationAlgorithm} implementation of an ExoCache
- */
- public static class EAExoCache extends AbstractExoCache<Serializable, Object>
- {
- private long expirationTimeout;
-
- private final ExpirationAlgorithmConfig ea;
-
- public EAExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, ExpirationAlgorithmConfig ea,
- long expirationTimeout)
- {
- super(config, cache);
- this.ea = ea;
- this.expirationTimeout = expirationTimeout;
- }
-
- /**
- * We set the <code>ExpirationAlgorithmConfig.EXPIRATION_KEY</code> based on the <code>expirationTimeout</code>
- * @see org.exoplatform.services.cache.impl.jboss.AbstractExoCache#putOnly(java.io.Serializable, java.lang.Object)
- */
- @Override
- protected Object putOnly(Serializable key, Object value)
- {
- Fqn<Serializable> fqn = getFqn(key);
- Long future = new Long(System.currentTimeMillis() + expirationTimeout);
- cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, future);
- return cache.put(fqn, key, value);
- }
-
- public void setMaxSize(int max)
- {
- ea.setMaxNodes(max);
- }
-
- public void setLiveTime(long period)
- {
- ea.setMinTimeToLive(period);
- }
-
- @ManagedName("MaxNodes")
- @ManagedDescription("This is the maximum number of nodes allowed in this region. 0 denotes immediate expiry, -1 denotes no limit.")
- public int getMaxSize()
- {
- return ea.getMaxNodes();
- }
-
- @ManagedName("MinTimeToLive")
- @ManagedDescription("the minimum amount of time a node must be allowed to live after being accessed before it is allowed to be considered for eviction. 0 denotes that this feature is disabled, which is the default value.")
- public long getLiveTime()
- {
- return ea.getMinTimeToLive();
- }
-
- @Managed
- @ManagedName("ExpirationTimeout")
- @ManagedDescription("This is the timeout after which the cache entry must be evicted.")
- public long getExpirationTimeout()
- {
- return expirationTimeout;
- }
-
- @Managed
- public void setExpirationTimeout(long expirationTimeout)
- {
- this.expirationTimeout = expirationTimeout;
- }
- }
-}
Copied: kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java (from rev 2039, kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ea/EAExoCacheCreator.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,180 @@
+/*
+ * 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<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.cache.impl.jboss.ea;
+
+import org.exoplatform.management.annotations.Managed;
+import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.management.annotations.ManagedName;
+import org.exoplatform.services.cache.ExoCache;
+import org.exoplatform.services.cache.ExoCacheConfig;
+import org.exoplatform.services.cache.ExoCacheInitException;
+import org.exoplatform.services.cache.impl.jboss.AbstractExoCache;
+import org.exoplatform.services.cache.impl.jboss.ExoCacheCreator;
+import org.jboss.cache.Cache;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.eviction.ExpirationAlgorithm;
+import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
+
+import java.io.Serializable;
+
+/**
+ * The {@link ExpirationAlgorithm} Implementation of an {@link org.exoplatform.services.cache.impl.jboss.ExoCacheCreator}
+ * Created by The eXo Platform SAS
+ * Author : Nicolas Filotto
+ * nicolas.filotto at exoplatform.com
+ * 8 mars 2010
+ */
+public class EAExoCacheCreator implements ExoCacheCreator
+{
+
+ /**
+ * The expected implementation name
+ */
+ public static final String EXPECTED_IMPL = "EA";
+
+ /**
+ * The default value for the parameter expirationTimeout
+ */
+ protected long defaultExpirationTimeout;
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getExpectedImplementation()
+ {
+ return EXPECTED_IMPL;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Class<? extends ExoCacheConfig> getExpectedConfigType()
+ {
+ return EAExoCacheConfig.class;
+ }
+
+ /**
+ * @see org.exoplatform.services.cache.impl.jboss.ExoCacheCreator#create(org.exoplatform.services.cache.ExoCacheConfig, org.jboss.cache.Cache)
+ */
+ public ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache)
+ throws ExoCacheInitException
+ {
+ if (config instanceof EAExoCacheConfig)
+ {
+ final EAExoCacheConfig eaConfig = (EAExoCacheConfig)config;
+ return create(config, cache, eaConfig.getMaxNodes(), eaConfig.getMinTimeToLive(), eaConfig
+ .getExpirationTimeout());
+ }
+ else
+ {
+ final long period = config.getLiveTime();
+ return create(config, cache, config.getMaxSize(), period > 0 ? period * 1000 : 0, defaultExpirationTimeout);
+ }
+ }
+
+ /**
+ * Creates a new ExoCache instance with the relevant parameters
+ */
+ private ExoCache<Serializable, Object> create(ExoCacheConfig config, Cache<Serializable, Object> cache,
+ int maxNodes, long minTimeToLive, long expirationTimeout) throws ExoCacheInitException
+ {
+ final Configuration configuration = cache.getConfiguration();
+ final ExpirationAlgorithmConfig ea = new ExpirationAlgorithmConfig();
+ ea.setMaxNodes(maxNodes);
+ ea.setMinTimeToLive(minTimeToLive);
+ ea.setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
+ // Create an eviction region config
+ final EvictionRegionConfig erc = new EvictionRegionConfig(Fqn.ROOT, ea);
+
+ final EvictionConfig evictionConfig = configuration.getEvictionConfig();
+ evictionConfig.setDefaultEvictionRegionConfig(erc);
+
+ return new EAExoCache(config, cache, ea, expirationTimeout);
+ }
+
+ /**
+ * The {@link ExpirationAlgorithm} implementation of an ExoCache
+ */
+ public static class EAExoCache extends AbstractExoCache<Serializable, Object>
+ {
+ private long expirationTimeout;
+
+ private final ExpirationAlgorithmConfig ea;
+
+ public EAExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, ExpirationAlgorithmConfig ea,
+ long expirationTimeout)
+ {
+ super(config, cache);
+ this.ea = ea;
+ this.expirationTimeout = expirationTimeout;
+ }
+
+ /**
+ * We set the <code>ExpirationAlgorithmConfig.EXPIRATION_KEY</code> based on the <code>expirationTimeout</code>
+ * @see org.exoplatform.services.cache.impl.jboss.AbstractExoCache#putOnly(java.io.Serializable, java.lang.Object)
+ */
+ @Override
+ protected Object putOnly(Serializable key, Object value)
+ {
+ Fqn<Serializable> fqn = getFqn(key);
+ Long future = new Long(System.currentTimeMillis() + expirationTimeout);
+ cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, future);
+ return cache.put(fqn, key, value);
+ }
+
+ public void setMaxSize(int max)
+ {
+ ea.setMaxNodes(max);
+ }
+
+ public void setLiveTime(long period)
+ {
+ ea.setMinTimeToLive(period);
+ }
+
+ @ManagedName("MaxNodes")
+ @ManagedDescription("This is the maximum number of nodes allowed in this region. 0 denotes immediate expiry, -1 denotes no limit.")
+ public int getMaxSize()
+ {
+ return ea.getMaxNodes();
+ }
+
+ @ManagedName("MinTimeToLive")
+ @ManagedDescription("the minimum amount of time a node must be allowed to live after being accessed before it is allowed to be considered for eviction. 0 denotes that this feature is disabled, which is the default value.")
+ public long getLiveTime()
+ {
+ return ea.getMinTimeToLive();
+ }
+
+ @Managed
+ @ManagedName("ExpirationTimeout")
+ @ManagedDescription("This is the timeout after which the cache entry must be evicted.")
+ public long getExpirationTimeout()
+ {
+ return expirationTimeout;
+ }
+
+ @Managed
+ public void setExpirationTimeout(long expirationTimeout)
+ {
+ this.expirationTimeout = expirationTimeout;
+ }
+ }
+}
Modified: kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/lfu/LFUExoCacheCreator.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -51,7 +51,7 @@
public static final String EXPECTED_IMPL = "LFU";
/**
- * The default value for the parameter maxAge
+ * The default value for the parameter minNodes
*/
protected int defaultMinNodes;
Copied: kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestEACache.java (from rev 2039, kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestEACache.java)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestEACache.java (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestEACache.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+package org.exoplatform.services.cache.impl.jboss;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheCreator.EAExoCache;
+import org.exoplatform.test.BasicTestCase;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : eXoPlatform
+ * exo at exoplatform.com
+ * 21 juil. 2009
+ */
+public class TestEACache extends BasicTestCase
+{
+
+ CacheService service_;
+
+ public TestEACache(String name)
+ {
+ super(name);
+ }
+
+ public void setUp() throws Exception
+ {
+ service_ = (CacheService)PortalContainer.getInstance().getComponentInstanceOfType(CacheService.class);
+ }
+
+ public void testPolicy() throws Exception
+ {
+ testPolicy("test-ea");
+ testPolicy("test-ea-with-old-config");
+ }
+
+ private void testPolicy(String cacheName) throws Exception
+ {
+ EAExoCache cache = (EAExoCache)service_.getCacheInstance(cacheName);
+ cache.put("a", "a");
+ cache.put("b", "a");
+ cache.put("c", "a");
+ cache.put("d", "a");
+ Thread.sleep(1000);
+ assertEquals(4, cache.getCacheSize());
+ cache.put("e", "a");
+ assertEquals(5, cache.getCacheSize());
+ cache.put("f", "a");
+ assertEquals(6, cache.getCacheSize());
+ Thread.sleep(1100);
+ assertEquals(2, cache.getCacheSize());
+ Thread.sleep(1000);
+ assertEquals(0, cache.getCacheSize());
+ cache.setMaxSize(3);
+ cache.setLiveTime(400);
+ cache.setExpirationTimeout(500);
+ cache.put("a", "a");
+ cache.put("b", "a");
+ cache.put("c", "a");
+ cache.put("d", "a");
+ assertEquals(4, cache.getCacheSize());
+ cache.put("e", "a");
+ assertEquals(5, cache.getCacheSize());
+ cache.put("f", "a");
+ Thread.sleep(600);
+ assertEquals(0, cache.getCacheSize());
+ }
+}
Modified: kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/resources/conf/portal/test-configuration.xml
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/resources/conf/portal/test-configuration.xml 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/resources/conf/portal/test-configuration.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -122,7 +122,27 @@
<field name="maxAge"><long>2000</long></field>
<field name="timeToLive"><long>1500</long></field>
</object>
- </object-param>
+ </object-param>
+ <object-param>
+ <name>test-ea-with-old-config</name>
+ <description>The default cache configuration</description>
+ <object type="org.exoplatform.services.cache.ExoCacheConfig">
+ <field name="name"><string>test-ea-with-old-config</string></field>
+ <field name="maxSize"><int>5</int></field>
+ <field name="liveTime"><long>1</long></field>
+ <field name="implementation"><string>EA</string></field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>test-ea</name>
+ <description>The default cache configuration</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
+ <field name="name"><string>test-ea</string></field>
+ <field name="maxNodes"><int>5</int></field>
+ <field name="minTimeToLive"><long>1000</long></field>
+ <field name="expirationTimeout"><long>2000</long></field>
+ </object>
+ </object-param>
</init-params>
</component>
@@ -174,7 +194,14 @@
<field name="defaultTimeToLive"><long>1500</long></field>
<field name="defaultMaxAge"><long>2000</long></field>
</object>
- </object-param>
+ </object-param>
+ <object-param>
+ <name>EA</name>
+ <description>The ea cache creator</description>
+ <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheCreator">
+ <field name="defaultExpirationTimeout"><long>2000</long></field>
+ </object>
+ </object-param>
</init-params>
</component-plugin>
</external-component-plugins>
Modified: kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -19,12 +19,14 @@
package org.exoplatform.container.definition;
import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.PropertyConfigurator;
import org.exoplatform.container.RootContainer;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.monitor.jvm.J2EEServerInfo;
import org.exoplatform.container.util.ContainerUtil;
import org.exoplatform.container.xml.Deserializer;
import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ObjectParameter;
import org.exoplatform.container.xml.ValueParam;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -36,6 +38,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -76,34 +79,27 @@
/**
* The default name of a portal container
*/
- public static final String DEFAULT_PORTAL_CONTAINER_NAME = "portal";
+ // We use new String to create a new object in order to use the operator ==
+ public static final String DEFAULT_PORTAL_CONTAINER_NAME = new String("portal");
/**
* The default name of a the {@link ServletContext} of the rest web application
*/
- public static final String DEFAULT_REST_CONTEXT_NAME = "rest";
+ // We use new String to create a new object in order to use the operator ==
+ public static final String DEFAULT_REST_CONTEXT_NAME = new String("rest");
/**
* The default realm name
*/
- public static final String DEFAULT_REALM_NAME = "exo-domain";
+ // We use new String to create a new object in order to use the operator ==
+ public static final String DEFAULT_REALM_NAME = new String("exo-domain");
/**
- * The name of the default portal container
+ * The default {@link PortalContainerDefinition}
*/
- private String defaultPortalContainerName;
+ private final PortalContainerDefinition defaultDefinition;
/**
- * The name of the default rest {@link ServletContext}
- */
- private String defaultRestContextName;
-
- /**
- * The name of the default realm
- */
- private String defaultRealmName;
-
- /**
* Indicates if the component has already been initialized
*/
private volatile boolean initialized;
@@ -134,47 +130,189 @@
*/
private final J2EEServerInfo serverInfo;
+ /**
+ * Indicates if new system properties have been added
+ */
+ private final PropertyConfigurator pc;
+
public PortalContainerConfig(ConfigurationManager cm)
{
- this(null, cm, new J2EEServerInfo());
+ this(null, cm, new J2EEServerInfo(), null);
}
+ public PortalContainerConfig(ConfigurationManager cm, PropertyConfigurator pc)
+ {
+ this(null, cm, new J2EEServerInfo(), pc);
+ }
+
public PortalContainerConfig(ConfigurationManager cm, J2EEServerInfo serverInfo)
{
- this(null, cm, serverInfo);
+ this(null, cm, serverInfo, null);
}
+ public PortalContainerConfig(ConfigurationManager cm, J2EEServerInfo serverInfo, PropertyConfigurator pc)
+ {
+ this(null, cm, serverInfo, pc);
+ }
+
+ public PortalContainerConfig(InitParams params, ConfigurationManager cm)
+ {
+ this(params, cm, new J2EEServerInfo(), null);
+ }
+
+ public PortalContainerConfig(InitParams params, ConfigurationManager cm, PropertyConfigurator pc)
+ {
+ this(params, cm, new J2EEServerInfo(), pc);
+ }
+
public PortalContainerConfig(InitParams params, ConfigurationManager cm, J2EEServerInfo serverInfo)
{
+ this(params, cm, serverInfo, null);
+ }
+
+ /**
+ * We add the {@link PropertyConfigurator} in the constructor, in order to make sure that it is
+ * created before since it could define some JVM parameters that could be used internally by the
+ * {@link PortalContainerConfig}
+ */
+ public PortalContainerConfig(InitParams params, ConfigurationManager cm, J2EEServerInfo serverInfo,
+ PropertyConfigurator pc)
+ {
+ this.pc = pc;
this.cm = cm;
this.serverInfo = serverInfo;
- if (params == null)
+ this.defaultDefinition = create(params);
+ }
+
+ /**
+ * Create the default {@link PortalContainerDefinition} corresponding to the given parameters
+ * @param params the parameter to initialize
+ */
+ private PortalContainerDefinition create(InitParams params)
+ {
+ ObjectParameter oDpd = null;
+ if (params != null)
{
- return;
+ oDpd = params.getObjectParam("default.portal.definition");
}
- final ValueParam vDpc = params.getValueParam("default.portal.container");
- if (vDpc != null && vDpc.getValue().trim().length() > 0)
+ PortalContainerDefinition def = null;
+ if (oDpd != null)
{
- this.defaultPortalContainerName = vDpc.getValue().trim();
+ // A default portal definition has been found
+ final Object o = oDpd.getObject();
+ if (o instanceof PortalContainerDefinition)
+ {
+ // The nested object is of the right type
+ def = (PortalContainerDefinition)o;
+ }
+ else
+ {
+ // The nested object is not of the right type, thus it will be ignored
+ log.warn("The object parameter 'default.portal.definition' should be of type "
+ + PortalContainerDefinition.class);
+ }
}
- final ValueParam vRc = params.getValueParam("default.rest.context");
- if (vRc != null && vRc.getValue().trim().length() > 0)
+ if (def == null)
{
- this.defaultRestContextName = vRc.getValue().trim();
+ def = new PortalContainerDefinition();
}
- final ValueParam vRn = params.getValueParam("default.realm.name");
- if (vRn != null && vRn.getValue().trim().length() > 0)
+ initName(params, def);
+ initRestContextName(params, def);
+ initRealmName(params, def);
+ initializeSettings(def, false);
+ return def;
+ }
+
+ /**
+ * Initialize the value of the realm name
+ */
+ private void initRealmName(InitParams params, PortalContainerDefinition def)
+ {
+ if (def.getRealmName() == null || def.getRealmName().trim().length() == 0)
{
- this.defaultRealmName = vRn.getValue().trim();
+ // The realm name is empty
+ // We first set the default value
+ def.setRealmName(DEFAULT_REALM_NAME);
+ if (params == null)
+ {
+ return;
+ }
+ final ValueParam vp = params.getValueParam("default.realm.name");
+ if (vp != null && vp.getValue().trim().length() > 0)
+ {
+ // A realm name has been defined in the value parameter, thus we use it
+ def.setRealmName(vp.getValue().trim());
+ }
}
+ else
+ {
+ // We ensure that the realm name doesn't contain any useless characters
+ def.setRealmName(def.getRealmName().trim());
+ }
}
/**
+ * Initialize the value of the rest context name
+ */
+ private void initRestContextName(InitParams params, PortalContainerDefinition def)
+ {
+ if (def.getRestContextName() == null || def.getRestContextName().trim().length() == 0)
+ {
+ // The rest context name is empty
+ // We first set the default value
+ def.setRestContextName(DEFAULT_REST_CONTEXT_NAME);
+ if (params == null)
+ {
+ return;
+ }
+ final ValueParam vp = params.getValueParam("default.rest.context");
+ if (vp != null && vp.getValue().trim().length() > 0)
+ {
+ // A rest context name has been defined in the value parameter, thus we use it
+ def.setRestContextName(vp.getValue().trim());
+ }
+ }
+ else
+ {
+ // We ensure that the rest context name doesn't contain any useless characters
+ def.setRestContextName(def.getRestContextName().trim());
+ }
+ }
+
+ /**
+ * Initialize the value of the portal container name
+ */
+ private void initName(InitParams params, PortalContainerDefinition def)
+ {
+ if (def.getName() == null || def.getName().trim().length() == 0)
+ {
+ // The name is empty
+ // We first set the default value
+ def.setName(DEFAULT_PORTAL_CONTAINER_NAME);
+ if (params == null)
+ {
+ return;
+ }
+ final ValueParam vp = params.getValueParam("default.portal.container");
+ if (vp != null && vp.getValue().trim().length() > 0)
+ {
+ // A name has been defined in the value parameter, thus we use it
+ def.setName(vp.getValue().trim());
+ }
+ }
+ else
+ {
+ // We ensure that the name doesn't contain any useless characters
+ def.setName(def.getName().trim());
+ }
+ }
+
+ /**
* @return the default name of the portal container
*/
public String getDefaultPortalContainer()
{
- return defaultPortalContainerName;
+ return defaultDefinition.getName();
}
/**
@@ -182,7 +320,7 @@
*/
public String getDefaultRestContext()
{
- return defaultRestContextName;
+ return defaultDefinition.getRestContextName();
}
/**
@@ -190,7 +328,7 @@
*/
public String getDefaultRealmName()
{
- return defaultRealmName;
+ return defaultDefinition.getRealmName();
}
/**
@@ -259,7 +397,7 @@
{
// we assume the old behavior is expected
final String portalContainerName =
- portalContainerNames.contains(contextName) ? contextName : defaultPortalContainerName;
+ portalContainerNames.contains(contextName) ? contextName : defaultDefinition.getName();
return Collections.singletonList(portalContainerName);
}
return result;
@@ -286,7 +424,7 @@
if (result == null || result.isEmpty())
{
// we assume the old behavior is expected
- return defaultPortalContainerName;
+ return defaultDefinition.getName();
}
return result.get(0);
}
@@ -299,7 +437,12 @@
public List<String> getDependencies(String portalContainerName)
{
final PortalContainerDefinition definition = definitions.get(portalContainerName);
- return definition == null ? null : definition.getDependencies();
+ List<String> result = null;
+ if (definition != null)
+ {
+ result = definition.getDependencies();
+ }
+ return result == null ? defaultDefinition.getDependencies() : result;
}
/**
@@ -316,31 +459,35 @@
throw new IllegalArgumentException("The setting name cannot be null");
}
final PortalContainerDefinition definition = definitions.get(portalContainerName);
- if (definition == null)
+ if (definition != null)
{
- return null;
+ final Map<String, Object> settings = definition.getSettings();
+ if (settings != null)
+ {
+ return settings.get(settingName);
+ }
}
- final Map<String, Object> settings = definition.getSettings();
- return settings == null ? null : settings.get(settingName);
+ final Map<String, Object> defaultSettings = defaultDefinition.getSettings();
+ return defaultSettings == null ? null : defaultSettings.get(settingName);
}
/**
* Gives the name of the rest {@link ServletContext} related to the given portal container
* @param portalContainerName the name of the portal container for which we want the rest context name
* @return the name of the related rest context name. It tries to get it from the {@link PortalContainerDefinition}
- * if it has not been set it will return <code>defaultRestContextName</code>
+ * if it has not been set it will return <code>defaultDefinition.getRestContextName()</code>
*/
public String getRestContextName(String portalContainerName)
{
final PortalContainerDefinition definition = definitions.get(portalContainerName);
if (definition == null)
{
- return defaultRestContextName;
+ return defaultDefinition.getRestContextName();
}
else
{
String contextName = definition.getRestContextName();
- return contextName == null ? defaultRestContextName : contextName;
+ return contextName == null ? defaultDefinition.getRestContextName() : contextName;
}
}
@@ -348,19 +495,19 @@
* Gives the name of the realm related to the given portal container
* @param portalContainerName the name of the portal container for which we want the realm name
* @return the name of the related realm name. It tries to get it from the {@link PortalContainerDefinition}
- * if it has not been set it will return <code>defaultRealmName</code>
+ * if it has not been set it will return <code>defaultDefinition.getRealmName()</code>
*/
public String getRealmName(String portalContainerName)
{
final PortalContainerDefinition definition = definitions.get(portalContainerName);
if (definition == null)
{
- return defaultRealmName;
+ return defaultDefinition.getRealmName();
}
else
{
String realmName = definition.getRealmName();
- return realmName == null ? defaultRealmName : realmName;
+ return realmName == null ? defaultDefinition.getRealmName() : realmName;
}
}
@@ -406,7 +553,7 @@
String name = def.getName();
if (name == null || (name = name.trim()).length() == 0)
{
- log.warn("A PortalContainerDefinition cannot have empty name");
+ log.warn("A PortalContainerDefinition cannot have an empty name");
continue;
}
else
@@ -429,10 +576,15 @@
*/
private void registerDependencies(PortalContainerDefinition definition, Map<String, List<String>> scopes)
{
- final List<String> dependencies = definition.getDependencies();
+ List<String> dependencies = definition.getDependencies();
if (dependencies == null || dependencies.isEmpty())
{
- return;
+ // Try to get the default dependencies
+ dependencies = defaultDefinition.getDependencies();
+ if (dependencies == null || dependencies.isEmpty())
+ {
+ return;
+ }
}
for (String context : dependencies)
{
@@ -467,25 +619,38 @@
* portal container name, the realm name and the rest context name.
* @param def the {@link PortalContainerDefinition} from which we have the extract the
* settings and in which we have to re-inject the final settings
+ * @param addDefaultSettings indicates whether the settings of the default portal
+ * container definition has to be loaded first
*/
- private void initializeSettings(PortalContainerDefinition def)
+ private void initializeSettings(PortalContainerDefinition def, boolean addDefaultSettings)
{
+ // The list of portal container definition for which we want to load the settings
+ final PortalContainerDefinition[] defs;
+ if (addDefaultSettings)
+ {
+ // We need to load the default settings then the settings of the current portal
+ // container definition
+ defs = new PortalContainerDefinition[]{defaultDefinition, def};
+ }
+ else
+ {
+ // We only need to load the settings of the current portal container definition
+ defs = new PortalContainerDefinition[]{def};
+ }
final Map<String, Object> settings = new HashMap<String, Object>();
- // We first load the settings of the PortalContainerDefinition if they exist
- final Map<String, Object> tmpSettings = def.getSettings();
- if (tmpSettings != null && !tmpSettings.isEmpty())
+ loadInternalSettings(defs, settings);
+ if (pc != null)
{
- settings.putAll(tmpSettings);
+ resolveInternalSettings(settings);
}
- // We then load the external settings, if they exists
- String path = def.getExternalSettingsPath();
- if (path != null && (path = path.trim()).length() > 0)
+
+ final Map<String, String> externalSettings = new LinkedHashMap<String, String>();
+ loadExternalSettings(def, defs, externalSettings);
+ if (!externalSettings.isEmpty())
{
- final Map<String, String> props = loadExternalSettings(path, def);
- if (props != null && !props.isEmpty())
- {
- mergeSettings(settings, props);
- }
+ resolveExternalSettings(def, settings, externalSettings);
+ // Merge the settings
+ mergeSettings(settings, externalSettings);
}
// We then add the main settings
settings.putAll(getMainSettings(def));
@@ -494,6 +659,87 @@
}
/**
+ * Creates a context from the internal settings, external settings and the main settings and
+ * try to resolve variables defined in the external settings
+ */
+ private void resolveExternalSettings(PortalContainerDefinition def, final Map<String, Object> settings,
+ final Map<String, String> externalSettings)
+ {
+ // Create the context for variable resolution
+ final Map<String, Object> ctx = new LinkedHashMap<String, Object>();
+ ctx.putAll(settings);
+ ctx.putAll(externalSettings);
+ ctx.putAll(getMainSettings(def));
+ // Resolve variables
+ for (Map.Entry<String, String> entry : externalSettings.entrySet())
+ {
+ String propertyName = entry.getKey();
+ String propertyValue = entry.getValue();
+ propertyValue = Deserializer.resolveVariables(propertyValue, ctx);
+ externalSettings.put(propertyName, propertyValue);
+ ctx.put(propertyName, propertyValue);
+ }
+ }
+
+ /**
+ * Loads the external settings of all the given {@link PortalContainerDefinition}
+ */
+ private void loadExternalSettings(PortalContainerDefinition def, final PortalContainerDefinition[] defs,
+ final Map<String, String> externalSettings)
+ {
+ for (PortalContainerDefinition pcd : defs)
+ {
+ // We then load the external settings, if they exists
+ String path = pcd.getExternalSettingsPath();
+ if (path != null && (path = path.trim()).length() > 0)
+ {
+ final Map<String, String> props =
+ loadExternalSettings(path, defaultDefinition == null || pcd == defaultDefinition, def);
+ if (props != null && !props.isEmpty())
+ {
+ externalSettings.putAll(props);
+ }
+ }
+ }
+ }
+
+ /**
+ * Try to resolve all the String values to ensure that there is no variables unresolved
+ * The {@link PropertyConfigurator} cans create new system property so it could be
+ * necessary to resolve the {@link String} settings one more time
+ */
+ private void resolveInternalSettings(final Map<String, Object> settings)
+ {
+ // New System properties have been added so we will try to re-resolve the String variables
+ for (Map.Entry<String, Object> entry : settings.entrySet())
+ {
+ String propertyName = entry.getKey();
+ Object propertyValue = entry.getValue();
+ if (propertyValue instanceof String)
+ {
+ propertyValue = Deserializer.resolveVariables((String)propertyValue);
+ settings.put(propertyName, propertyValue);
+ }
+ }
+ }
+
+ /**
+ * Loads all the internal settings related to the given array of {@link PortalContainerDefinition}
+ */
+ private void loadInternalSettings(final PortalContainerDefinition[] defs, final Map<String, Object> settings)
+ {
+ for (PortalContainerDefinition pcd : defs)
+ {
+ // We first load the internal settings if they exists
+ final Map<String, Object> tmpSettings = pcd.getSettings();
+ if (tmpSettings != null && !tmpSettings.isEmpty())
+ {
+ settings.putAll(tmpSettings);
+ }
+ }
+ }
+
+ /**
* This method gives the main settings such as the portal container name, the rest context name
* and the realm name into a {@link Map}
* @param def the {@link PortalContainerDefinition} from which we extract the value of the main
@@ -506,10 +752,11 @@
// We add the portal container name
settings.put(PORTAL_CONTAINER_SETTING_NAME, def.getName());
// We add the rest context name
- settings.put(REST_CONTEXT_SETTING_NAME, def.getRestContextName() == null ? defaultRestContextName : def
- .getRestContextName());
+ settings.put(REST_CONTEXT_SETTING_NAME, def.getRestContextName() == null ? defaultDefinition.getRestContextName()
+ : def.getRestContextName());
// We add the realm name
- settings.put(REALM_SETTING_NAME, def.getRealmName() == null ? defaultRealmName : def.getRealmName());
+ settings.put(REALM_SETTING_NAME, def.getRealmName() == null ? defaultDefinition.getRealmName() : def
+ .getRealmName());
return settings;
}
@@ -520,8 +767,12 @@
* <li>The path doesn't contain any prefix of type "classpath:", "jar:" or "file:", we
* assume that the file could be externalized so we apply the following rules:
* <ol>
- * <li>A file exists at ${exo-conf-dir}/portal/${portalContainerName}/${path}, we
- * will load this file</li>
+ * <li>The value of the parameter <code>isPath4DefaultPCD</code> is <code>true</code> which
+ * means that the given url comes from the default portal container definition and a file
+ * exists at ${exo-conf-dir}/portal/${path}, we will load this file</li>
+ * <li>The value of the parameter <code>isPath4DefaultPCD</code> is <code>false</code> which
+ * means that the given url doesn't come from the default portal container definition and a file
+ * exists at ${exo-conf-dir}/portal/${portalContainerName}/${path}, we will load this file</li>
* <li>No file exists at the previous path, we then assume that the path cans be
* interpreted by the {@link ConfigurationManager}</li>
* </ol>
@@ -530,10 +781,13 @@
* by the {@link ConfigurationManager}</li>
* </ol>
* @param path the path of the external settings to load
+ * @param isPath4DefaultPCD indicates if the given path comes from the default portal
+ * container definition
* @param def the {@link PortalContainerDefinition} for which we load the external settings
* @return A {@link Map} of settings if the file could be loaded, <code>null</code> otherwise
*/
- private Map<String, String> loadExternalSettings(String path, PortalContainerDefinition def)
+ private Map<String, String> loadExternalSettings(String path, boolean isPath4DefaultPCD,
+ PortalContainerDefinition def)
{
try
{
@@ -541,7 +795,9 @@
if (path.indexOf(':') == -1)
{
// We first check if the file is not in eXo configuration directory
- String fullPath = serverInfo.getExoConfigurationDirectory() + "/portal/" + def.getName() + "/" + path;
+ String fullPath =
+ serverInfo.getExoConfigurationDirectory() + "/portal/" + (isPath4DefaultPCD ? "" : def.getName() + "/")
+ + path;
File file = new File(fullPath);
if (file.exists())
{
@@ -555,7 +811,7 @@
url = cm.getURL(path);
}
// We load the properties from the url found
- return ContainerUtil.loadProperties(url, getMainSettings(def));
+ return ContainerUtil.loadProperties(url, false);
}
catch (Exception e)
{
@@ -667,54 +923,45 @@
*/
private void initialize(Map<String, PortalContainerDefinition> mDefinitions)
{
- if (mDefinitions.isEmpty())
- {
- // No definitions have been found, the default values will be set
- if (defaultPortalContainerName == null)
- {
- this.defaultPortalContainerName = DEFAULT_PORTAL_CONTAINER_NAME;
- }
- }
final List<String> lPortalContainerNames = new ArrayList<String>(mDefinitions.size() + 1);
// Add the default portal container name
- if (defaultPortalContainerName != null)
- {
- lPortalContainerNames.add(defaultPortalContainerName);
- }
+ lPortalContainerNames.add(defaultDefinition.getName());
final Map<String, List<String>> mScopes = new HashMap<String, List<String>>();
for (Map.Entry<String, PortalContainerDefinition> entry : mDefinitions.entrySet())
{
PortalContainerDefinition definition = entry.getValue();
String name = definition.getName();
- if (!name.equals(defaultPortalContainerName))
+ boolean hasChanged = false;
+ if (!name.equals(defaultDefinition.getName()))
{
- if (defaultPortalContainerName == null)
+ if (defaultDefinition.getName() == DEFAULT_PORTAL_CONTAINER_NAME)
{
- this.defaultPortalContainerName = name;
+ defaultDefinition.setName(name);
+ hasChanged = true;
}
lPortalContainerNames.add(name);
}
- if (defaultRestContextName == null)
+ if (defaultDefinition.getRestContextName() == DEFAULT_REST_CONTEXT_NAME
+ && definition.getRestContextName() != null && definition.getRestContextName().trim().length() > 0)
{
- this.defaultRestContextName = definition.getRestContextName();
+ defaultDefinition.setRestContextName(definition.getRestContextName().trim());
+ hasChanged = true;
}
- if (defaultRealmName == null)
+ if (defaultDefinition.getRealmName() == DEFAULT_REALM_NAME && definition.getRealmName() != null
+ && definition.getRealmName().trim().length() > 0)
{
- this.defaultRealmName = definition.getRealmName();
+ defaultDefinition.setRealmName(definition.getRealmName().trim());
+ hasChanged = true;
}
registerDependencies(definition, mScopes);
- initializeSettings(definition);
+ if (hasChanged)
+ {
+ initializeSettings(defaultDefinition, false);
+ }
+ initializeSettings(definition, true);
}
this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
this.scopes = Collections.unmodifiableMap(mScopes);
- if (defaultRestContextName == null)
- {
- this.defaultRestContextName = DEFAULT_REST_CONTEXT_NAME;
- }
- if (defaultRealmName == null)
- {
- this.defaultRealmName = DEFAULT_REALM_NAME;
- }
}
/**
Modified: kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/util/ContainerUtil.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -208,16 +208,16 @@
*/
public static Map<String, String> loadProperties(URL url)
{
- return loadProperties(url, null);
+ return loadProperties(url, true);
}
/**
* Loads the properties file corresponding to the given url
* @param url the url of the properties file
- * @param initEnv the initial environment that is composed of a set of initial variables
+ * @param resolveVariables indicates if the variables must be resolved
* @return a {@link Map} of properties
*/
- public static Map<String, String> loadProperties(URL url, Map<String, String> initEnv)
+ public static Map<String, String> loadProperties(URL url, boolean resolveVariables)
{
LinkedHashMap<String, String> props = null;
String path = null;
@@ -251,15 +251,10 @@
{
log.debug("Will not load property file" + path + " because its format is not recognized");
}
- if (props != null)
+ if (props != null && resolveVariables)
{
// Those properties are used for variables resolution
- final Map<String, String> currentProps = new HashMap<String,String>();
- if (initEnv != null && !initEnv.isEmpty())
- {
- // There are a set of initial variables to load into the environment
- currentProps.putAll(initEnv);
- }
+ final Map<String, Object> currentProps = new HashMap<String, Object>();
for (Map.Entry<String, String> entry : props.entrySet())
{
String propertyName = entry.getKey();
Modified: kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Deserializer.java
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Deserializer.java 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/container/xml/Deserializer.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -54,7 +54,7 @@
*/
public static String resolveString(String s)
{
- return Deserializer.resolveVariables(s);
+ return Deserializer.resolveNClean(s);
}
/**
@@ -77,7 +77,7 @@
{
return null;
}
- s = Deserializer.resolveVariables(s);
+ s = Deserializer.resolveNClean(s);
if (s.equalsIgnoreCase("true"))
{
return true;
@@ -107,7 +107,7 @@
{
return null;
}
- s = Deserializer.resolveVariables(s);
+ s = Deserializer.resolveNClean(s);
try
{
return Integer.parseInt(s);
@@ -136,7 +136,7 @@
{
return null;
}
- s = Deserializer.resolveVariables(s);
+ s = Deserializer.resolveNClean(s);
try
{
return Long.parseLong(s);
@@ -165,7 +165,7 @@
{
return null;
}
- s = Deserializer.resolveVariables(s);
+ s = Deserializer.resolveNClean(s);
try
{
return Double.parseDouble(s);
@@ -178,7 +178,7 @@
/**
* Resolve the variables of type ${my.var} for the current context which is composed
- * of the system properties and the portal container properties
+ * of the system properties and the portal container settings
* @param input the input value
* @return the resolve value
*/
@@ -189,12 +189,12 @@
/**
* Resolve the variables of type ${my.var} for the current context which is composed
- * of the system properties, the portal container properties and the given properties
+ * of the system properties, the portal container settings and the given settings
* @param input the input value
- * @param props a set of properties to add for the variable resolution
+ * @param props a set of parameters to add for the variable resolution
* @return the resolve value
*/
- public static String resolveVariables(String input, Map<String, String> props)
+ public static String resolveVariables(String input, Map<String, Object> props)
{
final int NORMAL = 0;
final int SEEN_DOLLAR = 1;
@@ -257,8 +257,9 @@
{
if (props != null)
{
- // Some properties have been given thus we need to check inside first
- value = props.get(key);
+ // Some parameters have been given thus we need to check inside first
+ Object oValue = props.get(key);
+ value = oValue == null ? null : oValue.toString();
}
if (value == null)
{
@@ -284,4 +285,25 @@
return buffer.toString();
}
+
+ /**
+ * This methods will remove useless characters from the given {@link String} and return the result
+ * @param s the input value
+ * @return <code>null</code> if the input value is <code>null</code>, <code>s.trim()</code>
+ * otherwise
+ */
+ public static String cleanString(String s)
+ {
+ return s == null ? null : s.trim();
+ }
+
+ /**
+ * This method will first resolves the variables then it will clean the results
+ * @param s the input value
+ * @return the resolve and clean value
+ */
+ public static String resolveNClean(String s)
+ {
+ return cleanString(resolveVariables(s));
+ }
}
Modified: kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/management/rest/annotations/RESTEndpoint.java
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/management/rest/annotations/RESTEndpoint.java 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/main/java/org/exoplatform/management/rest/annotations/RESTEndpoint.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -17,7 +17,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.exoplatform.management.management.annotations;
+package org.exoplatform.management.rest.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Modified: kernel/tags/2.2.0-GA/exo.kernel.container/src/main/resources/binding.xml
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/main/resources/binding.xml 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/main/resources/binding.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -19,6 +19,9 @@
-->
<binding>
+ <!-- the default deserializer to use for String -->
+ <format type="java.lang.String" deserializer="org.exoplatform.container.xml.Deserializer.cleanString"/>
+
<!-- xml object mapping -->
<mapping class="org.exoplatform.xml.object.XMLBaseObject" abstract="true" label="base-object">
<value name="string" usage="optional" get-method="getString" set-method="setString" deserializer="org.exoplatform.container.xml.Deserializer.resolveString"/>
Modified: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -54,6 +54,15 @@
assertEquals("my-exo-domain", config.getDefaultRealmName());
assertFalse(config.hasDefinition());
+ rootContainer =
+ createRootContainer("portal-container-config-with-default-values-and-with-default-portal-def.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+
+ assertEquals("myPortal-dpcdef", config.getDefaultPortalContainer());
+ assertEquals("myRest-dpcdef", config.getDefaultRestContext());
+ assertEquals("my-exo-domain-dpcdef", config.getDefaultRealmName());
+ assertFalse(config.hasDefinition());
+
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -62,6 +71,15 @@
assertEquals("my-exo-domain", config.getDefaultRealmName());
assertTrue(config.hasDefinition());
+ rootContainer =
+ createRootContainer("portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+
+ assertEquals("myPortal-dpcdef", config.getDefaultPortalContainer());
+ assertEquals("myRest-dpcdef", config.getDefaultRestContext());
+ assertEquals("my-exo-domain-dpcdef", config.getDefaultRealmName());
+ assertTrue(config.hasDefinition());
+
rootContainer = createRootContainer("portal-container-config-with-no-default-values-but-with-portal-def.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -107,7 +125,7 @@
assertTrue(config.isScopeValid("myPortal", "foo"));
assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
assertTrue(config.hasDefinition());
-
+
// Without dependencies and with no portal container name
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-empty-portal-def.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -135,7 +153,7 @@
assertFalse(config.isPortalContainerName("foo"));
assertTrue(config.isPortalContainerName("myPortal"));
assertFalse(config.isPortalContainerName("myPortal-pcdef"));
-
+
// Without dependencies and with no rest context name an realm name
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-empty-portal-def2.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -168,13 +186,48 @@
assertTrue(config.isScopeValid("myPortal", "foo"));
assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
assertTrue(config.hasDefinition());
-
+
+ // Without dependencies and with default portal container definition
+ rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ List<String> deps = config.getDependencies("foo");
+ assertTrue(deps != null && deps.size() == 1 && deps.contains("fooX"));
+ deps = config.getDependencies("myPortal");
+ assertTrue(deps != null && deps.size() == 1 && deps.contains("fooX"));
+ deps = config.getDependencies("myPortal-pcdef");
+ assertTrue(deps != null && deps.size() == 1 && deps.contains("fooX"));
+ names = config.getPortalContainerNames("foo");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-dpcdef", names.get(0));
+ names = config.getPortalContainerNames("myPortal");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-dpcdef", names.get(0));
+ names = config.getPortalContainerNames("myPortal-pcdef");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-pcdef", names.get(0));
+ assertEquals("myPortal-dpcdef", config.getPortalContainerName("foo"));
+ assertEquals("myPortal-dpcdef", config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
+ assertEquals("myRest-dpcdef", config.getRestContextName("foo"));
+ assertEquals("myRest-dpcdef", config.getRestContextName("myPortal"));
+ assertEquals("myRest-pcdef", config.getRestContextName("myPortal-pcdef"));
+ assertEquals("my-exo-domain-dpcdef", config.getRealmName("foo"));
+ assertEquals("my-exo-domain-dpcdef", config.getRealmName("myPortal"));
+ assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
+ assertFalse(config.isPortalContainerName("foo"));
+ assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal-pcdef"));
+ assertFalse(config.isScopeValid("foo", "fooX"));
+ assertFalse(config.isScopeValid("myPortal", "fooX"));
+ assertTrue(config.isScopeValid("myPortal-pcdef", "fooX"));
+ assertTrue(config.hasDefinition());
+
// With dependencies
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def2.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
assertNull(config.getDependencies("foo"));
assertNull(config.getDependencies("myPortal"));
- List<String> deps = config.getDependencies("myPortal-pcdef");
+ deps = config.getDependencies("myPortal-pcdef");
assertTrue(deps != null && deps.size() == 3);
names = config.getPortalContainerNames("foo");
assertTrue(names != null && !names.isEmpty());
@@ -201,44 +254,176 @@
assertFalse(config.isScopeValid("myPortal", "foo"));
assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
assertTrue(config.hasDefinition());
+
+ // With dependencies and with default portal container definition
+ rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ deps = config.getDependencies("foo");
+ assertTrue(deps != null && deps.size() == 1 && deps.contains("fooX"));
+ deps = config.getDependencies("myPortal");
+ assertTrue(deps != null && deps.size() == 1 && deps.contains("fooX"));
+ deps = config.getDependencies("myPortal-pcdef");
+ assertTrue(deps != null && deps.size() == 3);
+ names = config.getPortalContainerNames("foo");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-pcdef", names.get(0));
+ names = config.getPortalContainerNames("myPortal");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal", names.get(0));
+ names = config.getPortalContainerNames("myPortal-pcdef");
+ assertTrue(names != null && !names.isEmpty());
+ assertEquals("myPortal-pcdef", names.get(0));
+ assertEquals("myPortal-pcdef", config.getPortalContainerName("foo"));
+ assertEquals("myPortal", config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
+ assertEquals("myRest", config.getRestContextName("foo"));
+ assertEquals("myRest", config.getRestContextName("myPortal"));
+ assertEquals("myRest-pcdef", config.getRestContextName("myPortal-pcdef"));
+ assertEquals("my-exo-domain", config.getRealmName("foo"));
+ assertEquals("my-exo-domain", config.getRealmName("myPortal"));
+ assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
+ assertFalse(config.isPortalContainerName("foo"));
+ assertTrue(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal-pcdef"));
+ assertFalse(config.isScopeValid("foo", "foo"));
+ assertFalse(config.isScopeValid("myPortal", "foo"));
+ assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
+ assertTrue(config.hasDefinition());
}
public void testSettings()
{
- // Without settings and without portal definition
- RootContainer rootContainer = createRootContainer("portal-container-config-with-default-values.xml");
+ // Without settings, without portal definition and without default values
+ RootContainer rootContainer = createRootContainer("portal-container-config-with-no-default-values.xml");
PortalContainerConfig config =
(PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
assertNull(config.getSetting("foo", "foo"));
assertNull(config.getSetting("myPortal", "foo"));
assertNull(config.getSetting("myPortal-pcdef", "foo"));
- assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal-pcdef", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getSetting("foo",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getSetting("myPortal",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getSetting("foo",
+ PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getSetting("myPortal",
+ PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME, config.getSetting("foo",
+ PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME, config.getSetting("myPortal",
+ PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME, config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.REALM_SETTING_NAME));
+ // Without settings and without portal definition
+ rootContainer = createRootContainer("portal-container-config-with-default-values.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal-pcdef", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
+ // Without settings, without portal definition and with empty default portal container definition
+ rootContainer =
+ createRootContainer("portal-container-config-with-default-values-and-with-empty-default-portal-def.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal-pcdef", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
+ // Without settings, without portal definition and with default portal container definition
+ rootContainer =
+ createRootContainer("portal-container-config-with-default-values-and-with-default-portal-def.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("myPortal-dpcdef", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-dpcdef", config
+ .getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-dpcdef", config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config
+ .getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config
+ .getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("value0", config.getSetting("foo", "string"));
+ assertEquals(new Integer(100), config.getSetting("foo", "int"));
+ assertEquals(new Long(100), config.getSetting("foo", "long"));
+ assertEquals(new Double(100), config.getSetting("foo", "double"));
+ assertEquals(new Boolean(false), config.getSetting("foo", "boolean"));
+ assertEquals("value0", config.getSetting("myPortal", "string"));
+ assertEquals(new Integer(100), config.getSetting("myPortal", "int"));
+ assertEquals(new Long(100), config.getSetting("myPortal", "long"));
+ assertEquals(new Double(100), config.getSetting("myPortal", "double"));
+ assertEquals(new Boolean(false), config.getSetting("myPortal", "boolean"));
+ assertEquals("value0", config.getSetting("myPortal-pcdef", "string"));
+ assertEquals(new Integer(100), config.getSetting("myPortal-pcdef", "int"));
+ assertEquals(new Long(100), config.getSetting("myPortal-pcdef", "long"));
+ assertEquals(new Double(100), config.getSetting("myPortal-pcdef", "double"));
+ assertEquals(new Boolean(false), config.getSetting("myPortal-pcdef", "boolean"));
+
// Without settings and with portal definition
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
assertNull(config.getSetting("foo", "foo"));
assertNull(config.getSetting("myPortal", "foo"));
assertNull(config.getSetting("myPortal-pcdef", "foo"));
- assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ // Without settings, with portal definition and with default portal definition
+ rootContainer =
+ createRootContainer("portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("myPortal-dpcdef", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-dpcdef", config
+ .getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
// With internal settings
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-settings.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -253,17 +438,57 @@
assertEquals(new Long(10), config.getSetting("myPortal-pcdef", "long"));
assertEquals(new Double(10), config.getSetting("myPortal-pcdef", "double"));
assertEquals(new Boolean(true), config.getSetting("myPortal-pcdef", "boolean"));
- assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ // With internal settings and default portal definition
+ rootContainer =
+ createRootContainer("portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertNull(config.getSetting("foo", "foo"));
+ assertNull(config.getSetting("myPortal", "foo"));
+ assertEquals("value", config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("value", config.getSetting("foo", "foo2"));
+ assertEquals("value", config.getSetting("myPortal", "foo2"));
+ assertEquals("value", config.getSetting("myPortal-pcdef", "foo2"));
+ assertNull(config.getSetting("foo", "foo3"));
+ assertNull(config.getSetting("myPortal", "foo3"));
+ assertNull(config.getSetting("myPortal-pcdef", "foo3"));
+ assertEquals("myPortal-dpcdef", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-dpcdef", config
+ .getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-dpcdef", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-dpcdef", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("value0", config.getSetting("foo", "string"));
+ assertEquals(new Integer(100), config.getSetting("foo", "int"));
+ assertEquals(new Long(100), config.getSetting("foo", "long"));
+ assertEquals(new Double(100), config.getSetting("foo", "double"));
+ assertEquals(new Boolean(false), config.getSetting("foo", "boolean"));
+ assertEquals("value0", config.getSetting("myPortal", "string"));
+ assertEquals(new Integer(100), config.getSetting("myPortal", "int"));
+ assertEquals(new Long(100), config.getSetting("myPortal", "long"));
+ assertEquals(new Double(100), config.getSetting("myPortal", "double"));
+ assertEquals(new Boolean(false), config.getSetting("myPortal", "boolean"));
+ assertEquals("value", config.getSetting("myPortal-pcdef", "string"));
+ assertEquals(new Integer(10), config.getSetting("myPortal-pcdef", "int"));
+ assertEquals(new Long(10), config.getSetting("myPortal-pcdef", "long"));
+ assertEquals(new Double(10), config.getSetting("myPortal-pcdef", "double"));
+ assertEquals(new Boolean(true), config.getSetting("myPortal-pcdef", "boolean"));
+
// With external settings
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-external-settings.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -278,27 +503,99 @@
assertEquals("20", config.getSetting("myPortal-pcdef", "long"));
assertEquals("20", config.getSetting("myPortal-pcdef", "double"));
assertEquals("false", config.getSetting("myPortal-pcdef", "boolean"));
- assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value-new value", config.getSetting("myPortal-pcdef", "complex-value"));
- assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value-new value", config.getSetting(
+ "myPortal-pcdef", "complex-value"));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
- // With external settings in exo-conf directory
- String path = TestPortalContainerConfig.class.getResource("portal-container-config-with-default-values-and-with-external-settings2.xml").getPath();
+ // Simple usecase from gatein
+ rootContainer = createRootContainer("sample-gtn-configuration.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertEquals("../gatein/data", config.getSetting("portal", "gatein.data.dir"));
+ assertEquals("../gatein/data/db", config.getSetting("portal", "gatein.db.data.dir"));
+ assertEquals("jdbc:hsqldb:file:../gatein/data/db/data/jdbcjcr_portal", config.getSetting("portal", "gatein.jcr.datasource.url"));
+
+ // With external settings, with several portal container definitions and with
+ // default portal container definition
+ rootContainer =
+ createRootContainer("portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertEquals("value0", config.getSetting("foo", "foo"));
+ assertEquals("value0", config.getSetting("myPortal", "foo"));
+ assertEquals("value0", config.getSetting("myPortal0", "foo"));
+ assertEquals("value0", config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("value0", config.getSetting("myPortal2", "foo"));
+ assertNull(config.getSetting("foo", "foo2"));
+ assertNull(config.getSetting("myPortal", "foo2"));
+ assertNull(config.getSetting("myPortal0", "foo2"));
+ assertEquals("value", config.getSetting("myPortal-pcdef", "foo2"));
+ assertNull(config.getSetting("myPortal2", "foo2"));
+ assertEquals("new value0", config.getSetting("foo", "string"));
+ assertEquals("200", config.getSetting("foo", "int"));
+ assertEquals("200", config.getSetting("foo", "long"));
+ assertEquals("200", config.getSetting("foo", "double"));
+ assertEquals("true", config.getSetting("foo", "boolean"));
+ assertEquals("myPortal-myRest-my-exo-domain-value0-new value0", config.getSetting("foo", "complex-value2"));
+ assertEquals("new value0", config.getSetting("myPortal", "string"));
+ assertEquals("200", config.getSetting("myPortal", "int"));
+ assertEquals("200", config.getSetting("myPortal", "long"));
+ assertEquals("200", config.getSetting("myPortal", "double"));
+ assertEquals("true", config.getSetting("myPortal", "boolean"));
+ assertEquals("myPortal-myRest-my-exo-domain-value0-new value0", config.getSetting("myPortal", "complex-value2"));
+ assertEquals("new value0", config.getSetting("myPortal0", "string"));
+ assertEquals("200", config.getSetting("myPortal0", "int"));
+ assertEquals("200", config.getSetting("myPortal0", "long"));
+ assertEquals("200", config.getSetting("myPortal0", "double"));
+ assertEquals("true", config.getSetting("myPortal0", "boolean"));
+ assertEquals("myPortal0-myRest0-my-exo-domain0-value0-new value0", config.getSetting("myPortal0",
+ "complex-value2"));
+ assertEquals("new value", config.getSetting("myPortal-pcdef", "string"));
+ assertEquals("20", config.getSetting("myPortal-pcdef", "int"));
+ assertEquals("20", config.getSetting("myPortal-pcdef", "long"));
+ assertEquals("20", config.getSetting("myPortal-pcdef", "double"));
+ assertEquals("false", config.getSetting("myPortal-pcdef", "boolean"));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value-new value", config.getSetting(
+ "myPortal-pcdef", "complex-value"));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value0-new value", config.getSetting(
+ "myPortal-pcdef", "complex-value2"));
+ assertEquals("new value0", config.getSetting("myPortal2", "string"));
+ assertEquals("200", config.getSetting("myPortal2", "int"));
+ assertEquals("200", config.getSetting("myPortal2", "long"));
+ assertEquals("200", config.getSetting("myPortal2", "double"));
+ assertEquals("true", config.getSetting("myPortal2", "boolean"));
+ assertEquals("myPortal2-myRest2-my-exo-domain2-value0-new value0", config.getSetting("myPortal2",
+ "complex-value2"));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
+ String path =
+ TestPortalContainerConfig.class.getResource(
+ "portal-container-config-with-default-values-and-with-external-settings2.xml").getPath();
path = path.substring(0, path.lastIndexOf('/'));
String oldPath = System.getProperty(J2EEServerInfo.EXO_CONF_PARAM);
-
+
try
{
System.setProperty(J2EEServerInfo.EXO_CONF_PARAM, path);
- rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-external-settings2.xml");
+ // With external settings in exo-conf directory
+ rootContainer =
+ createRootContainer("portal-container-config-with-default-values-and-with-external-settings2.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
assertNull(config.getSetting("foo", "foo"));
assertNull(config.getSetting("myPortal", "foo"));
@@ -311,17 +608,82 @@
assertEquals("22", config.getSetting("myPortal-pcdef", "long"));
assertEquals("22", config.getSetting("myPortal-pcdef", "double"));
assertEquals("true", config.getSetting("myPortal-pcdef", "boolean"));
- assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value 2-new value 2", config.getSetting("myPortal-pcdef", "complex-value"));
- assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value 2-new value 2", config.getSetting(
+ "myPortal-pcdef", "complex-value"));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.REALM_SETTING_NAME));
+
+ // With external settings in exo-conf directory, with several portal container definitions
+ // and with default portal container definition
+ rootContainer =
+ createRootContainer("portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertEquals("value01", config.getSetting("foo", "foo"));
+ assertEquals("value01", config.getSetting("myPortal", "foo"));
+ assertEquals("value01", config.getSetting("myPortal0", "foo"));
+ assertEquals("value01", config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("value01", config.getSetting("myPortal2", "foo"));
+ assertNull(config.getSetting("foo", "foo2"));
+ assertNull(config.getSetting("myPortal", "foo2"));
+ assertNull(config.getSetting("myPortal0", "foo2"));
+ assertEquals("value 2", config.getSetting("myPortal-pcdef", "foo2"));
+ assertNull(config.getSetting("myPortal2", "foo2"));
+ assertEquals("new value01", config.getSetting("foo", "string"));
+ assertEquals("2001", config.getSetting("foo", "int"));
+ assertEquals("2001", config.getSetting("foo", "long"));
+ assertEquals("2001", config.getSetting("foo", "double"));
+ assertEquals("false", config.getSetting("foo", "boolean"));
+ assertEquals("myPortal-myRest-my-exo-domain-value01-new value01", config.getSetting("foo", "complex-value2"));
+ assertEquals("new value01", config.getSetting("myPortal", "string"));
+ assertEquals("2001", config.getSetting("myPortal", "int"));
+ assertEquals("2001", config.getSetting("myPortal", "long"));
+ assertEquals("2001", config.getSetting("myPortal", "double"));
+ assertEquals("false", config.getSetting("myPortal", "boolean"));
+ assertEquals("myPortal-myRest-my-exo-domain-value01-new value01", config.getSetting("myPortal", "complex-value2"));
+ assertEquals("new value01", config.getSetting("myPortal0", "string"));
+ assertEquals("2001", config.getSetting("myPortal0", "int"));
+ assertEquals("2001", config.getSetting("myPortal0", "long"));
+ assertEquals("2001", config.getSetting("myPortal0", "double"));
+ assertEquals("false", config.getSetting("myPortal0", "boolean"));
+ assertEquals("myPortal0-myRest0-my-exo-domain0-value01-new value01", config.getSetting("myPortal0",
+ "complex-value2"));
+ assertEquals("new value 2", config.getSetting("myPortal-pcdef", "string"));
+ assertEquals("22", config.getSetting("myPortal-pcdef", "int"));
+ assertEquals("22", config.getSetting("myPortal-pcdef", "long"));
+ assertEquals("22", config.getSetting("myPortal-pcdef", "double"));
+ assertEquals("true", config.getSetting("myPortal-pcdef", "boolean"));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value 2-new value 2", config.getSetting(
+ "myPortal-pcdef", "complex-value"));
+ assertEquals("myPortal-pcdef-myRest-pcdef-my-exo-domain-pcdef-value01-new value 2", config.getSetting(
+ "myPortal-pcdef", "complex-value2"));
+ assertEquals("new value01", config.getSetting("myPortal2", "string"));
+ assertEquals("2001", config.getSetting("myPortal2", "int"));
+ assertEquals("2001", config.getSetting("myPortal2", "long"));
+ assertEquals("2001", config.getSetting("myPortal2", "double"));
+ assertEquals("false", config.getSetting("myPortal2", "boolean"));
+ assertEquals("myPortal2-myRest2-my-exo-domain2-value01-new value01", config.getSetting("myPortal2",
+ "complex-value2"));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
}
finally
{
@@ -334,7 +696,7 @@
System.setProperty(J2EEServerInfo.EXO_CONF_PARAM, oldPath);
}
}
-
+
// With both settings internal and external
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-both-settings.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -349,17 +711,98 @@
assertEquals(new Long(20), config.getSetting("myPortal-pcdef", "long"));
assertEquals(new Double(20), config.getSetting("myPortal-pcdef", "double"));
assertEquals(new Boolean(false), config.getSetting("myPortal-pcdef", "boolean"));
- assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
- assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
-
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+
+ try
+ {
+ System.setProperty("TestPortalContainerConfig-string", "system value");
+ System.setProperty("TestPortalContainerConfig-int", "50");
+ // With both settings internal and external and default portal container definition
+ rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml");
+ config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
+ assertEquals("value0", config.getSetting("foo", "foo"));
+ assertEquals("value0", config.getSetting("myPortal", "foo"));
+ assertEquals("value0", config.getSetting("myPortal-pcdef", "foo"));
+ assertEquals("value", config.getSetting("foo", "foo2"));
+ assertEquals("value", config.getSetting("myPortal", "foo2"));
+ assertEquals("value", config.getSetting("myPortal-pcdef", "foo2"));
+ assertNull(config.getSetting("foo", "foo3"));
+ assertNull(config.getSetting("myPortal", "foo3"));
+ assertEquals("value", config.getSetting("myPortal-pcdef", "foo3"));
+ assertEquals("-${foo3}-", config.getSetting("foo", "complex-value3"));
+ assertEquals("-${foo3}-", config.getSetting("myPortal", "complex-value3"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef", "complex-value3"));
+ assertNull(config.getSetting("foo", "complex-value4"));
+ assertNull(config.getSetting("myPortal", "complex-value4"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef", "complex-value4"));
+ assertEquals("-value-", config.getSetting("foo", "complex-value5"));
+ assertEquals("-value-", config.getSetting("myPortal", "complex-value5"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef", "complex-value5"));
+ assertNull(config.getSetting("foo", "complex-value6"));
+ assertNull(config.getSetting("myPortal", "complex-value6"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef", "complex-value6"));
+ assertNull(config.getSetting("foo", "complex-value7"));
+ assertNull(config.getSetting("myPortal", "complex-value7"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef", "complex-value7"));
+ assertEquals("-${foo6}-", config.getSetting("foo", "complex-value8"));
+ assertEquals("-${foo6}-", config.getSetting("myPortal", "complex-value8"));
+ assertEquals("-value-", config.getSetting("myPortal-pcdef", "complex-value8"));
+ assertEquals("-property_value_1-", config.getSetting("foo", "complex-value9"));
+ assertEquals("-property_value_1-", config.getSetting("myPortal", "complex-value9"));
+ assertEquals("-property_value_1-", config.getSetting("myPortal-pcdef", "complex-value9"));
+ assertEquals("-system value-", config.getSetting("foo", "cpv1"));
+ assertEquals("-system value-", config.getSetting("myPortal", "cpv1"));
+ assertEquals("-system value-", config.getSetting("myPortal-pcdef", "cpv1"));
+ assertEquals(new Integer(50), config.getSetting("foo", "cpv2"));
+ assertEquals(new Integer(50), config.getSetting("myPortal", "cpv2"));
+ assertEquals(new Integer(50), config.getSetting("myPortal-pcdef", "cpv2"));
+ assertEquals("-property_value_1-", config.getSetting("foo", "cpv3"));
+ assertEquals("-property_value_1-", config.getSetting("myPortal", "cpv3"));
+ assertEquals("-property_value_1-", config.getSetting("myPortal-pcdef", "cpv3"));
+ assertEquals("new value0", config.getSetting("foo", "string"));
+ assertEquals(new Integer(200), config.getSetting("foo", "int"));
+ assertEquals(new Integer(60), config.getSetting("foo", "int2"));
+ assertEquals(new Long(200), config.getSetting("foo", "long"));
+ assertEquals(new Double(200), config.getSetting("foo", "double"));
+ assertEquals(new Boolean(true), config.getSetting("foo", "boolean"));
+ assertEquals("new value0", config.getSetting("myPortal", "string"));
+ assertEquals(new Integer(200), config.getSetting("myPortal", "int"));
+ assertEquals(new Integer(60), config.getSetting("myPortal", "int2"));
+ assertEquals(new Long(200), config.getSetting("myPortal", "long"));
+ assertEquals(new Double(200), config.getSetting("myPortal", "double"));
+ assertEquals(new Boolean(true), config.getSetting("myPortal", "boolean"));
+ assertEquals("new value", config.getSetting("myPortal-pcdef", "string"));
+ assertEquals(new Integer(20), config.getSetting("myPortal-pcdef", "int"));
+ assertEquals(new Integer(60), config.getSetting("myPortal-pcdef", "int2"));
+ assertEquals(new Long(20), config.getSetting("myPortal-pcdef", "long"));
+ assertEquals(new Double(20), config.getSetting("myPortal-pcdef", "double"));
+ assertEquals(new Boolean(false), config.getSetting("myPortal-pcdef", "boolean"));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
+ PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain-pcdef", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ }
+ finally
+ {
+ System.getProperties().remove("TestPortalContainerConfig-string");
+ System.getProperties().remove("TestPortalContainerConfig-int");
+ }
+
// With both settings internal and external, and with invalid values
rootContainer = createRootContainer("portal-container-config-with-invalid-values.xml");
config = (PortalContainerConfig)rootContainer.getComponentInstanceOfType(PortalContainerConfig.class);
@@ -368,15 +811,15 @@
assertEquals("", config.getSetting("myPortal-pcdef", "fake-value-4-string"));
assertEquals(new Integer(10), config.getSetting("myPortal-pcdef", "fake-value-4-int"));
assertEquals(new Integer(10), config.getSetting("myPortal-pcdef", "invalid-value-4-int"));
- assertNull(config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("foo", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
+ assertEquals("myPortal", config.getSetting("myPortal", PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
assertEquals("myPortal-pcdef", config.getSetting("myPortal-pcdef",
PortalContainerConfig.PORTAL_CONTAINER_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("foo", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
+ assertEquals("myRest", config.getSetting("myPortal", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
assertEquals("myRest", config.getSetting("myPortal-pcdef", PortalContainerConfig.REST_CONTEXT_SETTING_NAME));
- assertNull(config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
- assertNull(config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
- assertEquals("my-exo-domain", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("foo", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal", PortalContainerConfig.REALM_SETTING_NAME));
+ assertEquals("my-exo-domain", config.getSetting("myPortal-pcdef", PortalContainerConfig.REALM_SETTING_NAME));
}
}
Modified: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/java/org/exoplatform/xml/test/TestConfigurationXML.java
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/java/org/exoplatform/xml/test/TestConfigurationXML.java 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/java/org/exoplatform/xml/test/TestConfigurationXML.java 2010-03-11 11:49:03 UTC (rev 2052)
@@ -21,24 +21,134 @@
import junit.framework.TestCase;
import org.exoplatform.container.xml.Component;
+import org.exoplatform.container.xml.ComponentLifecyclePlugin;
+import org.exoplatform.container.xml.ComponentPlugin;
import org.exoplatform.container.xml.Configuration;
+import org.exoplatform.container.xml.ContainerLifecyclePlugin;
+import org.exoplatform.container.xml.ExternalComponentPlugins;
import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ManageableComponents;
import org.exoplatform.container.xml.ObjectParameter;
import org.exoplatform.container.xml.PropertiesParam;
import org.exoplatform.container.xml.ValueParam;
+import org.exoplatform.container.xml.ValuesParam;
import org.exoplatform.xml.object.XMLObject;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IUnmarshallingContext;
import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
/**
* @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
*/
public class TestConfigurationXML extends TestCase
{
+
+ @SuppressWarnings("unchecked")
+ public void testTrimValue() throws Exception
+ {
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("test-trim-value.xml");
+ assertNotNull(is);
+ try
+ {
+ IBindingFactory bfact = BindingDirectory.getFactory(XMLObject.class);
+ IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
+ Configuration conf =
+ (Configuration)uctx.unmarshalDocument(is, null);
+ assertNotNull(conf);
+ Iterator it = conf.getContainerLifecyclePluginIterator();
+ assertNotNull(it);
+ assertTrue(it.hasNext());
+ ContainerLifecyclePlugin conlp = (ContainerLifecyclePlugin)it.next();
+ assertEquals("container-lifecycle-plugin-type", conlp.getType());
+ assertNotNull(conlp.getInitParams());
+ assertEquals("container-lifecycle-plugin-value-param-value", (conlp.getInitParams().getValueParam("container-lifecycle-plugin-value-param-name")).getValue());
+ it = conf.getComponentLifecyclePluginIterator();
+ assertNotNull(it);
+ assertTrue(it.hasNext());
+ ComponentLifecyclePlugin comlp = (ComponentLifecyclePlugin)it.next();
+ assertEquals("component-lifecycle-plugin", comlp.getType());
+ ManageableComponents mc = comlp.getManageableComponents();
+ assertNotNull(mc);
+ assertEquals("manageable-components-component-type", mc.getComponentsType().get(0));
+ ValuesParam valuesParam = comlp.getInitParams().getValuesParam("component-lifecycle-plugin-values-param-name");
+ assertNotNull(valuesParam);
+ assertNotNull(valuesParam.getValues());
+ assertTrue(valuesParam.getValues().contains("component-lifecycle-plugin-values-param-value1"));
+ assertTrue(valuesParam.getValues().contains("component-lifecycle-plugin-values-param-value2"));
+ Component c = conf.getComponent("component-key1");
+ assertNotNull(c);
+ assertEquals("component-type1", c.getType());
+ PropertiesParam propertiesParam = c.getInitParams().getPropertiesParam("component-key1-properties-param-name");
+ assertNotNull(propertiesParam);
+ assertEquals("component-key1-properties-param-prop-value", propertiesParam.getProperty("component-key1-properties-param-prop-name"));
+ c = conf.getComponent("component-type2");
+ assertNotNull(c);
+ ObjectParameter objectParameter = c.getInitParams().getObjectParam("component-key2-object-param-name");
+ assertNotNull(objectParameter);
+ MyObject o = (MyObject)objectParameter.getObject();
+ assertNotNull(o);
+ assertEquals("string-value", o.field1);
+ assertEquals(1, o.field2);
+ assertEquals(1l, o.field3);
+ assertEquals(1d, o.field4);
+ assertEquals(true, o.field5);
+ assertNotNull(o.field6);
+ assertEquals("entry-value", o.field6.get("entry-name"));
+ assertNotNull(o.field7);
+ assertTrue(o.field7.contains("string-value"));
+ assertNotNull(o.field8);
+ assertEquals(1, o.field8[0]);
+ List list = c.getComponentPlugins();
+ assertNotNull(list);
+ assertFalse(list.isEmpty());
+ ComponentPlugin cp = (ComponentPlugin)list.get(0);
+ assertEquals("component-plugins-name", cp.getName());
+ assertEquals("set-method-name", cp.getSetMethod());
+ assertEquals("component-plugins-type", cp.getType());
+ assertEquals("1", cp.getPriority());
+ it = conf.getExternalComponentPluginsIterator();
+ assertNotNull(it);
+ assertTrue(it.hasNext());
+ ExternalComponentPlugins ecps = (ExternalComponentPlugins)it.next();
+ assertEquals("target-component-name", ecps.getTargetComponent());
+ list = ecps.getComponentPlugins();
+ assertNotNull(list);
+ assertFalse(list.isEmpty());
+ cp = (ComponentPlugin)list.get(0);
+ assertEquals("component-plugins-name", cp.getName());
+ assertEquals("set-method-name", cp.getSetMethod());
+ assertEquals("component-plugins-type", cp.getType());
+ assertEquals("1", cp.getPriority());
+ list = conf.getImports();
+ assertNotNull(list);
+ assertFalse(list.isEmpty());
+ assertEquals("import-value", list.get(0));
+ list = conf.getRemoveConfiguration();
+ assertNotNull(list);
+ assertFalse(list.isEmpty());
+ assertEquals("remove-configuration-value", list.get(0));
+ }
+ finally
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Exception e)
+ {
+ // ignore me
+ }
+ }
+ }
+
public void testSystemPropertyResolving() throws Exception
{
@@ -118,5 +228,17 @@
assertNotNull(paramName);
assertEquals(expectedValue, valueParam.getValue());
}
+
+ public static class MyObject
+ {
+ public String field1;
+ public int field2;
+ public long field3;
+ public double field4;
+ public boolean field5;
+ public Map field6;
+ public Collection field7;
+ public int[] field8;
+ }
}
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/default-settings.properties (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/default-settings.properties)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/default-settings.properties (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/default-settings.properties 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,13 @@
+foo=value0
+foo4=value
+string=new value0
+int=200
+int2=${property_Int}
+long=200
+double=200
+boolean=true
+complex-value2=${name}-${rest}-${realm}-${foo}-${string}
+complex-value3=-${foo3}-
+complex-value5=-${foo5}-
+complex-value8=-${foo6}-
+complex-value9=-${property_String}-
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/default-settings.properties (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/default-settings.properties)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/default-settings.properties (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal/default-settings.properties 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,7 @@
+foo=value01
+string=new value01
+int=2001
+long=2001
+double=2001
+boolean=false
+complex-value2=${name}-${rest}-${realm}-${foo}-${string}
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-both-settings-with-default-portal-def.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- A map of settings tied to the default portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>cpv1</string>
+ </key>
+ <value>
+ <string>-${TestPortalContainerConfig-string}-</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>cpv2</string>
+ </key>
+ <value>
+ <int>${TestPortalContainerConfig-int}</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>cpv3</string>
+ </key>
+ <value>
+ <string>-${property_String}-</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>foo2</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>foo5</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value0</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>100</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int2</string>
+ </key>
+ <value>
+ <int>100</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>100</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>100</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>classpath:/org/exoplatform/container/definition/default-settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <component>
+ <key>PropertyManagerConfigurator</key>
+ <type>org.exoplatform.container.PropertyConfigurator</type>
+ <init-params>
+ <properties-param>
+ <name>properties</name>
+ <property name="property_String" value="property_value_1" />
+ <property name="property_Int" value="60" />
+ </properties-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- A map of settings tied to the portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>foo</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>foo6</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>10</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>10</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>10</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>classpath:/org/exoplatform/container/definition/settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-default-portal-def.xml (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-default-portal-def.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-default-portal-def.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-default-portal-def.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.portal.container" -->
+ <field name="name">
+ <string>myPortal-dpcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.rest.context" -->
+ <field name="restContextName">
+ <string>myRest-dpcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.realm.name" -->
+ <field name="realmName">
+ <string>my-exo-domain-dpcdef</string>
+ </field>
+ <!-- A map of settings tied to the default portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value0</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>100</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>100</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>100</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+</configuration>
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-empty-default-portal-def.xml (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-empty-default-portal-def.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-empty-default-portal-def.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-empty-default-portal-def.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+</configuration>
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>classpath:/org/exoplatform/container/definition/default-settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal0</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal0</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest0</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain0</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>portal</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>classpath:/org/exoplatform/container/definition/settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>portal2</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal2</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest2</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain2</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-external-settings-with-default-portal-def2.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>default-settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal0</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal0</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest0</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain0</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>portal</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>settings.properties</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
+ <name>portal2</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal2</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest2</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain2</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.portal.container" -->
+ <field name="name">
+ <string>myPortal-dpcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.rest.context" -->
+ <field name="restContextName">
+ <string>myRest-dpcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.realm.name" -->
+ <field name="realmName">
+ <string>my-exo-domain-dpcdef</string>
+ </field>
+ <field name="dependencies">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>fooX</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-portal-def-with-default-portal-def2.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <field name="dependencies">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>fooX</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- All the dependencies of the portal container ordered by loading priority -->
+ <field name="dependencies">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>foo</string>
+ </value>
+ <value>
+ <string>foo2</string>
+ </value>
+ <value>
+ <string>foo3</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml (from rev 2010, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/portal-container-config-with-default-values-and-with-settings-with-default-portal-def.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <type>org.exoplatform.container.definition.PortalContainerConfig</type>
+ <init-params>
+ <!-- The name of the default portal container -->
+ <value-param>
+ <name>default.portal.container</name>
+ <value>myPortal</value>
+ </value-param>
+ <!-- The name of the default rest ServletContext -->
+ <value-param>
+ <name>default.rest.context</name>
+ <value>myRest</value>
+ </value-param>
+ <!-- The name of the default realm -->
+ <value-param>
+ <name>default.realm.name</name>
+ <value>my-exo-domain</value>
+ </value-param>
+ <!-- The default portal container definition -->
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.portal.container" -->
+ <field name="name">
+ <string>myPortal-dpcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.rest.context" -->
+ <field name="restContextName">
+ <string>myRest-dpcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <!-- If this value is not null, it will replace the value defined
+ by the value-param "default.realm.name" -->
+ <field name="realmName">
+ <string>my-exo-domain-dpcdef</string>
+ </field>
+ <!-- A map of settings tied to the default portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>foo2</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value0</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>100</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>100</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>100</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <!-- The full qualified name of the PortalContainerConfig -->
+ <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
+ <component-plugin>
+ <!-- The name of the plugin -->
+ <name>Add PortalContainer Definitions</name>
+ <!-- The name of the method to call on the PortalContainerConfig in order to register the PortalContainerDefinitions -->
+ <set-method>registerPlugin</set-method>
+ <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
+ <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
+ <init-params>
+ <object-param>
+ <name>portal</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The name of the portal container -->
+ <field name="name">
+ <string>myPortal-pcdef</string>
+ </field>
+ <!-- The name of the context name of the rest web application -->
+ <field name="restContextName">
+ <string>myRest-pcdef</string>
+ </field>
+ <!-- The name of the realm -->
+ <field name="realmName">
+ <string>my-exo-domain-pcdef</string>
+ </field>
+ <!-- A map of settings tied to the portal container -->
+ <field name="settings">
+ <map type="java.util.HashMap">
+ <entry>
+ <key>
+ <string>foo</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>string</string>
+ </key>
+ <value>
+ <string>value</string>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>int</string>
+ </key>
+ <value>
+ <int>10</int>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>long</string>
+ </key>
+ <value>
+ <long>10</long>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>double</string>
+ </key>
+ <value>
+ <double>10</double>
+ </value>
+ </entry>
+ <entry>
+ <key>
+ <string>boolean</string>
+ </key>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </entry>
+ </map>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.properties (from rev 2048, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.properties)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.properties (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.properties 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,3 @@
+gatein.data.dir=../gatein/data
+gatein.db.data.dir=${gatein.data.dir}/db
+gatein.jcr.datasource.url=jdbc:hsqldb:file:${gatein.db.data.dir}/data/jdbcjcr_${name}
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.xml (from rev 2048, kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/sample-gtn-configuration.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -0,0 +1,21 @@
+<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>
+ <!-- It cans be used to avoid duplicating configuration -->
+ <object-param>
+ <name>default.portal.definition</name>
+ <object type="org.exoplatform.container.definition.PortalContainerDefinition">
+ <!-- The path to the external properties file -->
+ <field name="externalSettingsPath">
+ <string>sample-gtn-configuration.properties</string>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+</configuration>
Modified: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties 2010-03-11 09:32:07 UTC (rev 2051)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/org/exoplatform/container/definition/settings.properties 2010-03-11 11:49:03 UTC (rev 2052)
@@ -1,7 +1,11 @@
foo2=value
+foo3=value
string=new value
int=20
long=20
double=20
boolean=false
-complex-value=${name}-${rest}-${realm}-${foo2}-${string}
\ No newline at end of file
+complex-value=${name}-${rest}-${realm}-${foo2}-${string}
+complex-value4=-${foo4}-
+complex-value6=-${foo6}-
+complex-value7=-${foo5}-
\ No newline at end of file
Copied: kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/test-trim-value.xml (from rev 1983, kernel/trunk/exo.kernel.container/src/test/resources/test-trim-value.xml)
===================================================================
--- kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/test-trim-value.xml (rev 0)
+++ kernel/tags/2.2.0-GA/exo.kernel.container/src/test/resources/test-trim-value.xml 2010-03-11 11:49:03 UTC (rev 2052)
@@ -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>
+
+ <container-lifecycle-plugin>
+ <type> container-lifecycle-plugin-type
+ </type>
+ <init-params>
+ <value-param>
+ <name> container-lifecycle-plugin-value-param-name </name>
+ <value> container-lifecycle-plugin-value-param-value </value>
+ </value-param>
+ </init-params>
+ </container-lifecycle-plugin>
+ <component-lifecycle-plugin>
+ <type> component-lifecycle-plugin
+ </type>
+ <manageable-components>
+ <component-type> manageable-components-component-type</component-type>
+ </manageable-components>
+ <init-params>
+ <values-param>
+ <name> component-lifecycle-plugin-values-param-name </name>
+ <value> component-lifecycle-plugin-values-param-value1 </value>
+ <value> component-lifecycle-plugin-values-param-value2
+ </value>
+ </values-param>
+ </init-params>
+ </component-lifecycle-plugin>
+ <component>
+ <key> component-key1
+ </key>
+ <type> component-type1
+ </type>
+ <init-params>
+ <properties-param>
+ <name> component-key1-properties-param-name </name>
+ <property name=" component-key1-properties-param-prop-name " value=" component-key1-properties-param-prop-value
+ " />
+ </properties-param>
+ </init-params>
+ </component>
+ <component>
+ <type> component-type2
+ </type>
+ <component-plugins>
+ <component-plugin>
+ <name> component-plugins-name </name>
+ <set-method> set-method-name</set-method>
+ <type> component-plugins-type </type>
+ <priority> 1 </priority>
+ </component-plugin>
+ </component-plugins>
+ <init-params>
+ <object-param>
+ <name> component-key2-object-param-name </name>
+ <object type=" org.exoplatform.xml.test.TestConfigurationXML$MyObject ">
+ <field name=" field1 ">
+ <string> string-value </string>
+ </field>
+ <field name=" field2 ">
+ <int> 1 </int>
+ </field>
+ <field name=" field3 ">
+ <long> 1 </long>
+ </field>
+ <field name=" field4 ">
+ <double> 1 </double>
+ </field>
+ <field name=" field5 ">
+ <boolean> true </boolean>
+ </field>
+ <field name=" field6 ">
+ <map type=" java.util.HashMap ">
+ <entry>
+ <key><string> entry-name </string></key>
+ <value><string> entry-value </string></value>
+ </entry>
+ </map>
+ </field>
+ <field name=" field7 ">
+ <collection type=" java.util.HashSet ">
+ <value>
+ <string> string-value </string>
+ </value>
+ </collection>
+ </field>
+ <field name=" field8 ">
+ <native-array type=" int ">
+ <array> 1 </array>
+ </native-array>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+ <external-component-plugins>
+ <target-component> target-component-name
+ </target-component>
+ <component-plugin>
+ <name> component-plugins-name </name>
+ <set-method> set-method-name</set-method>
+ <type> component-plugins-type </type>
+ <priority> 1 </priority>
+ </component-plugin>
+ </external-component-plugins>
+ <import> import-value
+ </import>
+ <remove-configuration> remove-configuration-value </remove-configuration>
+</configuration>
More information about the exo-jcr-commits
mailing list