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:20:01 UTC

[sling-org-apache-sling-bundleresource-impl] 13/16: SLING-2541 : General mechanism to chain resource providers

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

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

commit f2f8c9c1f79cf75d9f96df347d1412f7f3b921e7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Oct 25 09:17:34 2012 +0000

    SLING-2541 : General mechanism to chain resource providers
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/bundleresource@1402037 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  4 ----
 .../sling/bundleresource/impl/BundleResource.java  | 27 ++++++++--------------
 2 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/pom.xml b/pom.xml
index ea13490..0a220dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -118,10 +118,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>javax.jcr</groupId>
-            <artifactId>jcr</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
diff --git a/src/main/java/org/apache/sling/bundleresource/impl/BundleResource.java b/src/main/java/org/apache/sling/bundleresource/impl/BundleResource.java
index 9928522..162adb1 100644
--- a/src/main/java/org/apache/sling/bundleresource/impl/BundleResource.java
+++ b/src/main/java/org/apache/sling/bundleresource/impl/BundleResource.java
@@ -25,9 +25,6 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Iterator;
 
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
 import org.apache.sling.api.resource.AbstractResource;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceMetadata;
@@ -68,16 +65,6 @@ public class BundleResource extends AbstractResource implements Resource {
         // able to return an item-based resource
         URL entry = bundle.getEntry(entryPath.concat("/"));
         if (entry != null) {
-            Session session = resourceResolver.adaptTo(Session.class);
-            if (session != null) {
-                try {
-                    if (session.itemExists(resourcePath)) {
-                        return null;
-                    }
-                } catch (RepositoryException re) {
-                    // don't care
-                }
-            }
 
             // append the slash to path for next steps
             resourcePath = resourcePath.concat("/");
@@ -93,7 +80,7 @@ public class BundleResource extends AbstractResource implements Resource {
         // or a bundle file
         if (entry != null) {
             return new BundleResource(resourceResolver, bundle, mappedPath,
-                resourcePath);
+                    resourcePath);
         }
 
         // the bundle does not contain the path
@@ -117,6 +104,7 @@ public class BundleResource extends AbstractResource implements Resource {
 
             this.path = resourcePath.substring(0, resourcePath.length() - 1);
             this.resourceType = NT_FOLDER;
+            metadata.put(ResourceMetadata.INTERNAL_CONTINUE_RESOLVING, Boolean.TRUE);
 
         } else {
 
@@ -153,6 +141,7 @@ public class BundleResource extends AbstractResource implements Resource {
         return resourceResolver;
     }
 
+    @Override
     @SuppressWarnings("unchecked")
     public <Type> Type adaptTo(Class<Type> type) {
         if (type == InputStream.class) {
@@ -165,9 +154,10 @@ public class BundleResource extends AbstractResource implements Resource {
         return super.adaptTo(type);
     }
 
+    @Override
     public String toString() {
         return getClass().getSimpleName() + ", type=" + getResourceType()
-            + ", path=" + getPath();
+                + ", path=" + getPath();
     }
 
     // ---------- internal -----------------------------------------------------
@@ -186,7 +176,7 @@ public class BundleResource extends AbstractResource implements Resource {
                 }
             } catch (IOException ioe) {
                 log.error(
-                    "getInputStream: Cannot get input stream for " + this, ioe);
+                        "getInputStream: Cannot get input stream for " + this, ioe);
             }
         }
 
@@ -198,8 +188,8 @@ public class BundleResource extends AbstractResource implements Resource {
         if (url == null) {
             try {
                 url = new URL(BundleResourceURLStreamHandler.PROTOCOL, null,
-                    -1, path, new BundleResourceURLStreamHandler(
-                        bundle.getBundle(), mappedPath.getEntryPath(path)));
+                        -1, path, new BundleResourceURLStreamHandler(
+                                bundle.getBundle(), mappedPath.getEntryPath(path)));
             } catch (MalformedURLException mue) {
                 log.error("getURL: Cannot get URL for " + this, mue);
             }
@@ -208,6 +198,7 @@ public class BundleResource extends AbstractResource implements Resource {
         return url;
     }
 
+    @Override
     public Iterator<Resource> listChildren() {
         return new BundleResourceIterator(this);
     }

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