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:39 UTC

[sling-org-apache-sling-fsresource] annotated tag org.apache.sling.fsresource-1.4.0 created (now bdc4f41)

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

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


      at bdc4f41  (tag)
 tagging 3dca7ab88ab652d0eef399907419df6cc2191898 (commit)
      by Stefan Seifert
      on Thu May 4 20:19:48 2017 +0000

- Log -----------------------------------------------------------------
org.apache.sling.fsresource-1.4.0
-----------------------------------------------------------------------

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 f4b94c0  branch fsresource version before switch to new Sling API
     new 54e89e7  backport of changes from SLING-6440 and SLING-6537 to 1.1.x version of fsresource based on old resource provider SPI
     new 88b3a59  SLING-6440 simplify FileMonitor
     new 2ea8852  SLING-6440 switch to fscontentparser rename "Filesystem" to "File System" update to latest parent
     new aa2eecc  SLING-6440 update to latest API
     new b342fb6  set version in branch to 1.3.0-SNAPSHOT (for old Resource Provider SPI)
     new af87b04  SLING-6537 FileVault XML support
     new 633173f  rename branch folder to 1.x
     new a30fb87  update scm urls for branch
     new 62f16aa  SLING-6537 FileVault XML support
     new 4c1b15f  SLING-6440 use ManifestHeader to parse directives
     new 56b09e5  SLING-6537 FileVault XML support
     new 98a2215  SLING-6537 BigDecimal support, use copy of enhanced ValueMap with proper type converstion from Sling API 2.17.0
     new f21de7a  SLING-6630 rename INITIAL_CONTENT_FILES_FOLDERS to FILES_FOLDERS
     new 16babc3  SLING-6630 make FILES_FOLDERS default
     new 81a06d6  cosmetic: use consistent wording, reorder config attributes
     new a353cfb  SLING-6440 switch to latest jcr/contentparser API
     new 8c0e64a  SLING-6440 switch to latest jcr/contentparser API
     new aa6fca1  SLING-6440 switch to latest contentparser API
     new ac983c8  update dependencies
     new 2386504  fix javadoc errors
     new 3f53032  [maven-release-plugin] prepare release org.apache.sling.fsresource-1.3.0
     new 717d5d4  [maven-release-plugin] prepare for next development iteration
     new 6313850  update sling-mock dependency
     new 935fb00  SLING-6829 FSResource: Support node descriptor files for folders and binary files
     new 737a614  SLING-6829 make unit tests independent of resource child order
     new cb0c2b3  SLING-6829 make sour FileResource for directories is only overlayed in FILES_FOLDERS mode
     new e2a4f74  update dependency
     new 4498633  [maven-release-plugin] prepare release org.apache.sling.fsresource-1.4.0
     new 3dca7ab  [maven-release-plugin] copy for tag org.apache.sling.fsresource-1.4.0

The 135 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] 03/08: SLING-6829 FSResource: Support node descriptor files for folders and binary files

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.4.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git

commit 935fb00f8483e8c324122adef8ca1a4da6564a89
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 16:10:35 2017 +0000

    SLING-6829 FSResource: Support node descriptor files for folders and binary files
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/fsresource-1.x@1793827 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |   2 +-
 .../fsprovider/internal/ContentFileExtensions.java |  14 ++-
 .../fsprovider/internal/FsResourceProvider.java    |  16 ++--
 .../internal/mapper/ContentFileResourceMapper.java |  14 ++-
 .../fsprovider/internal/mapper/FileResource.java   | 101 ++++++++++++++++-----
 .../internal/mapper/FileResourceMapper.java        |  12 ++-
 .../internal/parser/ContentFileParserUtil.java     |   5 +
 .../internal/parser/ContentFileTypes.java          |   5 +
 .../sling/fsprovider/internal/JsonContentTest.java |  17 +++-
 .../internal/parser/ContentFileParserUtilTest.java |   8 ++
 src/test/resources/fs-test/folder2/folder21.xml    |   4 +
 .../fs-test/folder2/folder21/file21a.txt.xml       |  15 +++
 12 files changed, 173 insertions(+), 40 deletions(-)

diff --git a/pom.xml b/pom.xml
index ff3e267..037bb3e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,7 +148,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.contentparser</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/ContentFileExtensions.java b/src/main/java/org/apache/sling/fsprovider/internal/ContentFileExtensions.java
index f9cacec..2de233e 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/ContentFileExtensions.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/ContentFileExtensions.java
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.fsprovider.internal;
 
+import static org.apache.sling.fsprovider.internal.parser.ContentFileTypes.JCR_XML_SUFFIX;
+import static org.apache.sling.fsprovider.internal.parser.ContentFileTypes.XML_SUFFIX;
+
 import java.io.File;
 import java.util.Collection;
 import java.util.List;
@@ -43,8 +46,15 @@ public final class ContentFileExtensions {
     public String getSuffix(File file) {
         String fileName = "/" + file.getName();
         for (String suffix : contentFileSuffixes) {
-            if (StringUtils.endsWith(fileName, suffix)) {
-                return suffix;
+            if (StringUtils.equals(suffix, XML_SUFFIX)) {
+                if (StringUtils.endsWith(fileName, XML_SUFFIX) && !StringUtils.endsWith(fileName, JCR_XML_SUFFIX)) {
+                    return suffix;
+                }
+            }
+            else {
+                if (StringUtils.endsWith(fileName, suffix)) {
+                    return suffix;
+                }
             }
         }
         return null;
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 927b77a..e09e8ec 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
@@ -40,6 +40,7 @@ import org.apache.sling.fsprovider.internal.mapper.FileResourceMapper;
 import org.apache.sling.fsprovider.internal.mapper.FileVaultResourceMapper;
 import org.apache.sling.fsprovider.internal.parser.ContentFileCache;
 import org.apache.sling.fsprovider.internal.parser.ContentFileTypes;
+import org.apache.sling.jcr.contentparser.ContentType;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.service.component.annotations.Activate;
@@ -184,9 +185,9 @@ public final class FsResourceProvider implements ResourceProvider {
         }
         else {
             // Sling-Initial-Content: mount folder/files an content files
-            rsrc = contentFileMapper.getResource(resolver, path);
+            rsrc = fileMapper.getResource(resolver, path);
             if (rsrc == null) {
-                rsrc = fileMapper.getResource(resolver, path);
+                rsrc = contentFileMapper.getResource(resolver, path);
             }
         }
         
@@ -211,7 +212,7 @@ public final class FsResourceProvider implements ResourceProvider {
             }
         }
         else {
-            // Sling-Initial-Content: get all matchind folders/files and content files
+            // Sling-Initial-Content: get all matching folders/files and content files
             children = contentFileMapper.getChildren(resolver, parent);
             if (children != null) {
                 allChildren.add(children);
@@ -270,12 +271,15 @@ public final class FsResourceProvider implements ResourceProvider {
             }
         }
         else if (fsMode == FsMode.INITIAL_CONTENT) {
-            if (!options.getIgnoreImportProviders().contains("json")) {
+            if (!options.getIgnoreImportProviders().contains(ContentType.JSON.getExtension())) {
                 contentFileSuffixes.add(ContentFileTypes.JSON_SUFFIX);
             }
-            if (!options.getIgnoreImportProviders().contains("jcr.xml")) {
+            if (!options.getIgnoreImportProviders().contains(ContentType.JCR_XML.getExtension())) {
                 contentFileSuffixes.add(ContentFileTypes.JCR_XML_SUFFIX);
             }
+            if (!options.getIgnoreImportProviders().contains(ContentType.XML.getExtension())) {
+                contentFileSuffixes.add(ContentFileTypes.XML_SUFFIX);
+            }
         }
         ContentFileExtensions contentFileExtensions = new ContentFileExtensions(contentFileSuffixes);
         
@@ -284,7 +288,7 @@ public final class FsResourceProvider implements ResourceProvider {
             this.fileVaultMapper = new FileVaultResourceMapper(this.providerFile, filterXmlFile, this.contentFileCache);
         }
         else {
-            this.fileMapper = new FileResourceMapper(this.providerRoot, this.providerFile, contentFileExtensions);
+            this.fileMapper = new FileResourceMapper(this.providerRoot, this.providerFile, contentFileExtensions, this.contentFileCache);
             this.contentFileMapper = new ContentFileResourceMapper(this.providerRoot, this.providerFile,
                     contentFileExtensions, this.contentFileCache);
         }
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/mapper/ContentFileResourceMapper.java b/src/main/java/org/apache/sling/fsprovider/internal/mapper/ContentFileResourceMapper.java
index b44926a..20739d6 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/mapper/ContentFileResourceMapper.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/mapper/ContentFileResourceMapper.java
@@ -88,7 +88,7 @@ public final class ContentFileResourceMapper implements FsResourceMapper {
                     List<Resource> childResources = new ArrayList<>();
                     for (File file : parentFile.listFiles()) {
                         String filenameSuffix = contentFileExtensions.getSuffix(file);
-                        if (filenameSuffix != null) {
+                        if (filenameSuffix != null && !isNodeDescriptor(file)) {
                             String path = parentPath + "/" + StringUtils.substringBeforeLast(file.getName(), filenameSuffix);
                             ContentFile contentFile = new ContentFile(file, path, null, contentFileCache);
                             childResources.add(new ContentFileResource(resolver, contentFile));
@@ -144,5 +144,15 @@ public final class ContentFileResourceMapper implements FsResourceMapper {
                 + (subPath != null ? "/" + subPath : "");
         return getFile(parentPath, nextSubPath);
     }
-
+    
+    private boolean isNodeDescriptor(File file) {
+        for (String filenameSuffix : contentFileExtensions.getSuffixes()) {
+            if (StringUtils.endsWith(file.getPath(), filenameSuffix)) {
+                File fileWithoutSuffix = new File(StringUtils.substringBeforeLast(file.getPath(), filenameSuffix));
+                return fileWithoutSuffix.exists();
+            }
+        }
+        return false;
+    }
+    
 }
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResource.java b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResource.java
index ff35181..e5e4d2f 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResource.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResource.java
@@ -28,6 +28,7 @@ import java.util.Calendar;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import org.apache.sling.adapter.annotations.Adaptable;
@@ -37,7 +38,11 @@ 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.api.resource.ValueMap;
+import org.apache.sling.fsprovider.internal.ContentFileExtensions;
 import org.apache.sling.fsprovider.internal.mapper.valuemap.ValueMapDecorator;
+import org.apache.sling.fsprovider.internal.parser.ContentElement;
+import org.apache.sling.fsprovider.internal.parser.ContentFileCache;
+import org.apache.sling.jcr.contentparser.ParserOptions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,11 +77,18 @@ public final class FileResource extends AbstractResource {
     // the file wrapped by this instance
     private final File file;
 
+    // the resource metadata, assigned on demand
+    private ResourceMetadata metaData;
+
     // the resource type, assigned on demand
     private String resourceType;
+    private String resourceSuperType;
+    
+    // valuemap is build on demand
+    private ValueMap valueMap;
 
-    // the resource metadata, assigned on demand
-    private ResourceMetadata metaData;
+    private final ContentFileExtensions contentFileExtensions;
+    private final ContentFileCache contentFileCache;
 
     private static final Logger log = LoggerFactory.getLogger(FileResource.class);
     
@@ -88,9 +100,16 @@ public final class FileResource extends AbstractResource {
      * @param file The wrapped file
      */
     FileResource(ResourceResolver resolver, String resourcePath, File file) {
+        this(resolver, resourcePath, file, null, null);
+    }
+    
+    FileResource(ResourceResolver resolver, String resourcePath, File file,
+            ContentFileExtensions contentFileExtensions, ContentFileCache contentFileCache) {
         this.resolver = resolver;
         this.resourcePath = resourcePath;
         this.file = file;
+        this.contentFileExtensions = contentFileExtensions;
+        this.contentFileCache = contentFileCache;
     }
 
     /**
@@ -126,21 +145,21 @@ public final class FileResource extends AbstractResource {
         return resolver;
     }
 
-    /**
-     * Returns <code>null</code>}
-     */
     public String getResourceSuperType() {
-        return null;
+        if (resourceSuperType == null) {
+            resourceSuperType = getValueMap().get("sling:resourceSuperType", String.class);
+        }
+        return resourceSuperType;
     }
 
-    /**
-     * Returns {@link #RESOURCE_TYPE_FILE} if this resource
-     * wraps a file. Otherwise {@link #RESOURCE_TYPE_FOLDER}
-     * is returned.
-     */
     public String getResourceType() {
         if (resourceType == null) {
-            resourceType = file.isFile() ? RESOURCE_TYPE_FILE : RESOURCE_TYPE_FOLDER;
+            ValueMap props = getValueMap();
+            resourceType = props.get("sling:resourceType", String.class);
+            if (resourceType == null) {
+                // fallback to jcr:primaryType when resource type not set
+                resourceType = props.get("jcr:primaryType", String.class);
+            }
         }
         return resourceType;
     }
@@ -176,20 +195,9 @@ public final class FileResource extends AbstractResource {
             catch (MalformedURLException mue) {
                 log.info("adaptTo: Cannot convert the file path " + file + " to an URL", mue);
             }
-
         }
         else if (type == ValueMap.class) {
-            // this resource simulates nt:file/nt:folder behavior by returning it as resource type
-            // we should simulate the corresponding JCR properties in a value map as well
-            if (file.exists() && file.canRead()) {
-                Map<String,Object> props = new HashMap<String, Object>();
-                props.put("jcr:primaryType", getResourceType());
-                props.put("jcr:createdBy", "system");
-                Calendar lastModifed = Calendar.getInstance();
-                lastModifed.setTimeInMillis(file.lastModified());
-                props.put("jcr:created", lastModifed);
-                return (AdapterType) new ValueMapDecorator(props);
-            }
+            return (AdapterType) getValueMap();
         }
         return super.adaptTo(type);
     }
@@ -203,4 +211,49 @@ public final class FileResource extends AbstractResource {
                 .build();
     }
 
+    public ValueMap getValueMap() {
+        if (valueMap == null) {
+            // this resource simulates nt:file/nt:folder behavior by returning it as resource type
+            // we should simulate the corresponding JCR properties in a value map as well
+            if (file.exists() && file.canRead()) {
+                Map<String,Object> props = new HashMap<String, Object>();
+                props.put("jcr:primaryType", file.isFile() ? RESOURCE_TYPE_FILE : RESOURCE_TYPE_FOLDER);
+                props.put("jcr:createdBy", "system");
+                
+                Calendar lastModifed = Calendar.getInstance();
+                lastModifed.setTimeInMillis(file.lastModified());
+                props.put("jcr:created", lastModifed);
+                
+                // overlay properties with those from node descriptor content file, if it exists
+                ContentElement content = getNodeDescriptorContent();
+                if (content != null) {
+                    for (Map.Entry<String, Object> entry : content.getProperties().entrySet()) {
+                        // skip primary type if it is the default type assigned by contentparser when none is defined
+                        if (StringUtils.equals(entry.getKey(), "jcr:primaryType")
+                                && StringUtils.equals((String)entry.getValue(), ParserOptions.DEFAULT_PRIMARY_TYPE)) {
+                            continue;
+                        }
+                        props.put(entry.getKey(), entry.getValue());
+                    }
+                }
+                
+                valueMap = new ValueMapDecorator(props);
+            }
+        }
+        return valueMap;
+    }
+    
+    private ContentElement getNodeDescriptorContent() {
+        if (contentFileExtensions == null || contentFileCache == null) {
+            return null;
+        }
+        for (String fileNameSuffix : contentFileExtensions.getSuffixes()) {
+            File fileWithSuffix = new File(file.getPath() + fileNameSuffix);
+            if (fileWithSuffix.exists() && fileWithSuffix.canRead()) {
+                return contentFileCache.get(resourcePath, fileWithSuffix);
+            }
+        }
+        return null;
+    }
+    
 }
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResourceMapper.java b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResourceMapper.java
index 12b0f7a..ec9b650 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResourceMapper.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResourceMapper.java
@@ -29,6 +29,7 @@ import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.fsprovider.internal.ContentFileExtensions;
 import org.apache.sling.fsprovider.internal.FsResourceMapper;
+import org.apache.sling.fsprovider.internal.parser.ContentFileCache;
 
 public final class FileResourceMapper implements FsResourceMapper {
 
@@ -42,19 +43,22 @@ public final class FileResourceMapper implements FsResourceMapper {
     private final File providerFile;
     
     private final ContentFileExtensions contentFileExtensions;
+    private final ContentFileCache contentFileCache;
     
-    public FileResourceMapper(String providerRoot, File providerFile, ContentFileExtensions contentFileExtensions) {
+    public FileResourceMapper(String providerRoot, File providerFile,
+            ContentFileExtensions contentFileExtensions, ContentFileCache contentFileCache) {
         this.providerRoot = providerRoot;
         this.providerRootPrefix = providerRoot.concat("/");
         this.providerFile = providerFile;
         this.contentFileExtensions = contentFileExtensions;
+        this.contentFileCache = contentFileCache;
     }
     
     @Override
     public Resource getResource(final ResourceResolver resolver, final String resourcePath) {
         File file = getFile(resourcePath);
         if (file != null) {
-            return new FileResource(resolver, resourcePath, file);
+            return new FileResource(resolver, resourcePath, file, contentFileExtensions, contentFileCache);
         }
         else {
             return null;
@@ -84,7 +88,7 @@ public final class FileResourceMapper implements FsResourceMapper {
                     if (providerRoot.startsWith(parentPathPrefix)) {
                         String relPath = providerRoot.substring(parentPathPrefix.length());
                         if (relPath.indexOf('/') < 0) {
-                            Resource res = new FileResource(resolver, providerRoot, providerFile);
+                            Resource res = new FileResource(resolver, providerRoot, providerFile, contentFileExtensions, contentFileCache);
                             return IteratorUtils.singletonIterator(res);
                         }
                     }
@@ -115,7 +119,7 @@ public final class FileResourceMapper implements FsResourceMapper {
             public Object transform(Object input) {
                 File file = (File)input;
                 String path = parentPath + "/" + file.getName();
-                return new FileResource(resolver, path, file);
+                return new FileResource(resolver, path, file, contentFileExtensions, contentFileCache);
             }
         });
     }
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtil.java b/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtil.java
index dbb638a..fa5ed35 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtil.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtil.java
@@ -20,6 +20,7 @@ package org.apache.sling.fsprovider.internal.parser;
 
 import static org.apache.jackrabbit.vault.util.Constants.DOT_CONTENT_XML;
 import static org.apache.sling.fsprovider.internal.parser.ContentFileTypes.JCR_XML_SUFFIX;
+import static org.apache.sling.fsprovider.internal.parser.ContentFileTypes.XML_SUFFIX;
 import static org.apache.sling.fsprovider.internal.parser.ContentFileTypes.JSON_SUFFIX;
 
 import java.io.BufferedInputStream;
@@ -54,6 +55,7 @@ class ContentFileParserUtil {
         }
     }
     private static final ContentParser JCR_XML_PARSER = ContentParserFactory.create(ContentType.JCR_XML);
+    private static final ContentParser XML_PARSER = ContentParserFactory.create(ContentType.XML);
     
     private ContentFileParserUtil() {
         // static methods only
@@ -75,6 +77,9 @@ class ContentFileParserUtil {
             else if (StringUtils.equals(file.getName(), DOT_CONTENT_XML) || StringUtils.endsWith(file.getName(), JCR_XML_SUFFIX)) {
                 return parse(JCR_XML_PARSER, file);
             }
+            else if (StringUtils.endsWith(file.getName(), XML_SUFFIX) && !StringUtils.endsWith(file.getName(), JCR_XML_SUFFIX)) {
+                return parse(XML_PARSER, file);
+            }
         }
         catch (Throwable ex) {
             log.warn("Error parsing content from " + file.getPath(), ex);
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileTypes.java b/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileTypes.java
index 8e6a9be..9cd9931 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileTypes.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileTypes.java
@@ -31,6 +31,11 @@ public final class ContentFileTypes {
     public static final String JSON_SUFFIX = "." + ContentType.JSON.getExtension();
 
     /**
+     * XML content files.
+     */
+    public static final String XML_SUFFIX = "." + ContentType.XML.getExtension();
+        
+    /**
      * JCR XML content files.
      */
     public static final String JCR_XML_SUFFIX = "." + ContentType.JCR_XML.getExtension();
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java b/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java
index c4631b6..81a3eb5 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java
@@ -260,7 +260,22 @@ public class JsonContentTest {
 
         Resource child2 = children.get(1);
         assertEquals("folder21", child2.getName());
-        assertEquals("nt:folder", ResourceUtil.getValueMap(child2).get("jcr:primaryType", String.class));
+        assertEquals("sling:OrderedFolder", ResourceUtil.getValueMap(child2).get("jcr:primaryType", String.class));
+    }
+
+    @Test
+    public void testFile21aNodeDescriptor() throws RepositoryException {
+        Resource file21a = fsroot.getChild("folder2/folder21/file21a.txt");
+        assertEquals("nt:file", file21a.getResourceType());
+        assertEquals("/my/super/type", file21a.getResourceSuperType());
+        
+        ValueMap props = ResourceUtil.getValueMap(file21a);
+        assertEquals("nt:file", props.get("jcr:primaryType", String.class));
+        assertEquals("/my/super/type", props.get("sling:resourceSuperType", String.class));
+        assertEquals("en", props.get("jcr:language", String.class));
+        assertArrayEquals(new String[] { "mix:language" }, props.get("jcr:mixinTypes", String[].class));
+
+        assertNull(fsroot.getChild("folder2/folder21/file21a.txt.xml"));
     }
 
 }
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtilTest.java b/src/test/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtilTest.java
index b775c81..0d5671c 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtilTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtilTest.java
@@ -60,4 +60,12 @@ public class ContentFileParserUtilTest {
         assertNull(content);
     }
 
+    @Test
+    public void testParseXml() {
+        File file = new File("src/test/resources/fs-test/folder2/folder21.xml");
+        ContentElement content = ContentFileParserUtil.parse(file);
+        assertNotNull(content);
+        assertEquals("sling:OrderedFolder", content.getProperties().get("jcr:primaryType"));
+    }
+
 }
diff --git a/src/test/resources/fs-test/folder2/folder21.xml b/src/test/resources/fs-test/folder2/folder21.xml
new file mode 100644
index 0000000..77ab5ff
--- /dev/null
+++ b/src/test/resources/fs-test/folder2/folder21.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node>
+  <primaryNodeType>sling:OrderedFolder</primaryNodeType>
+</node>
diff --git a/src/test/resources/fs-test/folder2/folder21/file21a.txt.xml b/src/test/resources/fs-test/folder2/folder21/file21a.txt.xml
new file mode 100644
index 0000000..4cf1495
--- /dev/null
+++ b/src/test/resources/fs-test/folder2/folder21/file21a.txt.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node>
+  <name>file21a.txt</name>
+  <mixinNodeType>mix:language</mixinNodeType>
+  <property>
+    <name>jcr:language</name>
+    <value>en</value>
+    <type>String</type>
+  </property>
+  <property>
+    <name>sling:resourceSuperType</name>
+    <value>/my/super/type</value>
+    <type>String</type>
+  </property>
+</node>

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

[sling-org-apache-sling-fsresource] 05/08: SLING-6829 make sour FileResource for directories is only overlayed in FILES_FOLDERS mode

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.4.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git

commit cb0c2b355b619a9b7b33c85a1516ac742238a0e2
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 17:05:14 2017 +0000

    SLING-6829 make sour FileResource for directories is only overlayed in FILES_FOLDERS mode
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/fsresource-1.x@1793834 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/fsprovider/internal/FsResourceProvider.java |  2 +-
 .../sling/fsprovider/internal/mapper/FileResource.java       | 12 ++++++++----
 .../sling/fsprovider/internal/mapper/FileResourceMapper.java | 11 +++++++----
 .../fsprovider/internal/mapper/FileVaultResourceMapper.java  |  5 +++--
 4 files changed, 19 insertions(+), 11 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 e09e8ec..14a7dec 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
@@ -288,7 +288,7 @@ public final class FsResourceProvider implements ResourceProvider {
             this.fileVaultMapper = new FileVaultResourceMapper(this.providerFile, filterXmlFile, this.contentFileCache);
         }
         else {
-            this.fileMapper = new FileResourceMapper(this.providerRoot, this.providerFile, contentFileExtensions, this.contentFileCache);
+            this.fileMapper = new FileResourceMapper(this.providerRoot, this.providerFile, contentFileExtensions, this.contentFileCache, this.fsMode);
             this.contentFileMapper = new ContentFileResourceMapper(this.providerRoot, this.providerFile,
                     contentFileExtensions, this.contentFileCache);
         }
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResource.java b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResource.java
index e5e4d2f..4ee4a20 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResource.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResource.java
@@ -39,6 +39,7 @@ import org.apache.sling.api.resource.ResourceMetadata;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.fsprovider.internal.ContentFileExtensions;
+import org.apache.sling.fsprovider.internal.FsMode;
 import org.apache.sling.fsprovider.internal.mapper.valuemap.ValueMapDecorator;
 import org.apache.sling.fsprovider.internal.parser.ContentElement;
 import org.apache.sling.fsprovider.internal.parser.ContentFileCache;
@@ -89,6 +90,7 @@ public final class FileResource extends AbstractResource {
 
     private final ContentFileExtensions contentFileExtensions;
     private final ContentFileCache contentFileCache;
+    private final FsMode fsMode;
 
     private static final Logger log = LoggerFactory.getLogger(FileResource.class);
     
@@ -99,17 +101,19 @@ public final class FileResource extends AbstractResource {
      * @param resourcePath The resource path in the resource tree
      * @param file The wrapped file
      */
-    FileResource(ResourceResolver resolver, String resourcePath, File file) {
-        this(resolver, resourcePath, file, null, null);
+    FileResource(ResourceResolver resolver, String resourcePath, File file, FsMode fsMode) {
+        this(resolver, resourcePath, file, null, null, fsMode);
     }
     
     FileResource(ResourceResolver resolver, String resourcePath, File file,
-            ContentFileExtensions contentFileExtensions, ContentFileCache contentFileCache) {
+            ContentFileExtensions contentFileExtensions, ContentFileCache contentFileCache,
+            FsMode fsMode) {
         this.resolver = resolver;
         this.resourcePath = resourcePath;
         this.file = file;
         this.contentFileExtensions = contentFileExtensions;
         this.contentFileCache = contentFileCache;
+        this.fsMode = fsMode;
     }
 
     /**
@@ -130,7 +134,7 @@ public final class FileResource extends AbstractResource {
             metaData.setContentLength(file.length());
             metaData.setModificationTime(file.lastModified());
             metaData.setResolutionPath(resourcePath);
-            if ( this.file.isDirectory() ) {
+            if (fsMode == FsMode.FILES_FOLDERS && this.file.isDirectory()) {
                 metaData.put(ResourceMetadata.INTERNAL_CONTINUE_RESOLVING, Boolean.TRUE);
             }
         }
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResourceMapper.java b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResourceMapper.java
index ec9b650..47404f8 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResourceMapper.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileResourceMapper.java
@@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.fsprovider.internal.ContentFileExtensions;
+import org.apache.sling.fsprovider.internal.FsMode;
 import org.apache.sling.fsprovider.internal.FsResourceMapper;
 import org.apache.sling.fsprovider.internal.parser.ContentFileCache;
 
@@ -44,21 +45,23 @@ public final class FileResourceMapper implements FsResourceMapper {
     
     private final ContentFileExtensions contentFileExtensions;
     private final ContentFileCache contentFileCache;
+    private final FsMode fsMode;
     
     public FileResourceMapper(String providerRoot, File providerFile,
-            ContentFileExtensions contentFileExtensions, ContentFileCache contentFileCache) {
+            ContentFileExtensions contentFileExtensions, ContentFileCache contentFileCache, FsMode fsMode) {
         this.providerRoot = providerRoot;
         this.providerRootPrefix = providerRoot.concat("/");
         this.providerFile = providerFile;
         this.contentFileExtensions = contentFileExtensions;
         this.contentFileCache = contentFileCache;
+        this.fsMode = fsMode;
     }
     
     @Override
     public Resource getResource(final ResourceResolver resolver, final String resourcePath) {
         File file = getFile(resourcePath);
         if (file != null) {
-            return new FileResource(resolver, resourcePath, file, contentFileExtensions, contentFileCache);
+            return new FileResource(resolver, resourcePath, file, contentFileExtensions, contentFileCache, fsMode);
         }
         else {
             return null;
@@ -88,7 +91,7 @@ public final class FileResourceMapper implements FsResourceMapper {
                     if (providerRoot.startsWith(parentPathPrefix)) {
                         String relPath = providerRoot.substring(parentPathPrefix.length());
                         if (relPath.indexOf('/') < 0) {
-                            Resource res = new FileResource(resolver, providerRoot, providerFile, contentFileExtensions, contentFileCache);
+                            Resource res = new FileResource(resolver, providerRoot, providerFile, contentFileExtensions, contentFileCache, fsMode);
                             return IteratorUtils.singletonIterator(res);
                         }
                     }
@@ -119,7 +122,7 @@ public final class FileResourceMapper implements FsResourceMapper {
             public Object transform(Object input) {
                 File file = (File)input;
                 String path = parentPath + "/" + file.getName();
-                return new FileResource(resolver, path, file, contentFileExtensions, contentFileCache);
+                return new FileResource(resolver, path, file, contentFileExtensions, contentFileCache, fsMode);
             }
         });
     }
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileVaultResourceMapper.java b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileVaultResourceMapper.java
index 14f6146..c772e40 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileVaultResourceMapper.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/mapper/FileVaultResourceMapper.java
@@ -37,6 +37,7 @@ import org.apache.jackrabbit.vault.util.PlatformNameFormat;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.fsprovider.internal.FsMode;
 import org.apache.sling.fsprovider.internal.FsResourceMapper;
 import org.apache.sling.fsprovider.internal.parser.ContentElement;
 import org.apache.sling.fsprovider.internal.parser.ContentFileCache;
@@ -68,7 +69,7 @@ public final class FileVaultResourceMapper implements FsResourceMapper {
         // direct file
         File file = getFile(resourcePath);
         if (file != null && file.isFile()) {
-            return new FileResource(resolver, resourcePath, file);
+            return new FileResource(resolver, resourcePath, file, FsMode.FILEVAULT_XML);
         }
         
         // content file
@@ -79,7 +80,7 @@ public final class FileVaultResourceMapper implements FsResourceMapper {
         
         // fallback to directory resource if folder was found but nothing else
         if (file != null && file.isDirectory()) {
-            return new FileResource(resolver, resourcePath, file);
+            return new FileResource(resolver, resourcePath, file, FsMode.FILEVAULT_XML);
         }
         
         return 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/08: [maven-release-plugin] prepare release org.apache.sling.fsresource-1.4.0

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.4.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git

commit 44986339161d83519f1a8c21933e8f2f67636ab8
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 20:19:35 2017 +0000

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

diff --git a/pom.xml b/pom.xml
index c470324..3b7998a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.fsresource</artifactId>
     <packaging>bundle</packaging>
-    <version>1.3.1-SNAPSHOT</version>
+    <version>1.4.0</version>
 
     <name>Apache Sling File System Resource Provider</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/branches/fsresource-1.x</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/branches/fsresource-1.x</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/branches/fsresource-1.x</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.4.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.4.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.fsresource-1.4.0</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] 06/08: update dependency

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.4.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git

commit e2a4f74e8648d429ca1a9b60472831bbf8441a82
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 20:16:59 2017 +0000

    update dependency
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/fsresource-1.x@1793879 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 037bb3e..c470324 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,7 +148,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.contentparser</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>1.1.0</version>
             <scope>compile</scope>
         </dependency>
         <dependency>

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

[sling-org-apache-sling-fsresource] 02/08: update sling-mock dependency

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.4.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git

commit 6313850e8bc444a61e4e835f7a9823adfb5cbab3
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Mar 30 19:31:57 2017 +0000

    update sling-mock dependency
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/fsresource-1.x@1789554 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 32f9db9..ff3e267 100644
--- a/pom.xml
+++ b/pom.xml
@@ -159,7 +159,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.sling-mock</artifactId>
-            <version>1.9.4</version>
+            <version>1.9.6</version>
             <scope>test</scope>
         </dependency>
         <dependency>

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

[sling-org-apache-sling-fsresource] 04/08: SLING-6829 make unit tests independent of resource child order

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.4.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git

commit 737a614b798c773203b465319c96d911bffde4b8
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 16:28:48 2017 +0000

    SLING-6829 make unit tests independent of resource child order
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/branches/fsresource-1.x@1793832 13f79535-47bb-0310-9956-ffa450edef68
---
 .../fsprovider/internal/JcrXmlContentTest.java     |  6 ++--
 .../sling/fsprovider/internal/JsonContentTest.java |  6 ++--
 .../internal/ResourcePathComparator.java           | 32 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/sling/fsprovider/internal/JcrXmlContentTest.java b/src/test/java/org/apache/sling/fsprovider/internal/JcrXmlContentTest.java
index 463963a..7bb6cee 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/JcrXmlContentTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/JcrXmlContentTest.java
@@ -27,6 +27,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 
+import java.util.Collections;
 import java.util.List;
 
 import javax.jcr.Node;
@@ -45,7 +46,7 @@ import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
-import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
 
 /**
  * Test access to files and folders from file system.
@@ -155,7 +156,8 @@ public class JcrXmlContentTest {
     @Test
     public void testFolder3ChildNodes() throws RepositoryException {
         Resource folder3 = fsroot.getChild("folder3");
-        List<Resource> children = ImmutableList.copyOf(folder3.listChildren());
+        List<Resource> children = Lists.newArrayList(folder3.listChildren());
+        Collections.sort(children, new ResourcePathComparator());
         
         assertEquals(2, children.size());
         Resource child1 = children.get(0);
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java b/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java
index 81a3eb5..7fb7ec8 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java
@@ -29,6 +29,7 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 import java.math.BigDecimal;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -55,8 +56,8 @@ import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
-import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
 
 /**
  * Test access to files and folders and JSON content from file system.
@@ -250,7 +251,8 @@ public class JsonContentTest {
     @Test
     public void testFolder2ChildNodes() throws RepositoryException {
         Resource folder2 = fsroot.getChild("folder2");
-        List<Resource> children = ImmutableList.copyOf(folder2.listChildren());
+        List<Resource> children = Lists.newArrayList(folder2.listChildren());
+        Collections.sort(children, new ResourcePathComparator());
         
         assertEquals(2, children.size());
         Resource child1 = children.get(0);
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/ResourcePathComparator.java b/src/test/java/org/apache/sling/fsprovider/internal/ResourcePathComparator.java
new file mode 100644
index 0000000..f1c6272
--- /dev/null
+++ b/src/test/java/org/apache/sling/fsprovider/internal/ResourcePathComparator.java
@@ -0,0 +1,32 @@
+/*
+ * 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 ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.fsprovider.internal;
+
+import java.util.Comparator;
+
+import org.apache.sling.api.resource.Resource;
+
+class ResourcePathComparator implements Comparator<Resource> {
+
+    @Override
+    public int compare(Resource o1, Resource o2) {
+        return o1.getPath().compareTo(o2.getPath());
+    }
+
+}

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

[sling-org-apache-sling-fsresource] 01/08: [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.4.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git

commit 717d5d49a8c66b1805161bb626d4c97e681f5cab
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 27 16:17:14 2017 +0000

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

diff --git a/pom.xml b/pom.xml
index b2df63c..32f9db9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
 
     <artifactId>org.apache.sling.fsresource</artifactId>
     <packaging>bundle</packaging>
-    <version>1.3.0</version>
+    <version>1.3.1-SNAPSHOT</version>
 
     <name>Apache Sling File System Resource Provider</name>
     <description>
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.3.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.3.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.fsresource-1.3.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/branches/fsresource-1.x</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/branches/fsresource-1.x</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/branches/fsresource-1.x</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] 08/08: [maven-release-plugin] copy for tag org.apache.sling.fsresource-1.4.0

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.4.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git

commit 3dca7ab88ab652d0eef399907419df6cc2191898
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu May 4 20:19:48 2017 +0000

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

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