incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r833280 - in /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper: ResourceProviderEntry2.java WrappedResourceProvider.java
Date Fri, 06 Nov 2009 02:20:20 GMT
Author: ieb
Date: Fri Nov  6 02:20:19 2009
New Revision: 833280

URL: http://svn.apache.org/viewvc?rev=833280&view=rev
Log:
SLING-1156
Fixed incorrect resolution of Synthetic Resources, all tests pass.

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry2.java
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/WrappedResourceProvider.java

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry2.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry2.java?rev=833280&r1=833279&r2=833280&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry2.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry2.java
Fri Nov  6 02:20:19 2009
@@ -149,6 +149,8 @@
             private Map<String, Resource> delayed;
 
             private Set<String> visited;
+            
+            private String iteratorPath;
 
             private Iterator<Resource> delayedIter;
 
@@ -166,6 +168,7 @@
                 
                 LOGGER.debug(" Provider Set for path {} {} ",path,Arrays.toString(providersSet.toArray(new
ResourceProvider[0])));
 
+                this.iteratorPath = path;
                 providers = providersSet.iterator();
                 delayed = new HashMap<String, Resource>();
                 visited = new HashSet<String>();
@@ -183,7 +186,7 @@
 
                 Resource result = nextResource;
                 nextResource = seek();
-                LOGGER.debug("  Child Resoruce {} ", result.getPath());
+                LOGGER.debug("  Child Resoruce [{}] [{}] ", iteratorPath, result.getPath());
                 return result;
             }
 
@@ -203,7 +206,6 @@
                     if (resources != null && resources.hasNext()) {
                         Resource res = resources.next();
                         String resPath = res.getPath();
-                        LOGGER.debug("      resource {} ", res.getPath());
 
                         if (visited.contains(resPath)) {
 
@@ -224,6 +226,11 @@
                             // we use this concrete, unvisited resource but
                             // mark it as visited
                             visited.add(resPath);
+                            // also remove it from delayed if it was there.
+                            if ( delayed.containsKey(resPath) ) {
+                                delayed.remove(resPath);
+                            }
+                            LOGGER.debug("      resource {} {}", resPath, res.getClass());
                             return res;
 
                         }
@@ -239,7 +246,7 @@
                 }
                 Resource res = delayedIter.hasNext() ? delayedIter.next() : null;
                 if ( res != null ) {
-                    LOGGER.debug("   D  resource {} ", res.getPath());
+                    LOGGER.info("   D  resource {} {}", res.getPath(), res.getClass());
                 }
                 return res;
             }
@@ -461,6 +468,18 @@
                     }
                 }
             }
+            
+            // resolve against this one
+            ResourceProvider[] rps = getResourceProviders();
+            for (ResourceProvider rp : rps) {
+                Resource resource = rp.getResource(resourceResolver, fullPath);
+                if (resource != null) {
+                    nreal++;
+                    LOGGER.debug("Resolved Base {} using {} ", fullPath, rp);
+                    return resource;
+                }
+            }
+            
             // query: /libs/sling/servlet/default
             // resource Provider: libs/sling/servlet/default/GET.servlet
             // list will match libs, sling, servlet, default 
@@ -475,16 +494,6 @@
                 }
             }
 
-            // resolve against this one
-            ResourceProvider[] rps = getResourceProviders();
-            for (ResourceProvider rp : rps) {
-                Resource resource = rp.getResource(resourceResolver, fullPath);
-                if (resource != null) {
-                    nreal++;
-                    LOGGER.debug("Resolved Base {} using {} ", fullPath, rp);
-                    return resource;
-                }
-            }
 
 
             LOGGER.debug("Resource null {} ", fullPath);

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/WrappedResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/WrappedResourceProvider.java?rev=833280&r1=833279&r2=833280&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/WrappedResourceProvider.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/WrappedResourceProvider.java
Fri Nov  6 02:20:19 2009
@@ -1,5 +1,5 @@
 /*
- * Licensed to the Sakai Foundation (SF) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
  * regarding copyright ownership. The SF licenses this file
@@ -92,6 +92,15 @@
     }
     return super.equals(obj);
   }
-
+  
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return resourceProvider.toString();
+    }
 
 }



Mime
View raw message