exo-jcr SVN: r2756 - in kernel/trunk/exo.kernel.container/src: main/java/org/exoplatform/container/definition and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-07-08 06:48:01 -0400 (Thu, 08 Jul 2010)
New Revision: 2756
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
Log:
EXOJCR-842: Changes reverted, a patch will be proposed instead
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-07-08 10:28:40 UTC (rev 2755)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-07-08 10:48:01 UTC (rev 2756)
@@ -189,20 +189,12 @@
public void registerPortalContainer(ServletContext context)
{
PortalContainerConfig config = getPortalContainerConfig();
+ // Ensure that the portal container has been registered
+ config.registerPortalContainerName(context.getServletContextName());
if (config.hasDefinition())
{
// The new behavior has been detected thus, the creation will be done at the end asynchronously
- if (config.isPortalContainerName(context.getServletContextName()))
- {
- // The portal context has been registered has a portal container
- portalContexts.add(new WebAppInitContext(context));
- }
- else
- {
- log.info("We assume that the ServletContext '" + context.getServletContextName()
- + "' is not a portal since no portal container with the same name has been"
- + " registered to the component PortalContainerConfig.");
- }
+ portalContexts.add(new WebAppInitContext(context));
// We assume that a ServletContext of a portal container owns configuration files
final PortalContainerPreInitTask task = new PortalContainerPreInitTask()
{
@@ -216,8 +208,6 @@
}
else
{
- // Ensure that the portal container has been registered
- config.registerPortalContainerName(context.getServletContextName());
// The old behavior has been detected thus, the creation will be done synchronously
createPortalContainer(context);
}
@@ -254,14 +244,11 @@
PortalContainerConfig config = getPortalContainerConfig();
for (String portalContainerName : initTasks.keySet())
{
- if (config.isPortalContainerName(portalContainerName))
- {
- // Unregister name of portal container that doesn't exist
- log.warn("The portal container '" + portalContainerName + "' doesn't not exist or"
- + " it has not yet been registered, please check your PortalContainerDefinitions and "
- + "the loading order.");
- config.unregisterPortalContainerName(portalContainerName);
- }
+ // Unregister name of portal container that doesn't exist
+ log.warn("The portal container '" + portalContainerName + "' doesn't not exist or"
+ + " it has not yet been registered, please check your PortalContainerDefinitions and "
+ + "the loading order.");
+ config.unregisterPortalContainerName(portalContainerName);
}
// remove all the unneeded tasks
initTasks.clear();
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-07-08 10:28:40 UTC (rev 2755)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-07-08 10:48:01 UTC (rev 2756)
@@ -39,10 +39,8 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.servlet.ServletContext;
@@ -107,9 +105,9 @@
private volatile boolean initialized;
/**
- * The set of all the portal containers
+ * The list of all the portal containers
*/
- private Set<String> portalContainerNames;
+ private List<String> portalContainerNames;
/**
* The list of all the web application scopes
@@ -356,10 +354,10 @@
{
if (!portalContainerNames.contains(name))
{
- final Set<String> lPortalContainerNames = new LinkedHashSet<String>(portalContainerNames.size() + 1);
+ final List<String> lPortalContainerNames = new ArrayList<String>(portalContainerNames.size() + 1);
lPortalContainerNames.add(name);
lPortalContainerNames.addAll(portalContainerNames);
- this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
}
}
@@ -371,9 +369,9 @@
{
if (portalContainerNames.contains(name))
{
- final Set<String> lPortalContainerNames = new LinkedHashSet<String>(portalContainerNames);
+ final List<String> lPortalContainerNames = new ArrayList<String>(portalContainerNames);
lPortalContainerNames.remove(name);
- this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
}
}
@@ -440,7 +438,7 @@
else if (scopes.isEmpty())
{
// we assume that the old behavior is expected
- return defaultDefinition.getName();
+ return defaultDefinition.getName();
}
final List<String> result = scopes.get(contextName);
if (result == null || result.isEmpty())
@@ -544,7 +542,7 @@
if (portalContainerName == null)
{
throw new IllegalArgumentException("The portal container name cannot be null");
- }
+ }
return getPortalContainerNames(contextName).contains(portalContainerName);
}
@@ -977,12 +975,9 @@
*/
private void initialize(Map<String, PortalContainerDefinition> mDefinitions)
{
- final Set<String> lPortalContainerNames = new LinkedHashSet<String>(mDefinitions.size() + 1);
- if (mDefinitions.isEmpty())
- {
- // Add the default portal container name
- lPortalContainerNames.add(defaultDefinition.getName());
- }
+ final List<String> lPortalContainerNames = new ArrayList<String>(mDefinitions.size() + 1);
+ // Add the default portal container name
+ lPortalContainerNames.add(defaultDefinition.getName());
final Map<String, List<String>> mScopes = new HashMap<String, List<String>>();
boolean first = true;
for (Map.Entry<String, PortalContainerDefinition> entry : mDefinitions.entrySet())
@@ -990,7 +985,10 @@
PortalContainerDefinition definition = entry.getValue();
String name = definition.getName();
boolean hasChanged = false;
- lPortalContainerNames.add(name);
+ if (!name.equals(defaultDefinition.getName()))
+ {
+ lPortalContainerNames.add(name);
+ }
if (first)
{
first = false;
@@ -1034,7 +1032,7 @@
registerDependencies(defaultDefinition, mScopes);
}
}
- this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
this.scopes = Collections.unmodifiableMap(mScopes);
// clear the changes
changes.clear();
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2010-07-08 10:28:40 UTC (rev 2755)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2010-07-08 10:48:01 UTC (rev 2756)
@@ -43,7 +43,7 @@
assertEquals("myRest", portal.getRestContextName());
assertEquals("my-exo-domain", portal.getRealmName());
- assertFalse(PortalContainer.isPortalContainerName("myPortal"));
+ assertTrue(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
@@ -73,7 +73,7 @@
assertEquals("myRest", PortalContainer.getRestContextName("foo"));
assertEquals("my-exo-domain", PortalContainer.getRealmName("foo"));
- assertFalse(PortalContainer.isPortalContainerName("myPortal"));
+ assertTrue(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
@@ -84,7 +84,7 @@
assertEquals("myRest", PortalContainer.getCurrentRestContextName());
assertEquals("my-exo-domain", PortalContainer.getCurrentRealmName());
- assertFalse(PortalContainer.isPortalContainerName("myPortal"));
+ assertTrue(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
}
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-07-08 10:28:40 UTC (rev 2755)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-07-08 10:48:01 UTC (rev 2756)
@@ -48,9 +48,6 @@
assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getDefaultPortalContainer());
assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getDefaultRestContext());
assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME, config.getDefaultRealmName());
- assertTrue(config.isPortalContainerName("portal"));
- assertFalse(config.isPortalContainerName("myPortal"));
- assertFalse(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer = createRootContainer("portal-container-config-with-default-values.xml");
@@ -59,9 +56,6 @@
assertEquals("myPortal", config.getDefaultPortalContainer());
assertEquals("myRest", config.getDefaultRestContext());
assertEquals("my-exo-domain", config.getDefaultRealmName());
- assertFalse(config.isPortalContainerName("portal"));
- assertTrue(config.isPortalContainerName("myPortal"));
- assertFalse(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer =
@@ -71,9 +65,6 @@
assertEquals("myPortal-dpcdef", config.getDefaultPortalContainer());
assertEquals("myRest-dpcdef", config.getDefaultRestContext());
assertEquals("my-exo-domain-dpcdef", config.getDefaultRealmName());
- assertFalse(config.isPortalContainerName("portal"));
- assertFalse(config.isPortalContainerName("myPortal"));
- assertTrue(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
@@ -291,7 +282,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
assertFalse(config.isScopeValid("foo", "foo"));
@@ -354,7 +345,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
assertFalse(config.isScopeValid("foo", "foo"));
@@ -475,12 +466,13 @@
assertTrue(names != null && !names.isEmpty());
assertEquals("myPortal-pcdef", names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && names.isEmpty());
+ 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"));
- assertNull(config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal", config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -489,7 +481,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
@@ -531,12 +523,13 @@
assertTrue(names != null && !names.isEmpty());
assertEquals("myPortal-pcdef", names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && names.isEmpty());
+ 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"));
- assertNull(config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal", config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -545,7 +538,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
@@ -572,12 +565,13 @@
assertEquals(1, names.size());
assertEquals("myPortal-pcdef", names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && names.isEmpty());
+ 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"));
- assertNull(config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal", config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -586,7 +580,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
13 years, 10 months
exo-jcr SVN: r2755 - in kernel/branches/2.2.x/exo.kernel.container/src: main/java/org/exoplatform/container/definition and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-07-08 06:28:40 -0400 (Thu, 08 Jul 2010)
New Revision: 2755
Modified:
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
Log:
EXOJCR-842: Changes reverted, a patch will be proposed instead
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-07-08 08:35:33 UTC (rev 2754)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-07-08 10:28:40 UTC (rev 2755)
@@ -189,20 +189,12 @@
public void registerPortalContainer(ServletContext context)
{
PortalContainerConfig config = getPortalContainerConfig();
+ // Ensure that the portal container has been registered
+ config.registerPortalContainerName(context.getServletContextName());
if (config.hasDefinition())
{
// The new behavior has been detected thus, the creation will be done at the end asynchronously
- if (config.isPortalContainerName(context.getServletContextName()))
- {
- // The portal context has been registered has a portal container
- portalContexts.add(new WebAppInitContext(context));
- }
- else
- {
- log.info("We assume that the ServletContext '" + context.getServletContextName()
- + "' is not a portal since no portal container with the same name has been"
- + " registered to the component PortalContainerConfig.");
- }
+ portalContexts.add(new WebAppInitContext(context));
// We assume that a ServletContext of a portal container owns configuration files
final PortalContainerPreInitTask task = new PortalContainerPreInitTask()
{
@@ -216,8 +208,6 @@
}
else
{
- // Ensure that the portal container has been registered
- config.registerPortalContainerName(context.getServletContextName());
// The old behavior has been detected thus, the creation will be done synchronously
createPortalContainer(context);
}
@@ -254,14 +244,11 @@
PortalContainerConfig config = getPortalContainerConfig();
for (String portalContainerName : initTasks.keySet())
{
- if (config.isPortalContainerName(portalContainerName))
- {
- // Unregister name of portal container that doesn't exist
- log.warn("The portal container '" + portalContainerName + "' doesn't not exist or"
- + " it has not yet been registered, please check your PortalContainerDefinitions and "
- + "the loading order.");
- config.unregisterPortalContainerName(portalContainerName);
- }
+ // Unregister name of portal container that doesn't exist
+ log.warn("The portal container '" + portalContainerName + "' doesn't not exist or"
+ + " it has not yet been registered, please check your PortalContainerDefinitions and "
+ + "the loading order.");
+ config.unregisterPortalContainerName(portalContainerName);
}
// remove all the unneeded tasks
initTasks.clear();
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-07-08 08:35:33 UTC (rev 2754)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-07-08 10:28:40 UTC (rev 2755)
@@ -39,10 +39,8 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.servlet.ServletContext;
@@ -107,9 +105,9 @@
private volatile boolean initialized;
/**
- * The set of all the portal containers
+ * The list of all the portal containers
*/
- private Set<String> portalContainerNames;
+ private List<String> portalContainerNames;
/**
* The list of all the web application scopes
@@ -356,10 +354,10 @@
{
if (!portalContainerNames.contains(name))
{
- final Set<String> lPortalContainerNames = new LinkedHashSet<String>(portalContainerNames.size() + 1);
+ final List<String> lPortalContainerNames = new ArrayList<String>(portalContainerNames.size() + 1);
lPortalContainerNames.add(name);
lPortalContainerNames.addAll(portalContainerNames);
- this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
}
}
@@ -371,9 +369,9 @@
{
if (portalContainerNames.contains(name))
{
- final Set<String> lPortalContainerNames = new LinkedHashSet<String>(portalContainerNames);
+ final List<String> lPortalContainerNames = new ArrayList<String>(portalContainerNames);
lPortalContainerNames.remove(name);
- this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
}
}
@@ -440,7 +438,7 @@
else if (scopes.isEmpty())
{
// we assume that the old behavior is expected
- return defaultDefinition.getName();
+ return defaultDefinition.getName();
}
final List<String> result = scopes.get(contextName);
if (result == null || result.isEmpty())
@@ -544,7 +542,7 @@
if (portalContainerName == null)
{
throw new IllegalArgumentException("The portal container name cannot be null");
- }
+ }
return getPortalContainerNames(contextName).contains(portalContainerName);
}
@@ -977,12 +975,9 @@
*/
private void initialize(Map<String, PortalContainerDefinition> mDefinitions)
{
- final Set<String> lPortalContainerNames = new LinkedHashSet<String>(mDefinitions.size() + 1);
- if (mDefinitions.isEmpty())
- {
- // Add the default portal container name
- lPortalContainerNames.add(defaultDefinition.getName());
- }
+ final List<String> lPortalContainerNames = new ArrayList<String>(mDefinitions.size() + 1);
+ // Add the default portal container name
+ lPortalContainerNames.add(defaultDefinition.getName());
final Map<String, List<String>> mScopes = new HashMap<String, List<String>>();
boolean first = true;
for (Map.Entry<String, PortalContainerDefinition> entry : mDefinitions.entrySet())
@@ -990,7 +985,10 @@
PortalContainerDefinition definition = entry.getValue();
String name = definition.getName();
boolean hasChanged = false;
- lPortalContainerNames.add(name);
+ if (!name.equals(defaultDefinition.getName()))
+ {
+ lPortalContainerNames.add(name);
+ }
if (first)
{
first = false;
@@ -1034,7 +1032,7 @@
registerDependencies(defaultDefinition, mScopes);
}
}
- this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
this.scopes = Collections.unmodifiableMap(mScopes);
// clear the changes
changes.clear();
Modified: kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2010-07-08 08:35:33 UTC (rev 2754)
+++ kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2010-07-08 10:28:40 UTC (rev 2755)
@@ -43,7 +43,7 @@
assertEquals("myRest", portal.getRestContextName());
assertEquals("my-exo-domain", portal.getRealmName());
- assertFalse(PortalContainer.isPortalContainerName("myPortal"));
+ assertTrue(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
@@ -73,7 +73,7 @@
assertEquals("myRest", PortalContainer.getRestContextName("foo"));
assertEquals("my-exo-domain", PortalContainer.getRealmName("foo"));
- assertFalse(PortalContainer.isPortalContainerName("myPortal"));
+ assertTrue(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
@@ -84,7 +84,7 @@
assertEquals("myRest", PortalContainer.getCurrentRestContextName());
assertEquals("my-exo-domain", PortalContainer.getCurrentRealmName());
- assertFalse(PortalContainer.isPortalContainerName("myPortal"));
+ assertTrue(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
}
Modified: kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-07-08 08:35:33 UTC (rev 2754)
+++ kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-07-08 10:28:40 UTC (rev 2755)
@@ -48,9 +48,6 @@
assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getDefaultPortalContainer());
assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getDefaultRestContext());
assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME, config.getDefaultRealmName());
- assertTrue(config.isPortalContainerName("portal"));
- assertFalse(config.isPortalContainerName("myPortal"));
- assertFalse(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer = createRootContainer("portal-container-config-with-default-values.xml");
@@ -59,9 +56,6 @@
assertEquals("myPortal", config.getDefaultPortalContainer());
assertEquals("myRest", config.getDefaultRestContext());
assertEquals("my-exo-domain", config.getDefaultRealmName());
- assertFalse(config.isPortalContainerName("portal"));
- assertTrue(config.isPortalContainerName("myPortal"));
- assertFalse(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer =
@@ -71,9 +65,6 @@
assertEquals("myPortal-dpcdef", config.getDefaultPortalContainer());
assertEquals("myRest-dpcdef", config.getDefaultRestContext());
assertEquals("my-exo-domain-dpcdef", config.getDefaultRealmName());
- assertFalse(config.isPortalContainerName("portal"));
- assertFalse(config.isPortalContainerName("myPortal"));
- assertTrue(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
@@ -291,7 +282,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
assertFalse(config.isScopeValid("foo", "foo"));
@@ -354,7 +345,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
assertFalse(config.isScopeValid("foo", "foo"));
@@ -475,12 +466,13 @@
assertTrue(names != null && !names.isEmpty());
assertEquals("myPortal-pcdef", names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && names.isEmpty());
+ 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"));
- assertNull(config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal", config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -489,7 +481,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
@@ -531,12 +523,13 @@
assertTrue(names != null && !names.isEmpty());
assertEquals("myPortal-pcdef", names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && names.isEmpty());
+ 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"));
- assertNull(config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal", config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -545,7 +538,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
@@ -572,12 +565,13 @@
assertEquals(1, names.size());
assertEquals("myPortal-pcdef", names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && names.isEmpty());
+ 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"));
- assertNull(config.getPortalContainerName("myPortal"));
+ assertEquals("myPortal", config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -586,7 +580,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
13 years, 10 months
exo-jcr SVN: r2754 - jcr/trunk/exo.jcr.component.ext/src/main/resources/conf.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-07-08 04:35:33 -0400 (Thu, 08 Jul 2010)
New Revision: 2754
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml
Log:
EXOJCR-845 exo:audit* node-types removed from configuration
Modified: jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml 2010-07-08 07:30:51 UTC (rev 2753)
+++ jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml 2010-07-08 08:35:33 UTC (rev 2754)
@@ -104,89 +104,6 @@
<!-- audit nodetypes -->
- <nodeType name="exo:auditable" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:auditHistory" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY"
- protected="true" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="exo:auditRecord" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:user" requiredType="String" autoCreated="true" mandatory="true" onParentVersion="IGNORE" protected="true"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:created" requiredType="Date" autoCreated="true" mandatory="true" onParentVersion="IGNORE" protected="true"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:propertyName" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="IGNORE"
- protected="true" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:eventType" requiredType="Long" autoCreated="true" mandatory="true" onParentVersion="IGNORE" protected="true"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:auditVersion" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="IGNORE"
- protected="true" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:auditVersionName" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="IGNORE"
- protected="true" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="exo:auditHistory" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:targetNode" requiredType="Reference" autoCreated="true" mandatory="true" onParentVersion="IGNORE"
- protected="true" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:lastRecord" requiredType="String" autoCreated="true" mandatory="true" onParentVersion="IGNORE"
- protected="true" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="exo:auditRecord" autoCreated="false" mandatory="false" onParentVersion="IGNORE"
- protected="true" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:auditRecord</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:auditStorage" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="exo:auditHistory" autoCreated="false" mandatory="false" onParentVersion="VERSION"
- protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:auditHistory</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
<nodeType name="nt:resource" isMixin="false" hasOrderableChildNodes="false" primaryItemName="jcr:data">
<supertypes>
<supertype>nt:base</supertype>
13 years, 10 months
exo-jcr SVN: r2753 - jcr/trunk/exo.jcr.component.ext/src/main/resources/conf.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-07-08 03:30:51 -0400 (Thu, 08 Jul 2010)
New Revision: 2753
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml
Log:
EXOJCR-845 Chenges reverted.
Modified: jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml 2010-07-07 13:31:14 UTC (rev 2752)
+++ jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml 2010-07-08 07:30:51 UTC (rev 2753)
@@ -145,14 +145,6 @@
protected="true" multiple="false">
<valueConstraints />
</propertyDefinition>
- <propertyDefinition name="exo:newValue" requiredType="Value" autoCreated="false" mandatory="false" onParentVersion="IGNORE"
- protected="true" multiple="true">
- <valueConstraints/>
- </propertyDefinition>
- <propertyDefinition name="exo:oldValue" requiredType="Value" autoCreated="false" mandatory="false" onParentVersion="IGNORE"
- protected="true" multiple="true">
- <valueConstraints/>
- </propertyDefinition>
</propertyDefinitions>
</nodeType>
13 years, 10 months
exo-jcr SVN: r2752 - jcr/trunk/exo.jcr.component.ext/src/main/resources/conf.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-07-07 09:31:14 -0400 (Wed, 07 Jul 2010)
New Revision: 2752
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml
Log:
EXOJCR-845 'exo:newValue' and 'exo:oldValue' properties added to exo:auditRecord nodetype
Modified: jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml 2010-07-07 13:16:02 UTC (rev 2751)
+++ jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/ext-nodetypes-config.xml 2010-07-07 13:31:14 UTC (rev 2752)
@@ -145,6 +145,14 @@
protected="true" multiple="false">
<valueConstraints />
</propertyDefinition>
+ <propertyDefinition name="exo:newValue" requiredType="Value" autoCreated="false" mandatory="false" onParentVersion="IGNORE"
+ protected="true" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="exo:oldValue" requiredType="Value" autoCreated="false" mandatory="false" onParentVersion="IGNORE"
+ protected="true" multiple="true">
+ <valueConstraints/>
+ </propertyDefinition>
</propertyDefinitions>
</nodeType>
13 years, 10 months
exo-jcr SVN: r2751 - in kernel/trunk/exo.kernel.container/src: main/java/org/exoplatform/container/definition and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-07-07 09:16:02 -0400 (Wed, 07 Jul 2010)
New Revision: 2751
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
Log:
EXOJCR-842: Now if at least one portal container definition has been defined, which means that we expect the new behavior, the portal container will be only created if the related portal container definition has been defined otherwise we assume that we don't want to create the portal container. Thanks to this feature the portal container "portal" is no more mandatory.
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-07-07 12:19:10 UTC (rev 2750)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-07-07 13:16:02 UTC (rev 2751)
@@ -189,12 +189,20 @@
public void registerPortalContainer(ServletContext context)
{
PortalContainerConfig config = getPortalContainerConfig();
- // Ensure that the portal container has been registered
- config.registerPortalContainerName(context.getServletContextName());
if (config.hasDefinition())
{
// The new behavior has been detected thus, the creation will be done at the end asynchronously
- portalContexts.add(new WebAppInitContext(context));
+ if (config.isPortalContainerName(context.getServletContextName()))
+ {
+ // The portal context has been registered has a portal container
+ portalContexts.add(new WebAppInitContext(context));
+ }
+ else
+ {
+ log.info("We assume that the ServletContext '" + context.getServletContextName()
+ + "' is not a portal since no portal container with the same name has been"
+ + " registered to the component PortalContainerConfig.");
+ }
// We assume that a ServletContext of a portal container owns configuration files
final PortalContainerPreInitTask task = new PortalContainerPreInitTask()
{
@@ -208,6 +216,8 @@
}
else
{
+ // Ensure that the portal container has been registered
+ config.registerPortalContainerName(context.getServletContextName());
// The old behavior has been detected thus, the creation will be done synchronously
createPortalContainer(context);
}
@@ -244,11 +254,14 @@
PortalContainerConfig config = getPortalContainerConfig();
for (String portalContainerName : initTasks.keySet())
{
- // Unregister name of portal container that doesn't exist
- log.warn("The portal container '" + portalContainerName + "' doesn't not exist or"
- + " it has not yet been registered, please check your PortalContainerDefinitions and "
- + "the loading order.");
- config.unregisterPortalContainerName(portalContainerName);
+ if (config.isPortalContainerName(portalContainerName))
+ {
+ // Unregister name of portal container that doesn't exist
+ log.warn("The portal container '" + portalContainerName + "' doesn't not exist or"
+ + " it has not yet been registered, please check your PortalContainerDefinitions and "
+ + "the loading order.");
+ config.unregisterPortalContainerName(portalContainerName);
+ }
}
// remove all the unneeded tasks
initTasks.clear();
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-07-07 12:19:10 UTC (rev 2750)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-07-07 13:16:02 UTC (rev 2751)
@@ -39,8 +39,10 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.servlet.ServletContext;
@@ -105,9 +107,9 @@
private volatile boolean initialized;
/**
- * The list of all the portal containers
+ * The set of all the portal containers
*/
- private List<String> portalContainerNames;
+ private Set<String> portalContainerNames;
/**
* The list of all the web application scopes
@@ -354,10 +356,10 @@
{
if (!portalContainerNames.contains(name))
{
- final List<String> lPortalContainerNames = new ArrayList<String>(portalContainerNames.size() + 1);
+ final Set<String> lPortalContainerNames = new LinkedHashSet<String>(portalContainerNames.size() + 1);
lPortalContainerNames.add(name);
lPortalContainerNames.addAll(portalContainerNames);
- this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
}
}
@@ -369,9 +371,9 @@
{
if (portalContainerNames.contains(name))
{
- final List<String> lPortalContainerNames = new ArrayList<String>(portalContainerNames);
+ final Set<String> lPortalContainerNames = new LinkedHashSet<String>(portalContainerNames);
lPortalContainerNames.remove(name);
- this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
}
}
@@ -438,7 +440,7 @@
else if (scopes.isEmpty())
{
// we assume that the old behavior is expected
- return defaultDefinition.getName();
+ return defaultDefinition.getName();
}
final List<String> result = scopes.get(contextName);
if (result == null || result.isEmpty())
@@ -542,7 +544,7 @@
if (portalContainerName == null)
{
throw new IllegalArgumentException("The portal container name cannot be null");
- }
+ }
return getPortalContainerNames(contextName).contains(portalContainerName);
}
@@ -975,9 +977,12 @@
*/
private void initialize(Map<String, PortalContainerDefinition> mDefinitions)
{
- final List<String> lPortalContainerNames = new ArrayList<String>(mDefinitions.size() + 1);
- // Add the default portal container name
- lPortalContainerNames.add(defaultDefinition.getName());
+ final Set<String> lPortalContainerNames = new LinkedHashSet<String>(mDefinitions.size() + 1);
+ if (mDefinitions.isEmpty())
+ {
+ // Add the default portal container name
+ lPortalContainerNames.add(defaultDefinition.getName());
+ }
final Map<String, List<String>> mScopes = new HashMap<String, List<String>>();
boolean first = true;
for (Map.Entry<String, PortalContainerDefinition> entry : mDefinitions.entrySet())
@@ -985,10 +990,7 @@
PortalContainerDefinition definition = entry.getValue();
String name = definition.getName();
boolean hasChanged = false;
- if (!name.equals(defaultDefinition.getName()))
- {
- lPortalContainerNames.add(name);
- }
+ lPortalContainerNames.add(name);
if (first)
{
first = false;
@@ -1032,7 +1034,7 @@
registerDependencies(defaultDefinition, mScopes);
}
}
- this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
this.scopes = Collections.unmodifiableMap(mScopes);
// clear the changes
changes.clear();
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2010-07-07 12:19:10 UTC (rev 2750)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2010-07-07 13:16:02 UTC (rev 2751)
@@ -43,7 +43,7 @@
assertEquals("myRest", portal.getRestContextName());
assertEquals("my-exo-domain", portal.getRealmName());
- assertTrue(PortalContainer.isPortalContainerName("myPortal"));
+ assertFalse(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
@@ -73,7 +73,7 @@
assertEquals("myRest", PortalContainer.getRestContextName("foo"));
assertEquals("my-exo-domain", PortalContainer.getRealmName("foo"));
- assertTrue(PortalContainer.isPortalContainerName("myPortal"));
+ assertFalse(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
@@ -84,7 +84,7 @@
assertEquals("myRest", PortalContainer.getCurrentRestContextName());
assertEquals("my-exo-domain", PortalContainer.getCurrentRealmName());
- assertTrue(PortalContainer.isPortalContainerName("myPortal"));
+ assertFalse(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
}
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-07-07 12:19:10 UTC (rev 2750)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-07-07 13:16:02 UTC (rev 2751)
@@ -48,6 +48,9 @@
assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getDefaultPortalContainer());
assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getDefaultRestContext());
assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME, config.getDefaultRealmName());
+ assertTrue(config.isPortalContainerName("portal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer = createRootContainer("portal-container-config-with-default-values.xml");
@@ -56,6 +59,9 @@
assertEquals("myPortal", config.getDefaultPortalContainer());
assertEquals("myRest", config.getDefaultRestContext());
assertEquals("my-exo-domain", config.getDefaultRealmName());
+ assertFalse(config.isPortalContainerName("portal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer =
@@ -65,6 +71,9 @@
assertEquals("myPortal-dpcdef", config.getDefaultPortalContainer());
assertEquals("myRest-dpcdef", config.getDefaultRestContext());
assertEquals("my-exo-domain-dpcdef", config.getDefaultRealmName());
+ assertFalse(config.isPortalContainerName("portal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
@@ -282,7 +291,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
assertFalse(config.isScopeValid("foo", "foo"));
@@ -345,7 +354,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
assertFalse(config.isScopeValid("foo", "foo"));
@@ -466,13 +475,12 @@
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));
+ assertTrue(names != null && names.isEmpty());
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"));
+ assertNull(config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -481,7 +489,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
@@ -523,13 +531,12 @@
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));
+ assertTrue(names != null && names.isEmpty());
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"));
+ assertNull(config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -538,7 +545,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
@@ -565,13 +572,12 @@
assertEquals(1, names.size());
assertEquals("myPortal-pcdef", names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && !names.isEmpty());
- assertEquals("myPortal", names.get(0));
+ assertTrue(names != null && names.isEmpty());
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"));
+ assertNull(config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -580,7 +586,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
13 years, 10 months
exo-jcr SVN: r2750 - in kernel/branches/2.2.x/exo.kernel.container/src: main/java/org/exoplatform/container/definition and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-07-07 08:19:10 -0400 (Wed, 07 Jul 2010)
New Revision: 2750
Modified:
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
Log:
EXOJCR-842: Now if at least one portal container definition has been defined, which means that we expect the new behavior, the portal container will be only created if the related portal container definition has been defined otherwise we assume that we don't want to create the portal container. Thanks to this feature the portal container "portal" is no more mandatory.
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-07-07 06:50:20 UTC (rev 2749)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/RootContainer.java 2010-07-07 12:19:10 UTC (rev 2750)
@@ -189,12 +189,20 @@
public void registerPortalContainer(ServletContext context)
{
PortalContainerConfig config = getPortalContainerConfig();
- // Ensure that the portal container has been registered
- config.registerPortalContainerName(context.getServletContextName());
if (config.hasDefinition())
{
// The new behavior has been detected thus, the creation will be done at the end asynchronously
- portalContexts.add(new WebAppInitContext(context));
+ if (config.isPortalContainerName(context.getServletContextName()))
+ {
+ // The portal context has been registered has a portal container
+ portalContexts.add(new WebAppInitContext(context));
+ }
+ else
+ {
+ log.info("We assume that the ServletContext '" + context.getServletContextName()
+ + "' is not a portal since no portal container with the same name has been"
+ + " registered to the component PortalContainerConfig.");
+ }
// We assume that a ServletContext of a portal container owns configuration files
final PortalContainerPreInitTask task = new PortalContainerPreInitTask()
{
@@ -208,6 +216,8 @@
}
else
{
+ // Ensure that the portal container has been registered
+ config.registerPortalContainerName(context.getServletContextName());
// The old behavior has been detected thus, the creation will be done synchronously
createPortalContainer(context);
}
@@ -244,11 +254,14 @@
PortalContainerConfig config = getPortalContainerConfig();
for (String portalContainerName : initTasks.keySet())
{
- // Unregister name of portal container that doesn't exist
- log.warn("The portal container '" + portalContainerName + "' doesn't not exist or"
- + " it has not yet been registered, please check your PortalContainerDefinitions and "
- + "the loading order.");
- config.unregisterPortalContainerName(portalContainerName);
+ if (config.isPortalContainerName(portalContainerName))
+ {
+ // Unregister name of portal container that doesn't exist
+ log.warn("The portal container '" + portalContainerName + "' doesn't not exist or"
+ + " it has not yet been registered, please check your PortalContainerDefinitions and "
+ + "the loading order.");
+ config.unregisterPortalContainerName(portalContainerName);
+ }
}
// remove all the unneeded tasks
initTasks.clear();
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-07-07 06:50:20 UTC (rev 2749)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-07-07 12:19:10 UTC (rev 2750)
@@ -39,8 +39,10 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.servlet.ServletContext;
@@ -105,9 +107,9 @@
private volatile boolean initialized;
/**
- * The list of all the portal containers
+ * The set of all the portal containers
*/
- private List<String> portalContainerNames;
+ private Set<String> portalContainerNames;
/**
* The list of all the web application scopes
@@ -354,10 +356,10 @@
{
if (!portalContainerNames.contains(name))
{
- final List<String> lPortalContainerNames = new ArrayList<String>(portalContainerNames.size() + 1);
+ final Set<String> lPortalContainerNames = new LinkedHashSet<String>(portalContainerNames.size() + 1);
lPortalContainerNames.add(name);
lPortalContainerNames.addAll(portalContainerNames);
- this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
}
}
@@ -369,9 +371,9 @@
{
if (portalContainerNames.contains(name))
{
- final List<String> lPortalContainerNames = new ArrayList<String>(portalContainerNames);
+ final Set<String> lPortalContainerNames = new LinkedHashSet<String>(portalContainerNames);
lPortalContainerNames.remove(name);
- this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
}
}
@@ -438,7 +440,7 @@
else if (scopes.isEmpty())
{
// we assume that the old behavior is expected
- return defaultDefinition.getName();
+ return defaultDefinition.getName();
}
final List<String> result = scopes.get(contextName);
if (result == null || result.isEmpty())
@@ -542,7 +544,7 @@
if (portalContainerName == null)
{
throw new IllegalArgumentException("The portal container name cannot be null");
- }
+ }
return getPortalContainerNames(contextName).contains(portalContainerName);
}
@@ -975,9 +977,12 @@
*/
private void initialize(Map<String, PortalContainerDefinition> mDefinitions)
{
- final List<String> lPortalContainerNames = new ArrayList<String>(mDefinitions.size() + 1);
- // Add the default portal container name
- lPortalContainerNames.add(defaultDefinition.getName());
+ final Set<String> lPortalContainerNames = new LinkedHashSet<String>(mDefinitions.size() + 1);
+ if (mDefinitions.isEmpty())
+ {
+ // Add the default portal container name
+ lPortalContainerNames.add(defaultDefinition.getName());
+ }
final Map<String, List<String>> mScopes = new HashMap<String, List<String>>();
boolean first = true;
for (Map.Entry<String, PortalContainerDefinition> entry : mDefinitions.entrySet())
@@ -985,10 +990,7 @@
PortalContainerDefinition definition = entry.getValue();
String name = definition.getName();
boolean hasChanged = false;
- if (!name.equals(defaultDefinition.getName()))
- {
- lPortalContainerNames.add(name);
- }
+ lPortalContainerNames.add(name);
if (first)
{
first = false;
@@ -1032,7 +1034,7 @@
registerDependencies(defaultDefinition, mScopes);
}
}
- this.portalContainerNames = Collections.unmodifiableList(lPortalContainerNames);
+ this.portalContainerNames = Collections.unmodifiableSet(lPortalContainerNames);
this.scopes = Collections.unmodifiableMap(mScopes);
// clear the changes
changes.clear();
Modified: kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2010-07-07 06:50:20 UTC (rev 2749)
+++ kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java 2010-07-07 12:19:10 UTC (rev 2750)
@@ -43,7 +43,7 @@
assertEquals("myRest", portal.getRestContextName());
assertEquals("my-exo-domain", portal.getRealmName());
- assertTrue(PortalContainer.isPortalContainerName("myPortal"));
+ assertFalse(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
@@ -73,7 +73,7 @@
assertEquals("myRest", PortalContainer.getRestContextName("foo"));
assertEquals("my-exo-domain", PortalContainer.getRealmName("foo"));
- assertTrue(PortalContainer.isPortalContainerName("myPortal"));
+ assertFalse(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
@@ -84,7 +84,7 @@
assertEquals("myRest", PortalContainer.getCurrentRestContextName());
assertEquals("my-exo-domain", PortalContainer.getCurrentRealmName());
- assertTrue(PortalContainer.isPortalContainerName("myPortal"));
+ assertFalse(PortalContainer.isPortalContainerName("myPortal"));
assertTrue(PortalContainer.isPortalContainerName("portal"));
assertFalse(PortalContainer.isPortalContainerName("foo"));
}
Modified: kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-07-07 06:50:20 UTC (rev 2749)
+++ kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-07-07 12:19:10 UTC (rev 2750)
@@ -48,6 +48,9 @@
assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getDefaultPortalContainer());
assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getDefaultRestContext());
assertEquals(PortalContainerConfig.DEFAULT_REALM_NAME, config.getDefaultRealmName());
+ assertTrue(config.isPortalContainerName("portal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer = createRootContainer("portal-container-config-with-default-values.xml");
@@ -56,6 +59,9 @@
assertEquals("myPortal", config.getDefaultPortalContainer());
assertEquals("myRest", config.getDefaultRestContext());
assertEquals("my-exo-domain", config.getDefaultRealmName());
+ assertFalse(config.isPortalContainerName("portal"));
+ assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer =
@@ -65,6 +71,9 @@
assertEquals("myPortal-dpcdef", config.getDefaultPortalContainer());
assertEquals("myRest-dpcdef", config.getDefaultRestContext());
assertEquals("my-exo-domain-dpcdef", config.getDefaultRealmName());
+ assertFalse(config.isPortalContainerName("portal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
+ assertTrue(config.isPortalContainerName("myPortal-dpcdef"));
assertFalse(config.hasDefinition());
rootContainer = createRootContainer("portal-container-config-with-default-values-and-with-portal-def.xml");
@@ -282,7 +291,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
assertFalse(config.isScopeValid("foo", "foo"));
@@ -345,7 +354,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
assertFalse(config.isScopeValid("foo", "foo"));
@@ -466,13 +475,12 @@
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));
+ assertTrue(names != null && names.isEmpty());
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"));
+ assertNull(config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -481,7 +489,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
@@ -523,13 +531,12 @@
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));
+ assertTrue(names != null && names.isEmpty());
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"));
+ assertNull(config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -538,7 +545,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
@@ -565,13 +572,12 @@
assertEquals(1, names.size());
assertEquals("myPortal-pcdef", names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && !names.isEmpty());
- assertEquals("myPortal", names.get(0));
+ assertTrue(names != null && names.isEmpty());
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"));
+ assertNull(config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest", config.getRestContextName("foo"));
assertEquals("myRest", config.getRestContextName("myPortal"));
@@ -580,7 +586,7 @@
assertEquals("my-exo-domain", config.getRealmName("myPortal"));
assertEquals("my-exo-domain-pcdef", config.getRealmName("myPortal-pcdef"));
assertFalse(config.isPortalContainerName("foo"));
- assertTrue(config.isPortalContainerName("myPortal"));
+ assertFalse(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
13 years, 10 months
exo-jcr SVN: r2749 - jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-07-07 02:50:20 -0400 (Wed, 07 Jul 2010)
New Revision: 2749
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
Log:
EXOJCR-840: avoid java.util.ConcurrentModificationException in LinkedWorkspaceStorageCacheImpl.onSaveItems()
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-07-07 06:49:46 UTC (rev 2748)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-07-07 06:50:20 UTC (rev 2749)
@@ -1783,12 +1783,12 @@
// delete parent
remove(parent);
- // delete parent containing child nodes list
- nodesCache.remove(parent.getParentIdentifier());
-
writeLock.lock();
try
{
+ // delete parent containing child nodes list
+ nodesCache.remove(parent.getParentIdentifier());
+
// traverse itemCache
Iterator<CacheValue> cacheIterator = cache.values().iterator();
while (cacheIterator.hasNext())
13 years, 10 months
exo-jcr SVN: r2748 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-07-07 02:49:46 -0400 (Wed, 07 Jul 2010)
New Revision: 2748
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
Log:
EXOJCR-840: avoid java.util.ConcurrentModificationException in LinkedWorkspaceStorageCacheImpl.onSaveItems()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-07-07 05:51:07 UTC (rev 2747)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-07-07 06:49:46 UTC (rev 2748)
@@ -1783,12 +1783,12 @@
// delete parent
remove(parent);
- // delete parent containing child nodes list
- nodesCache.remove(parent.getParentIdentifier());
-
writeLock.lock();
try
{
+ // delete parent containing child nodes list
+ nodesCache.remove(parent.getParentIdentifier());
+
// traverse itemCache
Iterator<CacheValue> cacheIterator = cache.values().iterator();
while (cacheIterator.hasNext())
13 years, 10 months
exo-jcr SVN: r2747 - jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-07-07 01:51:07 -0400 (Wed, 07 Jul 2010)
New Revision: 2747
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
Log:
EXOJCR-840: avoid java.util.ConcurrentModificationException in LinkedWorkspaceStorageCacheImpl.onSaveItems()
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-07-07 05:50:36 UTC (rev 2746)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-07-07 05:51:07 UTC (rev 2747)
@@ -563,6 +563,7 @@
*/
class CleanerTask extends WorkerTask
{
+ @Override
public void run()
{
if (currentWorker == null || currentWorker.done)
@@ -582,6 +583,7 @@
*/
class StatisticTask extends WorkerTask
{
+ @Override
public void run()
{
if (currentWorker == null || currentWorker.done)
@@ -1784,33 +1786,41 @@
// delete parent containing child nodes list
nodesCache.remove(parent.getParentIdentifier());
- // traverse itemCache
- Iterator<CacheValue> cacheIterator = cache.values().iterator();
- while (cacheIterator.hasNext())
+ writeLock.lock();
+ try
{
- ItemData cachedItem = cacheIterator.next().getItem();
- if (cachedItem.isNode())
+ // traverse itemCache
+ Iterator<CacheValue> cacheIterator = cache.values().iterator();
+ while (cacheIterator.hasNext())
{
- if (cachedItem.getQPath().isDescendantOf(parent.getQPath()))
+ ItemData cachedItem = cacheIterator.next().getItem();
+ if (cachedItem.isNode())
{
- cacheIterator.remove();
+ if (cachedItem.getQPath().isDescendantOf(parent.getQPath()))
+ {
+ cacheIterator.remove();
+ }
}
}
- }
- // traverse child node Cache
- Iterator<List<NodeData>> childNodesIterator = nodesCache.values().iterator();
- while (childNodesIterator.hasNext())
- {
- List<NodeData> list = childNodesIterator.next();
- if (list != null && list.size() > 0)
+ // traverse child node Cache
+ Iterator<List<NodeData>> childNodesIterator = nodesCache.values().iterator();
+ while (childNodesIterator.hasNext())
{
- if (list.get(0).getQPath().isDescendantOf(parent.getQPath()))
+ List<NodeData> list = childNodesIterator.next();
+ if (list != null && list.size() > 0)
{
- childNodesIterator.remove();
+ if (list.get(0).getQPath().isDescendantOf(parent.getQPath()))
+ {
+ childNodesIterator.remove();
+ }
}
}
}
+ finally
+ {
+ writeLock.unlock();
+ }
}
put(item);
}
13 years, 10 months