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:57:36 UTC

[sling-org-apache-sling-pipes] annotated tag org.apache.sling.pipes-1.0.2 created (now 7884eb3)

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

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


      at 7884eb3  (tag)
 tagging 501cccb424a77cd028810fec048f2e4b2931bf38 (commit)
      by Nicolas Peltier
      on Tue Jul 11 08:48:55 2017 +0000

- Log -----------------------------------------------------------------
org.apache.sling.pipes-1.0.2
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new 7d8dd3e  SLING-5134 - new Sling Pipes module, donated by Nicolas Peltier, thanks!
     new 71f5ff4  SLING-5361 Plain string expressions shouldn't be evaluated
     new bea5e38  SLING-5362 Default output should be truncated
     new 3a36234  SLING-5433 - WritePipe should remove a property when value is evaluated as null
     new 6d828c6  SLING-5431 - PipeBinding NPE when evaluating null expression
     new dd440e9  SLING-5434 - WritePipe shoud remove properties at the very end
     new dcaabb7  SLING-5523 - filter pipe should be able to filter out resources that *have* a configured child
     new 44c3578  fix test by adding a time zone
     new 18e222e  SLING-5718 Pipes size parameter is ignored
     new 43bda66  SLING-5728 enhance filterpipe logging (patch provided by Nicolas Peltier)
     new 96b3989  SLING-5729 pipe expressions should allow regexp with {n} or {n,m} (patch provided by Nicolas Peltier)
     new 9eb8d4d  SLING-5735 Pipes XPathPipe does not log query (patch provided by Nicolas Peltier)
     new 42c9c0f  SLING-6032 - Not sling pipe
     new c21dae5  SLING-5818 - Make sling pipe writer a persistent configuration
     new e40cd79  SLING-6032 - Not sling pipe SLING-5818 - Make sling pipe writer a persistent configuration
     new bfffca2  SLING-6063 - plumber servlet doesn't persist changes anymore
     new befff31  SLING-6073 pipe writer and additionalbindings configurations added through POST break the pipe
     new 01b272e  use Sling parent 28
     new c6f5163  style
     new 5edb2dd  style
     new 2146966  move DefaultOutputWriter and PlumberServlet to package impl
     new 03ac78b  rename package impl internal
     new d5b073e  move non-extensible pipes to package internal
     new 088c4f8  typo
     new f7e399f  typo
     new 0945744  SLING-6104 : Improve handling to avoid Oak warning
     new c1911c4  SLING-6122 Sling Pipes javadoc fails
     new 4fa993e  add scm settings
     new 6e503dc  fix developerConnection in scm settings
     new 429539b  [maven-release-plugin] prepare release org.apache.sling.pipes-0.0.10
     new 4a24556  [maven-release-plugin] prepare for next development iteration
     new de06722  use Sling Parent 30
     new 0b66cbc  SLING-6799 - add support for MV expressions in write pipe
     new 5279c85  SLING-6800 switch to R6 annotations
     new d218d71  SLING-6801 change remote to local json test
     new 2bee430  SLING-6833 - Sling Pipes should explicitly set exported package versions
     new a7a479f  SLING-6538: Fix Sling Pipes size parameter
     new 3853331  SLING-6800 - switch pipes to osgi R6 annotations
     new 4c2f290  SLING-6623 allow async execution of pipes
     new 2d5d015  SLING-6860 bump jackrabbit api version
     new d558662  SLING-6899: Remove commons.json from Sling Pipes
     new d161e01  Remove testing dependency on commons.json
     new 526004f  switch back to released version
     new 366ae39  SLING-6997 remove useless resourceExpression
     new e16c19e  SLING-6770 add resource names as bindings
     new f127144  SLING-6078 sling pipes fluent API
     new cc06f5e  Fix javadoc error
     new d8e260d  [maven-release-plugin] prepare release org.apache.sling.pipes-1.0.0
     new f62a550  [maven-release-plugin] prepare for next development iteration
     new 9c20380  SLING-7002 fix PipeBuilder properties value
     new 72eb7bd  SLING-6998 use ResourceUtil for path creation
     new 6840853  [maven-release-plugin] prepare release org.apache.sling.pipes-1.0.2
     new 501cccb  [maven-release-plugin] copy for tag org.apache.sling.pipes-1.0.2

The 53 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-pipes] 04/05: [maven-release-plugin] prepare release org.apache.sling.pipes-1.0.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.pipes-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-pipes.git

commit 6840853b9833df1c076ec38213adeacfda7c6073
Author: Nicolas Peltier <np...@apache.org>
AuthorDate: Tue Jul 11 08:48:42 2017 +0000

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

diff --git a/pom.xml b/pom.xml
index 2d2f302..1154998 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
 
   <artifactId>org.apache.sling.pipes</artifactId>
   <packaging>bundle</packaging>
-  <version>1.0.1-SNAPSHOT</version>
+  <version>1.0.2</version>
 
   <name>Apache Sling Pipes</name>
   <description>bulk content changes tool</description>
@@ -40,9 +40,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/sling-pipes</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/sling-pipes</developerConnection>
-    <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes</url>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.pipes-1.0.2</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.pipes-1.0.2</developerConnection>
+    <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.pipes-1.0.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-pipes] 05/05: [maven-release-plugin] copy for tag org.apache.sling.pipes-1.0.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.pipes-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-pipes.git

commit 501cccb424a77cd028810fec048f2e4b2931bf38
Author: Nicolas Peltier <np...@apache.org>
AuthorDate: Tue Jul 11 08:48:55 2017 +0000

    [maven-release-plugin] copy for tag org.apache.sling.pipes-1.0.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.pipes-1.0.2@1801575 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-pipes] 01/05: [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.pipes-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-pipes.git

commit f62a550404559646a067a238f4c70db6dc465f29
Author: Nicolas Peltier <np...@apache.org>
AuthorDate: Fri Jul 7 10:32:21 2017 +0000

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

diff --git a/pom.xml b/pom.xml
index c5e1a0f..2d2f302 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
 
   <artifactId>org.apache.sling.pipes</artifactId>
   <packaging>bundle</packaging>
-  <version>1.0.0</version>
+  <version>1.0.1-SNAPSHOT</version>
 
   <name>Apache Sling Pipes</name>
   <description>bulk content changes tool</description>
@@ -40,9 +40,9 @@
   </properties>
 
   <scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.pipes-1.0.0</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.pipes-1.0.0</developerConnection>
-    <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.pipes-1.0.0</url>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/sling-pipes</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/sling-pipes</developerConnection>
+    <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes</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-pipes] 02/05: SLING-7002 fix PipeBuilder properties value

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

commit 9c203807b6b66887c46d8a367e0cda920d4e63bf
Author: Nicolas Peltier <np...@apache.org>
AuthorDate: Mon Jul 10 17:39:14 2017 +0000

    SLING-7002 fix PipeBuilder properties value
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/sling-pipes@1801506 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/pipes/PipeBuilder.java              | 2 +-
 src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/pipes/PipeBuilder.java b/src/main/java/org/apache/sling/pipes/PipeBuilder.java
index f5aaab9..c8a1b64 100644
--- a/src/main/java/org/apache/sling/pipes/PipeBuilder.java
+++ b/src/main/java/org/apache/sling/pipes/PipeBuilder.java
@@ -121,7 +121,7 @@ public interface PipeBuilder {
      * @return updated instance of PipeBuilder
      * @throws IllegalAccessException in case it's called in a bad time
      */
-    PipeBuilder with(String param, String value) throws IllegalAccessException;
+    PipeBuilder with(String param, Object value) throws IllegalAccessException;
 
     /**
      * set an expr configuration to the current pipe in the context
diff --git a/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java b/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java
index 09e8321..d2ac050 100644
--- a/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java
+++ b/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java
@@ -138,7 +138,7 @@ public class PipeBuilderImpl implements PipeBuilder {
     }
 
     @Override
-    public PipeBuilder with(String param, String value) throws IllegalAccessException {
+    public PipeBuilder with(String param, Object value) throws IllegalAccessException {
         checkCurrentStep();
         currentStep.properties.put(param, value);
         return this;

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

[sling-org-apache-sling-pipes] 03/05: SLING-6998 use ResourceUtil for path creation

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

commit 72eb7bdb94470306a905d1d5f2b380f2e5e86e40
Author: Nicolas Peltier <np...@apache.org>
AuthorDate: Tue Jul 11 08:24:55 2017 +0000

    SLING-6998 use ResourceUtil for path creation
    
    also added some unit tests for PathPipe
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/sling-pipes@1801566 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/pipes/internal/PathPipe.java  | 72 ++++++++--------------
 .../apache/sling/pipes/internal/PathPipeTest.java  | 57 +++++++++++++++++
 2 files changed, 82 insertions(+), 47 deletions(-)

diff --git a/src/main/java/org/apache/sling/pipes/internal/PathPipe.java b/src/main/java/org/apache/sling/pipes/internal/PathPipe.java
index e9f7d49..02c68f9 100644
--- a/src/main/java/org/apache/sling/pipes/internal/PathPipe.java
+++ b/src/main/java/org/apache/sling/pipes/internal/PathPipe.java
@@ -18,83 +18,61 @@ package org.apache.sling.pipes.internal;
 
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.StringTokenizer;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
 
+import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.pipes.BasePipe;
 import org.apache.sling.pipes.Plumber;
+import org.apache.sling.query.util.IteratorUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.sling.jcr.resource.JcrResourceConstants.NT_SLING_FOLDER;
+
 /**
  * creates or get given expression's path and returns corresponding resource
+ * this pipe can be configured with the following properties:
+ * <ul>
+ *     <li><code>nodeType</code> resource type with which the leaf node of the created path will be created</li>
+ *     <li><code>intermediateType</code> resource type with which intermediate nodse of the created path will be created</li>
+ *     <li><code>autosave</code> flag indicating wether this pipe should triggers a commit at the end of the execution</li>
+ * </ul>
  */
 public class PathPipe extends BasePipe {
 
     public static final String RESOURCE_TYPE = RT_PREFIX + "path";
-    public static final String PN_NODETYPE = "nodeType";
+    public static final String PN_RESOURCETYPE = "nodeType";
+    public static final String PN_INTERMEDIATE = "intermediateType";
     public static final String PN_AUTOSAVE = "autosave";
+    public static final String SLASH = "/";
 
-    String nodeType;
-
+    String resourceType;
+    String intermediateType;
     boolean autosave;
 
     private final Logger logger = LoggerFactory.getLogger(PathPipe.class);
 
     public PathPipe(Plumber plumber, Resource resource) throws Exception {
         super(plumber, resource);
-        nodeType = properties.get(PN_NODETYPE, "sling:Folder");
+        resourceType = properties.get(PN_RESOURCETYPE, NT_SLING_FOLDER);
+        intermediateType = properties.get(PN_INTERMEDIATE, NT_SLING_FOLDER);
         autosave = properties.get(PN_AUTOSAVE, true);
     }
 
     @Override
+    public boolean modifiesContent() {
+        return true;
+    }
+
+    @Override
     public Iterator<Resource> getOutput() {
         Iterator<Resource> output = Collections.emptyIterator();
         String expression = getExpr();
-        Node leaf = null;
-        boolean transientChange = false;
         try {
-            String relativePath = expression.substring(1);
-            Node parentNode = resolver.adaptTo(Session.class).getRootNode();
-            if (!parentNode.hasNode(relativePath)) {
-                Node node = parentNode;
-                int pos = relativePath.lastIndexOf('/');
-                if (pos != -1) {
-                    final StringTokenizer st = new StringTokenizer(relativePath.substring(0, pos), "/");
-                    while (st.hasMoreTokens()) {
-                        final String token = st.nextToken();
-                        if (!node.hasNode(token)) {
-                            try {
-                                node.addNode(token, nodeType);
-                                transientChange = true;
-                            } catch (RepositoryException re) {
-                                // we ignore this as this folder might be created from a different task
-                                node.getSession().refresh(false);
-                            }
-                        }
-                        node = node.getNode(token);
-                    }
-                    relativePath = relativePath.substring(pos + 1);
-                }
-                if (!node.hasNode(relativePath)) {
-                    node.addNode(relativePath, nodeType);
-                    transientChange = true;
-                }
-                leaf = node.getNode(relativePath);
-            }
-            if (leaf == null) {
-                leaf = parentNode.getNode(relativePath);
-            }
-            if (transientChange && autosave){
-                resolver.adaptTo(Session.class).save();
-            }
-            output =  Collections.singleton(resolver.getResource(leaf.getPath())).iterator();
-        } catch (RepositoryException e){
+            String path = expression.startsWith(SLASH) ? expression : getInput().getPath() + SLASH + expression;
+            output = IteratorUtils.singleElementIterator(ResourceUtil.getOrCreateResource(resolver, path, resourceType, intermediateType, autosave));
+        } catch (PersistenceException e){
             logger.error ("Not able to create path {}", expression, e);
         }
         return output;
diff --git a/src/test/java/org/apache/sling/pipes/internal/PathPipeTest.java b/src/test/java/org/apache/sling/pipes/internal/PathPipeTest.java
new file mode 100644
index 0000000..daadfb5
--- /dev/null
+++ b/src/test/java/org/apache/sling/pipes/internal/PathPipeTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.pipes.internal;
+
+import org.apache.sling.api.resource.PersistenceException;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.pipes.AbstractPipeTest;
+import org.apache.sling.pipes.Pipe;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Testing path pipe using pipe builder
+ */
+public class PathPipeTest extends AbstractPipeTest {
+
+    private static final String WATERMELON = "watermelon";
+    private static final String WATERMELON_FULL_PATH = PATH_FRUITS + "/" + WATERMELON;
+
+    @Test
+    public void modifiesContent() throws IllegalAccessException, PersistenceException {
+        Pipe pipe = plumber.getBuilder(context.resourceResolver())
+                .mkdir(PATH_FRUITS + "/whatever")
+                .build();
+        assertTrue("path pipe should be considered as modifying the content", pipe.modifiesContent());
+    }
+
+    @Test
+    public void getClassicOutput() throws Exception {
+        ResourceResolver resolver = context.resourceResolver();
+        plumber.getBuilder(resolver).mkdir(WATERMELON_FULL_PATH).run();
+        resolver.revert();
+        assertNotNull("Resource should be here & saved", resolver.getResource(WATERMELON_FULL_PATH));
+    }
+
+    @Test
+    public void getRelativePath() throws Exception {
+        ResourceResolver resolver = context.resourceResolver();
+        plumber.getBuilder(resolver).echo(PATH_FRUITS).mkdir(WATERMELON).run();
+        assertNotNull("Resource should be    here & saved", resolver.getResource(WATERMELON_FULL_PATH));
+    }
+}
\ No newline at end of file

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