You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2010/04/16 16:39:26 UTC

svn commit: r934929 - in /sling/trunk/bundles/jcr/resource/src/main: java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java resources/OSGI-INF/metatype/metatype.properties

Author: cziegeler
Date: Fri Apr 16 14:39:26 2010
New Revision: 934929

URL: http://svn.apache.org/viewvc?rev=934929&view=rev
Log:
SLING-1447 : support for resource paths containing workspace name - use single boolean config value

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
    sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java?rev=934929&r1=934928&r2=934929&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java (original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java Fri Apr 16 14:39:26 2010
@@ -19,7 +19,6 @@
 package org.apache.sling.jcr.resource.internal;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Dictionary;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -162,9 +161,11 @@ public class JcrResourceResolverFactoryI
     private static final String PROP_MAP_LOCATION = "resource.resolver.map.location";
 
     /**
-     * @scr.property cardinality="+"
+     * @scr.property valueRef="DEFAULT_MULTIWORKSPACE"
      */
-    private static final String PROP_LISTENER_WORKSPACES = "resource.resolver.listener.workspaces";
+    private static final String PROP_MULTIWORKSPACE = "resource.resolver.multiworkspace";
+
+    private static final boolean DEFAULT_MULTIWORKSPACE = false;
 
     /** default log */
     private final Logger log = LoggerFactory.getLogger(getClass());
@@ -383,13 +384,10 @@ public class JcrResourceResolverFactoryI
             // first - add a listener for the default workspace
             this.resourceListeners.add(new JcrResourceListener(null, this, "/", "/", this.eventAdminTracker));
 
-            // then, iterate through any workspaces which are configured
-            String[] listenerWorkspaces = OsgiUtil.toStringArray(properties.get(PROP_LISTENER_WORKSPACES));
-            if (Arrays.asList(listenerWorkspaces).contains(ALL_WORKSPACES)) {
-                listenerWorkspaces = getAllWorkspaces();
-            }
-
-            if (listenerWorkspaces != null) {
+            // check if multi workspace support is enabled
+            final boolean useMultiWorkspaces = OsgiUtil.toBoolean(properties.get(PROP_MULTIWORKSPACE), DEFAULT_MULTIWORKSPACE);
+            if (useMultiWorkspaces) {
+                final String[] listenerWorkspaces = getAllWorkspaces();
                 for (final String wspName : listenerWorkspaces) {
                     if (!wspName.equals(this.repository.getDefaultWorkspace())) {
                         this.resourceListeners.add(

Modified: sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=934929&r1=934928&r2=934929&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties (original)
+++ sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties Fri Apr 16 14:39:26 2010
@@ -71,8 +71,7 @@ resource.resolver.manglenamespaces.descr
  path part of URI references with a scheme. The default value of this property \
  if no configuration is provided is "true".
 
-resource.resolver.listener.workspaces.name = Listener Workspaces
-resource.resolver.listener.workspaces.description = A list of workspaces \
- to which the JCR Resource Resolver should observe and fire OSGi events \
- upon workspace changes. The special value '*' results in observation happening \
- for all workspaces.
+resource.resolver.multiworkspace.name=Enable Multi Workspaces
+resource.resolver.multiworkspace.name=If this is enabled, multiple workspaces are supported \
+ This includes registering observation listeners for all workspaces and allows to \
+ resolve resources from other workspaces than the default one.