You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:59:44 UTC

[sling-org-apache-sling-resourceresolver] 14/47: SLING-2530 : Implement CRUD based on resources

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.resourceresolver-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git

commit 3c93301349cbcddc351df7ac55623eb580640fb6
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Jul 19 11:41:48 2012 +0000

    SLING-2530 : Implement CRUD based on resources
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/resourceresolver@1363304 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/resourceresolver/impl/tree/ProviderHandler.java  | 14 ++++++++++++++
 .../resourceresolver/impl/tree/ResourceProviderEntry.java  |  9 +++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/tree/ProviderHandler.java b/src/main/java/org/apache/sling/resourceresolver/impl/tree/ProviderHandler.java
index ed50acb..c1f25ae 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/tree/ProviderHandler.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/tree/ProviderHandler.java
@@ -46,6 +46,9 @@ public abstract class ProviderHandler implements Comparable<ProviderHandler> {
     /** Configured roots. */
     private final String[] roots;
 
+    /** Owns roots? */
+    private final boolean ownsRoots;
+
     /**
      * Create a new handler
      */
@@ -75,6 +78,7 @@ public abstract class ProviderHandler implements Comparable<ProviderHandler> {
             Collections.sort(configuredRoots);
             this.roots = configuredRoots.toArray(new String[configuredRoots.size()]);
         }
+        this.ownsRoots = PropertiesUtil.toBoolean(properties.get(ResourceProvider.OWNS_ROOTS), false);
     }
 
     /**
@@ -92,6 +96,13 @@ public abstract class ProviderHandler implements Comparable<ProviderHandler> {
     }
 
     /**
+     * Does this provider own the roots?
+     */
+    public boolean ownsRoots() {
+        return this.ownsRoots;
+    }
+
+    /**
      * Return a sorted array of roots for this provider. If no roots are configured,
      * this will return <code>null</code>
      * @return The array of roots or <code>null</code>
@@ -142,6 +153,9 @@ public abstract class ProviderHandler implements Comparable<ProviderHandler> {
      */
     public abstract Iterator<Resource> listChildren(final ResourceResolverContext ctx, final Resource parent);
 
+    /**
+     * Return the resource provider.
+     */
     public abstract ResourceProvider getResourceProvider(final ResourceResolverContext ctx);
 
     /**
diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntry.java b/src/main/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntry.java
index 12b0295..39e8675 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntry.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/tree/ResourceProviderEntry.java
@@ -287,8 +287,11 @@ public class ResourceProviderEntry implements Comparable<ResourceProviderEntry>
                         LOGGER.debug("Resolved Full {} using {} from {} ", new Object[] { fullPath, rp, Arrays.toString(rps) });
                         return resource;
                     }
+                    if ( rp.ownsRoots() ) {
+                        LOGGER.debug("Resource null {} ", fullPath);
+                        return null;
+                    }
                 }
-                // TODO stop handling if provider claims subtree!
             }
 
             // resolve against this one
@@ -343,8 +346,10 @@ public class ResourceProviderEntry implements Comparable<ResourceProviderEntry>
                 if ( provider instanceof ModifyingResourceProvider ) {
                     return (ModifyingResourceProvider) provider;
                 }
+                if ( rp.ownsRoots() ) {
+                    throw new UnsupportedOperationException();
+                }
             }
-            // TODO stop handling if provider claims subtree!
         }
         throw new UnsupportedOperationException();
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.