This is an automated email from the ASF dual-hosted git repository. npeltier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-pipes.git
commit 3ce5caa8302616036874f01267f690682a02d4b1 Author: npeltier <npelt...@adobe.com> AuthorDate: Fri Oct 20 17:57:58 2017 +0200 SLING-7172 move $ to children pipe --- README.md | 18 +++++++++--------- src/main/java/org/apache/sling/pipes/PipeBuilder.java | 4 ++-- .../{SlingQueryPipe.java => ChildrenPipe.java} | 10 +++++----- .../apache/sling/pipes/internal/PipeBuilderImpl.java | 4 ++-- .../org/apache/sling/pipes/internal/PlumberImpl.java | 2 +- .../apache/sling/pipes/internal/PlumberServlet.java | 2 +- src/main/java/org/apache/sling/pipes/package-info.java | 2 +- .../java/org/apache/sling/pipes/PipeBuilderTest.java | 6 +++--- .../{SlingQueryPipeTest.java => ChildrenPipeTest.java} | 4 ++-- .../SLING-INF/jcr_root/etc/pipes-it/fruit-list.json | 2 +- src/test/resources/{slingQuery.json => children.json} | 2 +- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 2105803..badffb4 100644 --- a/README.md +++ b/README.md @@ -47,10 +47,10 @@ a pipe configuration is a jcr node, with: rather dummy pipe, outputs what is in input (so what is configured in path). Handy for doing some test mostly, and giving basic functionalities to others that inherit from it * `sling:resourceType` is `slingPipes/base` -#### SlingQuery Pipe +#### children Pipe executes $(getInput()).children(expression) -* `sling:resourceType` is `slingPipes/slingQuery` -* `expr` mandatory property, contains slingQuery expression through which getInput()'s children will be computed to getOutput() +* `sling:resourceType` is `slingPipes/children` +* `expr` mandatory property, contains children expression through which getInput()'s children will be computed to getOutput() #### JsonPipe feeds bindings with remote json @@ -110,7 +110,7 @@ execute the pipe referenced in path property #### Write Pipe writes given properties to current input -* `sling:resourceType` is `slingPipes/slingQuery` +* `sling:resourceType` is `slingPipes/children` * `conf` node tree that will be copied to the current input of the pipe, each node's properties names and value will be written to the input resource. Input resource will be outputed. @@ -201,7 +201,7 @@ if parameter dryRun is set to true, and the executed pipe is supposed to modify ## sample configurations -### slingQuery | write +### children | write this pipe parse all profile nodes, and ``` { @@ -210,7 +210,7 @@ this pipe parse all profile nodes, and "jcr:description":"prefix all full names of profile with "Mr" or "Ms" depending on gender", "conf":{ "profile": { - "sling:resourceType":"slingPipes/slingQuery", + "sling:resourceType":"slingPipes/children", "expr":"nt:unstructured#profile", "path":"/home/users" }, @@ -225,7 +225,7 @@ this pipe parse all profile nodes, and } ``` -### slingQuery | multiProperty | authorizable | write +### children | multiProperty | authorizable | write ``` { "jcr:primaryType": "sling:Folder", @@ -239,7 +239,7 @@ this pipe parse all profile nodes, and "jcr:description": "outputs all badge component resources", "expr": "[sling:resourceType=myApp/components/badge]", "path": "/etc/badges/badges-admin/jcr:content", - "sling:resourceType": "slingPipes/slingQuery" + "sling:resourceType": "slingPipes/children" }, "profile": { "jcr:primaryType": "sling:Folder", @@ -343,5 +343,5 @@ some other samples are in https://github.com/npeltier/sling-pipes/tree/master/sr # Compatibility For running this tool on a sling instance you need: - java 8 (Nashorn is used for expression) -- slingQuery (3.0.0) (used in SlingQueryPipe) +- children (3.0.0) (used in childrenPipe) - jackrabbit api (2.7.5+) (used in AuthorizablePipe) diff --git a/src/main/java/org/apache/sling/pipes/PipeBuilder.java b/src/main/java/org/apache/sling/pipes/PipeBuilder.java index 17089a3..2082f23 100644 --- a/src/main/java/org/apache/sling/pipes/PipeBuilder.java +++ b/src/main/java/org/apache/sling/pipes/PipeBuilder.java @@ -74,11 +74,11 @@ public interface PipeBuilder { PipeBuilder xpath(String expr); /** - * attach a sling query pipe to the current context + * attach a sling query children pipe to the current context * @param expr sling query expression * @return updated instance of PipeBuilder */ - PipeBuilder $(String expr); + PipeBuilder children(String expr); /** * attach a rm pipe to the current context diff --git a/src/main/java/org/apache/sling/pipes/internal/SlingQueryPipe.java b/src/main/java/org/apache/sling/pipes/internal/ChildrenPipe.java similarity index 81% rename from src/main/java/org/apache/sling/pipes/internal/SlingQueryPipe.java rename to src/main/java/org/apache/sling/pipes/internal/ChildrenPipe.java index 7e64acc..02916b6 100644 --- a/src/main/java/org/apache/sling/pipes/internal/SlingQueryPipe.java +++ b/src/main/java/org/apache/sling/pipes/internal/ChildrenPipe.java @@ -31,12 +31,12 @@ import org.slf4j.LoggerFactory; * this pipe uses SlingQuery to filters children (filter defined in expr property) of * a resource (defined in the path property) */ -public class SlingQueryPipe extends BasePipe { - private static Logger logger = LoggerFactory.getLogger(SlingQueryPipe.class); +public class ChildrenPipe extends BasePipe { + private static Logger logger = LoggerFactory.getLogger(ChildrenPipe.class); - public final static String RESOURCE_TYPE = RT_PREFIX + "slingQuery"; + public final static String RESOURCE_TYPE = RT_PREFIX + "children"; - public SlingQueryPipe(Plumber plumber, Resource resource) throws Exception { + public ChildrenPipe(Plumber plumber, Resource resource) throws Exception { super(plumber, resource); } @@ -50,7 +50,7 @@ public class SlingQueryPipe extends BasePipe { if (resource != null) { String queryExpression = getExpr(); SlingQuery query = $(resource).children(getExpr()); - logger.info("[sling query]: executing $({}).children({})", resource.getPath(), queryExpression); + logger.info("[sling query][children]: executing $({}).children({})", resource.getPath(), queryExpression); return query.iterator(); } return EMPTY_ITERATOR; 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 203fc71..15e70f2 100644 --- a/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java +++ b/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java @@ -116,8 +116,8 @@ public class PipeBuilderImpl implements PipeBuilder { } @Override - public PipeBuilder $(String expr) { - return pipeWithExpr(SlingQueryPipe.RESOURCE_TYPE, expr); + public PipeBuilder children(String expr) { + return pipeWithExpr(ChildrenPipe.RESOURCE_TYPE, expr); } @Override diff --git a/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java b/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java index 41f332a..c6002fc 100644 --- a/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java +++ b/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java @@ -105,7 +105,7 @@ public class PlumberImpl implements Plumber, JobConsumer { registry = new HashMap<>(); registerPipe(BasePipe.RESOURCE_TYPE, BasePipe.class); registerPipe(ContainerPipe.RESOURCE_TYPE, ContainerPipe.class); - registerPipe(SlingQueryPipe.RESOURCE_TYPE, SlingQueryPipe.class); + registerPipe(ChildrenPipe.RESOURCE_TYPE, ChildrenPipe.class); registerPipe(WritePipe.RESOURCE_TYPE, WritePipe.class); registerPipe(JsonPipe.RESOURCE_TYPE, JsonPipe.class); registerPipe(MultiPropertyPipe.RESOURCE_TYPE, MultiPropertyPipe.class); diff --git a/src/main/java/org/apache/sling/pipes/internal/PlumberServlet.java b/src/main/java/org/apache/sling/pipes/internal/PlumberServlet.java index 6f3ce97..7449d71 100644 --- a/src/main/java/org/apache/sling/pipes/internal/PlumberServlet.java +++ b/src/main/java/org/apache/sling/pipes/internal/PlumberServlet.java @@ -52,7 +52,7 @@ import org.slf4j.LoggerFactory; ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES + "=" + ContainerPipe.RESOURCE_TYPE, ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES + "=" + AuthorizablePipe.RESOURCE_TYPE, ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES + "=" + WritePipe.RESOURCE_TYPE, - ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES + "=" + SlingQueryPipe.RESOURCE_TYPE, + ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES + "=" + ChildrenPipe.RESOURCE_TYPE, ServletResolverConstants.SLING_SERVLET_METHODS + "=GET", ServletResolverConstants.SLING_SERVLET_METHODS + "=POST", ServletResolverConstants.SLING_SERVLET_EXTENSIONS + "=json" diff --git a/src/main/java/org/apache/sling/pipes/package-info.java b/src/main/java/org/apache/sling/pipes/package-info.java index 1e7ff20..18f6230 100644 --- a/src/main/java/org/apache/sling/pipes/package-info.java +++ b/src/main/java/org/apache/sling/pipes/package-info.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@Version("1.2.0") +@Version("2.0.0") package org.apache.sling.pipes; import org.osgi.annotation.versioning.Version; diff --git a/src/test/java/org/apache/sling/pipes/PipeBuilderTest.java b/src/test/java/org/apache/sling/pipes/PipeBuilderTest.java index 449920a..c3f52b8 100644 --- a/src/test/java/org/apache/sling/pipes/PipeBuilderTest.java +++ b/src/test/java/org/apache/sling/pipes/PipeBuilderTest.java @@ -67,10 +67,10 @@ public class PipeBuilderTest extends AbstractPipeTest { PipeBuilder defaultNames = plumber.newPipe(context.resourceResolver()); Set<String> paths = defaultNames .echo(PATH_FRUITS) - .$("nt:unstructured") + .children("nt:unstructured") .grep("slingPipesFilter_test","${two.worm}") - .$("nt:unstructured#isnota") - .$("nt:unstructured").name("thing") + .children("nt:unstructured#isnota") + .children("nt:unstructured").name("thing") .write("jcr:path", "${path.thing}").run(); assertEquals("There should be only one resource", 2, paths.size()); String pea = "/content/fruits/apple/isnota/pea"; diff --git a/src/test/java/org/apache/sling/pipes/internal/SlingQueryPipeTest.java b/src/test/java/org/apache/sling/pipes/internal/ChildrenPipeTest.java similarity index 92% rename from src/test/java/org/apache/sling/pipes/internal/SlingQueryPipeTest.java rename to src/test/java/org/apache/sling/pipes/internal/ChildrenPipeTest.java index 1a944a2..c0be002 100644 --- a/src/test/java/org/apache/sling/pipes/internal/SlingQueryPipeTest.java +++ b/src/test/java/org/apache/sling/pipes/internal/ChildrenPipeTest.java @@ -26,13 +26,13 @@ import org.junit.Test; /** * test the sling query pipe */ -public class SlingQueryPipeTest extends AbstractPipeTest { +public class ChildrenPipeTest extends AbstractPipeTest { @Before public void setup() throws PersistenceException { super.setup(); context.load().json("/users.json", "/content/users"); - context.load().json("/slingQuery.json", PATH_PIPE); + context.load().json("/children.json", PATH_PIPE); } @Test diff --git a/src/test/resources/SLING-INF/jcr_root/etc/pipes-it/fruit-list.json b/src/test/resources/SLING-INF/jcr_root/etc/pipes-it/fruit-list.json index d56fe4a..9cc6c9a 100644 --- a/src/test/resources/SLING-INF/jcr_root/etc/pipes-it/fruit-list.json +++ b/src/test/resources/SLING-INF/jcr_root/etc/pipes-it/fruit-list.json @@ -1,7 +1,7 @@ { "jcr:primaryType":"nt:unstructured", "jcr:description":"returns fruit list under /content/fruits", - "sling:resourceType":"slingPipes/slingQuery", + "sling:resourceType":"slingPipes/children", "name":"fruits", "path":"${currentResource.fruitsRootPath}", "expr":"nt:base" diff --git a/src/test/resources/slingQuery.json b/src/test/resources/children.json similarity index 75% rename from src/test/resources/slingQuery.json rename to src/test/resources/children.json index 786beb7..8193a09 100644 --- a/src/test/resources/slingQuery.json +++ b/src/test/resources/children.json @@ -2,7 +2,7 @@ "jcr:primaryType":"nt:unstructured", "simple": { "jcr:primaryType":"nt:unstructured", - "sling:resourceType":"slingPipes/slingQuery", + "sling:resourceType":"slingPipes/children", "path":"/content/users", "expr":"[type=user]" } -- To stop receiving notification emails like this one, please contact "commits@sling.apache.org" <commits@sling.apache.org>.