sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r934090 - in /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal: JcrResourceListener.java JcrResourceResolverFactoryImpl.java
Date Wed, 14 Apr 2010 18:19:49 GMT
Author: cziegeler
Date: Wed Apr 14 18:19:49 2010
New Revision: 934090

URL: http://svn.apache.org/viewvc?rev=934090&view=rev
Log:
SLING-1447 : support for resource paths containing workspace name - fix minor bug in set creation
for listeners and remove obsolete repository parameter.

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java?rev=934090&r1=934089&r2=934090&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
Wed Apr 14 18:19:49 2010
@@ -38,7 +38,6 @@ import org.apache.sling.api.resource.Res
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.api.resource.ResourceUtil;
-import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.resource.JcrResourceConstants;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.util.tracker.ServiceTracker;
@@ -75,7 +74,6 @@ public class JcrResourceListener impleme
 
     /**
      * Constructor.
-     * @param repository The repository to observe.
      * @param workspaceName The workspace name to observe
      * @param factory    The resource resolver factory.
      * @param startPath  The observation root path
@@ -83,16 +81,17 @@ public class JcrResourceListener impleme
      * @param eventAdminTracker The service tracker for the event admin.
      * @throws RepositoryException
      */
-    public JcrResourceListener(final SlingRepository repository,
-                               final String workspaceName,
+    public JcrResourceListener(final String workspaceName,
                                final ResourceResolverFactory factory,
                                final String startPath,
                                final String mountPrefix,
                                final ServiceTracker eventAdminTracker)
     throws LoginException, RepositoryException {
         this.workspaceName = workspaceName;
-        Map<String,Object> authInfo = new HashMap<String,Object>();
-        authInfo.put(JcrResourceConstants.AUTH_INFO_WORKSPACE, workspaceName);
+        final Map<String,Object> authInfo = new HashMap<String,Object>();
+        if ( workspaceName != null ) {
+            authInfo.put(JcrResourceConstants.AUTH_INFO_WORKSPACE, workspaceName);
+        }
         this.resolver = factory.getAdministrativeResourceResolver(authInfo);
         this.session = resolver.adaptTo(Session.class);
         this.startPath = startPath;
@@ -174,12 +173,11 @@ public class JcrResourceListener impleme
         }
     }
 
-    private String createWorkspacePath(String path) {
+    private String createWorkspacePath(final String path) {
         if (workspaceName == null) {
             return path;
-        } else {
-            return workspaceName+":"+path;
         }
+        return workspaceName + ":" + path;
     }
 
     private void sendEvents(final Set<String> paths, final String topic, final EventAdmin
localEA) {

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=934090&r1=934089&r2=934090&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
Wed Apr 14 18:19:49 2010
@@ -381,7 +381,7 @@ public class JcrResourceResolverFactoryI
             this.resourceListeners = new HashSet<JcrResourceListener>();
 
             // first - add a listener for the default workspace
-            this.resourceListeners.add(new JcrResourceListener(this.repository, null, this,
"/", "/", this.eventAdminTracker));
+            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));
@@ -390,11 +390,10 @@ public class JcrResourceResolverFactoryI
             }
 
             if (listenerWorkspaces != null) {
-                this.resourceListeners = new HashSet<JcrResourceListener>(listenerWorkspaces.length);
-                for (String wspName : listenerWorkspaces) {
+                for (final String wspName : listenerWorkspaces) {
                     if (!wspName.equals(this.repository.getDefaultWorkspace())) {
                         this.resourceListeners.add(
-                            new JcrResourceListener(this.repository, wspName, this, "/",
"/", this.eventAdminTracker));
+                            new JcrResourceListener(wspName, this, "/", "/", this.eventAdminTracker));
                     }
                 }
             }



Mime
View raw message