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:37:07 UTC

[sling-org-apache-sling-fsresource] annotated tag org.apache.sling.fsresource-1.2.2 created (now a3a508c)

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

rombert pushed a change to annotated tag org.apache.sling.fsresource-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git.


      at a3a508c  (tag)
 tagging 278e6c99bae8d911639d0c34238de89f504ba2ca (commit)
      by Stefan Seifert
      on Thu Jan 19 21:58:32 2017 +0000

- Log -----------------------------------------------------------------
org.apache.sling.fsresource-1.2.2
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new 0c33118  SLING-583 Initial implementation of a filesystem resource provider
     new fd8bbdc  Code formatting
     new 6f617dc  SLING-583 Fix FsResourceProvider.listChildren if the provider root is to be return as the single entry in the iterator
     new fc83e32  SLING-583 Latest change introduces dependency on JCR API (because a directory is not returned any more as a resource if a repository item with the same name exists)
     new 7ab3c81  SLING-583 Cleanup to consistently not return FsResource instances for directories "hiding" existing repository items.
     new a46c284  Remove redundant null check
     new c361d2a  SLING-808 : Increase version to 5-incubator-SNAPSHOT
     new a284078  SLING-829 Cosmetics to the bundle/project names
     new 6ec1315  SLING-829 Ensure Apache Sling prefix on all configuration names
     new 4d89314  SLING-865 - Correct location
     new 48e6a1d  SLING-865 - Correct pom and svn reference.
     new 5150158  SLING-916 move non-exported packages to internal packages and remove javadoc configuration which will be inherited from parent pom
     new 19d32c4  Fix fsresource provider and sling plugin after recent refactorings.
     new 6799d74  Use release parent pom
     new bee824c  [maven-release-plugin] prepare release org.apache.sling.fsresource-0.9.0-incubator
     new fe60fe1  [maven-release-plugin] prepare for next development iteration
     new 8958da0  Use next dev version of parent pom
     new 36ccd05  Add missing licence, notice etc.
     new 6bcf253  Prepare new release.
     new 16644cd  [maven-release-plugin] prepare release org.apache.sling.fsresource-0.9.2-incubator
     new 746e1d1  [maven-release-plugin] prepare for next development iteration
     new 16ecaa5  Use next parent pom for development.
     new f943311  Set parent pom to released version.
     new ab2cf0f  Move Sling to new TLP location
     new 501bb88  SLING-1011 : Remove disclaimer file.
     new b47fdc9  SLING-1011 : Adjust svn location
     new 40f9091  SLING-1011 : Remove disclaimer from readme's, adjust links to webite, fix versions in poms.
     new 164dbcf  SLING-1033 Upgrade to Sling parent POM 6 (and ensure web app has the leglize stuff, too)
     new 2f0cded  Use official release instead of incubator release.
     new 10c9088  Update to latest Sling releases.
     new a8b5bdf  Update to latest release.
     new 2d2ef3d  SLING-1186 Upgrade to Sling Parent POM 8-SNAPSHOT (to use SCR plugin 1.4.0), set DS specification version of components to 1.1, convert component into a regular (non-ComponentFactory) component and ensure meta type descriptor is generated with factoryPid set to the same value as the PID to have factory configuration support.
     new 3111d96  SLING-1186 Parent POM 7 is good enough (no need for 8-SNAPSHOT)
     new 2051b5f  SLING-1187 Remove FsProviderConstants (moved constants to FsResource) and FsFolderServlet (duplicate code from default GET Servlet)
     new 3a95821  SLING-1192 use nt:file and nt:folder for files and folders and drop the special resource super type
     new a78ef39  SLING-1205 Upgrade all projects to parent POM 8 and use OSGi provided OSGi libraries
     new 5137b7e  Just code cleanup - no functional changes.
     new 71d0b66  Check whether the abstract file is a directory before trying to open the FileInputStream on it (to prevent a nasty log message)
     new 93cda71  SLING-1387 : File system provider should send resource events
     new 38aa5a1  SLING-1387 : File system provider should send resource events
     new 5d6630a  [maven-release-plugin] prepare release org.apache.sling.fsresource-1.0.0
     new c0d679e  [maven-release-plugin] prepare for next development iteration
     new feb2473  SLING-1516 Fixed by looking for a factory pid on activation.
     new b109367  SLING-1516  A much better fix provided by Felix.
     new 8df175a  Use released parent pom.
     new a30c588  SLING-1193 Fsresoruce and bundle resource implement the 2.0.8 API which means they cant be used with ResourceUtil, updated.
     new c385893  SLING-1193 Have the bundle plugin set the correct import version range for the resource API implemented by the bundles
     new 61509be  SLING-1625 Check File.listFiles() result to prevent NullPointerException
     new b5c493c  Use latest Sling API release
     new 8cd0450  Fix javadocs
     new 26c5948  updating all modules to parent 10-SNAPSHOT in anticipation of emma additions to parent
     new 9281408  fixing relativePaths
     new a8d1b87  Update to recent snapshots
     new 2979d42  Use latest releases.
     new abcabe3  Remove obsolete licence and notice
     new 4d518af  [maven-release-plugin] prepare release org.apache.sling.fsresource-1.0.2
     new 820f5c2  [maven-release-plugin] prepare for next development iteration
     new 04c2091  SLING-2150 : Update plugins to use the latest available versions
     new 15cc17a  Update to recent snapshot
     new 366633f  Using latest released parent pom
     new 630b18e  SLING-2187 - adding new module to contain our custom notice file; adding remote-resources plugin configuration to parent pom and removing all existing appended-resources NOTICE files
     new f4a2616  temporarily using snapshots during release vote
     new 15c85c9  using latest releases
     new 0aba830  SLING-2312 - adding adapter annotations for fsresource bundle
     new 8309283  SLING-2314 - applying patch from Stefan Seifert to switch annotation style on FSResourceProvider. Thanks for the patch!
     new 8318373  SLING-1081 : fsresource: allow to adapt to ValueMap
     new cc90f52  using next snapshots during release process
     new d3e5959  Use released adapter annotations.
     new 7c14443  Use released maven sling plugin
     new a30d734  SLING-2480 : Add config for maven-sling-plugin to m2e configuration
     new 1c8b6ab  SLING-2483 Use provide:=true instead of version macros to define the proper import version range. Also fix a small glitch in the parent pom relativePath of the framework-extension-ws bundle
     new d61a155  Correctly increase resource package version and include latest resource providers.
     new 9363ec0  Update to latest parent pom
     new 28ecd71  Use released versions
     new 195c76d  SLING-2541 : General mechanism to chain resource providers
     new e71601f  Preparing release
     new 5468aa2  [maven-release-plugin] prepare release org.apache.sling.fsresource-1.1.0
     new 7b1b0a6  [maven-release-plugin] prepare for next development iteration
     new f867347  Set dependencies to latest snapshots after release
     new 747e4bb  Update to released bundles
     new d93f502  Use latest releases and update to new parent pom
     new 94c55fa  Update to latest parent pom and use latest releases in launchpad
     new 2653bcb  SLING-2739 :  Add methods for handling the resource type hierarchy to the resource resolver
     new 0e9dd0f  Prepare for release
     new a76cf10  [maven-release-plugin] prepare release org.apache.sling.fsresource-1.1.2
     new 418479c  [maven-release-plugin] prepare for next development iteration
     new fb5221e  Use latest snapshot
     new 8cf1d4e  Use released versions after release.
     new b273649  Correct reactor pom and update to parent pom 16
     new c9aca5b  Update to latest parent pom
     new 592bc1e  SLING-2944 Revert Sling API dependency to 2.3.0 again
     new d5588c1  Update to parent pom 18
     new 0bb72cc  SLING-3286 - Remove plugin version overrides from poms
     new 2254ba3  Update to parent pom v19
     new 9584f16  3804 : Fields for dynamic references must be volatile
     new 07281a3  Updated to parent version 20
     new 4392745  [maven-release-plugin] prepare release org.apache.sling.fsresource-1.1.4
     new a4d1ae4  [maven-release-plugin] prepare for next development iteration
     new 2b642b2  Update to Sling Parent POM 22 with baselining enabled
     new 43259e6  SLING-4698 - Set parent.relativePath to empty for all modules
     new be69e70  Update to Sling Parent 23
     new b030d0c  set parent version to 24 and add empty relativePath where missing
     new 0320672  Update the main reactor to parent 25
     new 9f877f5  SLING-5192 - FsResourceProvider should set webconsole.configurationFactory.nameHint
     new a5f05c9  Switch to parent pom 26
     new dde630e  SLING-6279 : Switch from event admin to Sling Resource Observation API
     new a0bc09c  SLING-6279 : Switch from event admin to Sling Resource Observation API
     new 741a449  SLING-6364 fix provider.roots config property name, and property labels/descriptions (patch provided by Sandro Boehme)
     new c2b7f0c  SLING-6364 rename config property back to provider.root because this is expected for an resource provider
     new 566413e  SLING-6364 make sure webconsole nameHint is included in metatype
     new 57279b1  [maven-release-plugin] prepare release org.apache.sling.fsresource-1.2.0
     new 1958519  [maven-release-plugin] prepare for next development iteration
     new bcf3200  SLING-6439 : Filesystem Resource Provider does not support overlaying nodes from repository
     new 9998dd0  SLING-6439 make sure directory resources from parent resource provider have higher precedence than from this provider this allows properties like sling:resourceSuperType to take effect
     new 4ef6f63  SLING-6439 define own property for handling directory references instead of the deprecated ResourceMetadata.INTERNAL_CONTINUE_RESOLVING
     new a08a244  fix javadoc errors
     new 6aa918b  [maven-release-plugin] prepare release org.apache.sling.fsresource-1.2.2
     new 278e6c9  [maven-release-plugin] copy for tag org.apache.sling.fsresource-1.2.2

The 118 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


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

[sling-org-apache-sling-fsresource] 04/07: SLING-6439 define own property for handling directory references instead of the deprecated ResourceMetadata.INTERNAL_CONTINUE_RESOLVING

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4ef6f63d532ce2b458f6028ff7ac693e344c60d2
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Jan 16 15:53:51 2017 +0000

    SLING-6439 define own property for handling directory references instead of the deprecated ResourceMetadata.INTERNAL_CONTINUE_RESOLVING
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource@1779048 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/fsprovider/internal/FsResource.java  |  2 +-
 .../apache/sling/fsprovider/internal/FsResourceProvider.java   | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java b/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java
index 1397045..502d0ca 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java
@@ -111,7 +111,7 @@ public class FsResource extends AbstractResource {
             metaData.setModificationTime(file.lastModified());
             metaData.setResolutionPath(resourcePath);
             if ( this.file.isDirectory() ) {
-                metaData.put(ResourceMetadata.INTERNAL_CONTINUE_RESOLVING, Boolean.TRUE);
+                metaData.put(FsResourceProvider.RESOURCE_METADATA_FILE_DIRECTORY, Boolean.TRUE);
             }
         }
         return metaData;
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
index f739dbb..a3a001f 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
@@ -26,7 +26,6 @@ import java.util.NoSuchElementException;
 import java.util.Set;
 
 import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceMetadata;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.spi.resource.provider.ObservationReporter;
 import org.apache.sling.spi.resource.provider.ProviderContext;
@@ -63,7 +62,12 @@ import org.osgi.service.metatype.annotations.ObjectClassDefinition;
            })
 @Designate(ocd=FsResourceProvider.Config.class, factory=true)
 public class FsResourceProvider extends ResourceProvider<Object> {
-
+    
+    /**
+     * Resource metadata property set by {@link FsResource} if the underlying file reference is a directory.
+     */
+    static final String RESOURCE_METADATA_FILE_DIRECTORY = ":org.apache.sling.fsprovider.file.directory";
+    
     @ObjectClassDefinition(name = "Apache Sling Filesystem Resource Provider",
             description = "Configure an instance of the filesystem " +
                           "resource provider in terms of provider root and filesystem location")
@@ -132,7 +136,7 @@ public class FsResourceProvider extends ResourceProvider<Object> {
         Resource rsrc = getResource(ctx.getResourceResolver(), path, getFile(path));
         // make sure directory resources from parent resource provider have higher precedence than from this provider
         // this allows properties like sling:resourceSuperType to take effect
-        if ( rsrc == null || rsrc.getResourceMetadata().containsKey(ResourceMetadata.INTERNAL_CONTINUE_RESOLVING) ) {
+        if ( rsrc == null || rsrc.getResourceMetadata().containsKey(RESOURCE_METADATA_FILE_DIRECTORY) ) {
         	// get resource from shadowed provider
         	final ResourceProvider rp = ctx.getParentResourceProvider();
         	if ( rp != null ) {

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

[sling-org-apache-sling-fsresource] 07/07: [maven-release-plugin] copy for tag org.apache.sling.fsresource-1.2.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 278e6c99bae8d911639d0c34238de89f504ba2ca
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Jan 19 21:58:32 2017 +0000

    [maven-release-plugin] copy for tag org.apache.sling.fsresource-1.2.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.2.2@1779534 13f79535-47bb-0310-9956-ffa450edef68

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

[sling-org-apache-sling-fsresource] 03/07: SLING-6439 make sure directory resources from parent resource provider have higher precedence than from this provider this allows properties like sling:resourceSuperType to take effect

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9998dd0295ba54e484a9963abe852e83c19871fd
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Jan 9 16:55:35 2017 +0000

    SLING-6439 make sure directory resources from parent resource provider have higher precedence than from this provider
    this allows properties like sling:resourceSuperType to take effect
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource@1778016 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/fsprovider/internal/FsResourceProvider.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
index 1b2e571..f739dbb 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
@@ -26,6 +26,7 @@ import java.util.NoSuchElementException;
 import java.util.Set;
 
 import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceMetadata;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.spi.resource.provider.ObservationReporter;
 import org.apache.sling.spi.resource.provider.ProviderContext;
@@ -129,13 +130,18 @@ public class FsResourceProvider extends ResourceProvider<Object> {
             final ResourceContext resourceContext,
             final Resource parent) {
         Resource rsrc = getResource(ctx.getResourceResolver(), path, getFile(path));
-        if ( rsrc == null ) {
+        // make sure directory resources from parent resource provider have higher precedence than from this provider
+        // this allows properties like sling:resourceSuperType to take effect
+        if ( rsrc == null || rsrc.getResourceMetadata().containsKey(ResourceMetadata.INTERNAL_CONTINUE_RESOLVING) ) {
         	// get resource from shadowed provider
         	final ResourceProvider rp = ctx.getParentResourceProvider();
         	if ( rp != null ) {
-	            rsrc = rp.getResource((ResolveContext)ctx.getParentResolveContext(), 
+        	    Resource resourceFromParentResourceProvider = rp.getResource((ResolveContext)ctx.getParentResolveContext(), 
 	            		path, 
 	            		resourceContext, parent);
+        	    if (resourceFromParentResourceProvider != null) {
+        	        rsrc = resourceFromParentResourceProvider;
+        	    }
         	}        	
         }
         return rsrc;

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

[sling-org-apache-sling-fsresource] 06/07: [maven-release-plugin] prepare release org.apache.sling.fsresource-1.2.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6aa918bbc9082947b15b78d72e4160954da4f789
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Jan 19 21:58:19 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.fsresource-1.2.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource@1779533 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index c5eb7d5..cdfdc7d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.fsresource</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.1-SNAPSHOT</version>
+    <version>1.2.2</version>
 
     <name>Apache Sling Filesystem Resource Provider</name>
     <description>
@@ -37,9 +37,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/fsresource</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.2.2</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.2.2</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.fsresource-1.2.2</url>
     </scm>
 
     <build>

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

[sling-org-apache-sling-fsresource] 01/07: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 19585197f5d2a530790aab0b65ad6411211621a1
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Jan 3 08:59:01 2017 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource@1777096 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 926755a..c5eb7d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.fsresource</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.0</version>
+    <version>1.2.1-SNAPSHOT</version>
 
     <name>Apache Sling Filesystem Resource Provider</name>
     <description>
@@ -37,9 +37,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.2.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.2.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.fsresource-1.2.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/fsresource</url>
     </scm>
 
     <build>

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

[sling-org-apache-sling-fsresource] 05/07: fix javadoc errors

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a08a2445b5f3c9e4afc34c37f56b49dfe196a095
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Jan 19 21:58:00 2017 +0000

    fix javadoc errors
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource@1779532 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/fsprovider/internal/FsResourceProvider.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
index a3a001f..4a32737 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
@@ -49,9 +49,9 @@ import org.osgi.service.metatype.annotations.ObjectClassDefinition;
  * this provider may be created by creating respective configuration.
  * <p>
  * Each provider instance is configured with two properties: The location in the
- * resource tree where resources are provided ({@link ResourceProvider#ROOTS})
+ * resource tree where resources are provided (provider.root)
  * and the file system path from where files and folders are mapped into the
- * resource ({@link #PROP_PROVIDER_FILE}).
+ * resource (provider.file).
  */
 @Component(name="org.apache.sling.fsprovider.internal.FsResourceProvider",
            service=ResourceProvider.class,

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

[sling-org-apache-sling-fsresource] 02/07: SLING-6439 : Filesystem Resource Provider does not support overlaying nodes from repository

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit bcf3200857b489db9ab0add358a81b56a8339499
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jan 6 06:20:00 2017 +0000

    SLING-6439 : Filesystem Resource Provider does not support overlaying nodes from repository
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource@1777534 13f79535-47bb-0310-9956-ffa450edef68
---
 .../fsprovider/internal/FsResourceProvider.java    | 115 +++++++++++++--------
 1 file changed, 72 insertions(+), 43 deletions(-)

diff --git a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
index d68ad3a..1b2e571 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
@@ -20,8 +20,10 @@ package org.apache.sling.fsprovider.internal;
 
 import java.io.File;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
+import java.util.Set;
 
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
@@ -120,12 +122,23 @@ public class FsResourceProvider extends ResourceProvider<Object> {
      * to access the file or folder. If no such file or folder exists, this
      * method returns <code>null</code>.
      */
-    @Override
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+	@Override
     public Resource getResource(final ResolveContext<Object> ctx,
             final String path,
             final ResourceContext resourceContext,
             final Resource parent) {
-        return getResource(ctx.getResourceResolver(), path, getFile(path));
+        Resource rsrc = getResource(ctx.getResourceResolver(), path, getFile(path));
+        if ( rsrc == null ) {
+        	// get resource from shadowed provider
+        	final ResourceProvider rp = ctx.getParentResourceProvider();
+        	if ( rp != null ) {
+	            rsrc = rp.getResource((ResolveContext)ctx.getParentResolveContext(), 
+	            		path, 
+	            		resourceContext, parent);
+        	}        	
+        }
+        return rsrc;
     }
 
     /**
@@ -165,55 +178,70 @@ public class FsResourceProvider extends ResourceProvider<Object> {
             }
         }
 
+    	// get children from from shadowed provider
+    	final ResourceProvider rp = ctx.getParentResourceProvider();
+    	final Iterator<Resource> parentChildrenIterator;
+    	if ( rp != null ) {
+    		parentChildrenIterator = rp.listChildren(ctx.getParentResolveContext(), parent);
+    	} else {
+    		parentChildrenIterator = null;
+    	}
         final File[] children = parentFile.listFiles();
 
-        if (children != null && children.length > 0) {
-            final ResourceResolver resolver = parent.getResourceResolver();
-            final String parentPath = parent.getPath();
-            return new Iterator<Resource>() {
-                int index = 0;
+        final ResourceResolver resolver = ctx.getResourceResolver();
+        final String parentPath = parent.getPath();
+        return new Iterator<Resource>() {
 
-                Resource next = seek();
+            final Set<String> names = new HashSet<>();
 
-                @Override
-                public boolean hasNext() {
-                    return next != null;
-                }
+            int index = 0;
 
-                @Override
-                public Resource next() {
-                    if (!hasNext()) {
-                        throw new NoSuchElementException();
-                    }
+            Resource next = seek();
 
-                    Resource result = next;
-                    next = seek();
-                    return result;
-                }
+            @Override
+            public boolean hasNext() {
+                return next != null;
+            }
 
-                @Override
-                public void remove() {
-                    throw new UnsupportedOperationException("remove");
+            @Override
+            public Resource next() {
+                if (!hasNext()) {
+                    throw new NoSuchElementException();
                 }
 
-                private Resource seek() {
-                    while (index < children.length) {
-                        File file = children[index++];
-                        String path = parentPath + "/" + file.getName();
-                        Resource result = getResource(resolver, path, file);
-                        if (result != null) {
-                            return result;
-                        }
-                    }
+                Resource result = next;
+                next = seek();
+                return result;
+            }
 
-                    // nothing found any more
-                    return null;
-                }
-            };
-        }
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException("remove");
+            }
 
-        // no children
-        return null;
+            private Resource seek() {
+                while (children != null && index < children.length) {
+                    File file = children[index++];
+                    String path = parentPath + "/" + file.getName();
+                    Resource result = getResource(resolver, path, file);
+                    if (result != null) {
+                    	names.add(file.getName());
+                        return result;
+                    }
+                }
+                if ( parentChildrenIterator != null ) {
+                	while ( parentChildrenIterator.hasNext() ) {
+                		final Resource result = parentChildrenIterator.next();
+                		if ( !names.contains(result.getName()) ) {
+                			names.add(result.getName());
+                			return result;
+                		}
+                	}
+                }
+                // nothing found any more
+                return null;
+            }
+        };
     }
 
     // ---------- SCR Integration
@@ -307,15 +335,16 @@ public class FsResourceProvider extends ResourceProvider<Object> {
         return null;
     }
 
-    private Resource getResource(ResourceResolver resourceResolver,
-            String resourcePath, File file) {
+    private Resource getResource(final ResourceResolver resolver,
+            final String resourcePath, 
+            final File file) {
 
         if (file != null) {
 
             // if the file exists, but is not a directory or no repository entry
             // exists, return it as a resource
             if (file.exists()) {
-                return new FsResource(resourceResolver, resourcePath, file);
+                return new FsResource(resolver, resourcePath, file);
             }
 
         }

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