sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r975485 - in /websites/staging/sling/trunk/content: ./ documentation/bundles.html documentation/bundles/sling-pipes.html
Date Mon, 14 Dec 2015 10:09:22 GMT
Author: buildbot
Date: Mon Dec 14 10:09:22 2015
New Revision: 975485

Log:
Staging update by buildbot for sling

Added:
    websites/staging/sling/trunk/content/documentation/bundles/sling-pipes.html
Modified:
    websites/staging/sling/trunk/content/   (props changed)
    websites/staging/sling/trunk/content/documentation/bundles.html

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Dec 14 10:09:22 2015
@@ -1 +1 @@
-1719415
+1719873

Modified: websites/staging/sling/trunk/content/documentation/bundles.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles.html (original)
+++ websites/staging/sling/trunk/content/documentation/bundles.html Mon Dec 14 10:09:22 2015
@@ -155,6 +155,7 @@ h2:hover > .headerlink, h3:hover > .head
 <li><a href="/documentation/pax-exam-utils.html">Sling Pax Exam Utilities</a></li>
 <li><a href="/documentation/bundles/sling-query.html">Sling Query Library</a></li>
 <li><a href="/documentation/bundles/org-apache-sling-junit-bundles.html">Junit Server-Side Tests Support</a></li>
+<li><a href="/documentation/bundles/sling-pipes.html">Sling Pipes</a></li>
 </ul>
 <h2 id="content-presentation">Content Presentation<a class="headerlink" href="#content-presentation" title="Permanent link">&para;</a></h2>
 <ul>
@@ -178,7 +179,7 @@ h2:hover > .headerlink, h3:hover > .head
 <li><a href="/documentation/bundles/log-tracers.html">Log Tracer</a></li>
 </ul>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1704493 by bdelacretaz on Tue, 22 Sep 2015 09:40:41 +0000
+        Rev. 1719873 by rombert on Mon, 14 Dec 2015 10:09:03 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project

Added: websites/staging/sling/trunk/content/documentation/bundles/sling-pipes.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles/sling-pipes.html (added)
+++ websites/staging/sling/trunk/content/documentation/bundles/sling-pipes.html Mon Dec 14 10:09:22 2015
@@ -0,0 +1,467 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!--
+
+    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.
+-->
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>Apache Sling - Sling Pipes</title>
+    <link rel="icon" href="/res/favicon.ico">
+    <link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
+    <link rel="stylesheet" href="/res/codehilite.css" type="text/css" media="all">
+  </head>
+  <body>
+    <div class="title">
+      <div class="logo">
+        <a href="//sling.apache.org/">
+          <img border="0" alt="Apache Sling" src="/res/logo.png">
+        </a>
+      </div>
+      <div class="header">
+        <a href="//www.apache.org/">
+          <img border="0" alt="Apache" src="/res/apache.png">
+        </a>
+      </div>
+    </div>
+    
+    <div class="menu"> 
+      <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<p><strong><a href="/documentation.html">Documentation</a></strong> <br />
+<a href="/documentation/getting-started.html">Getting Started</a> <br />
+<a href="/documentation/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/documentation/development.html">Development</a> <br />
+<a href="/documentation/bundles.html">Bundles</a> <br />
+<a href="/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/documentation/configuration.html">Configuration</a>   </p>
+<p><a href="http://s.apache.org/sling.wiki">Wiki</a> <br />
+<a href="http://s.apache.org/sling.faq">FAQ</a>   </p>
+<p><strong>API Docs</strong>  <br />
+<a href="/apidocs/sling8/index.html">Sling 8</a> <br />
+<a href="/apidocs/sling7/index.html">Sling 7</a> <br />
+<a href="/apidocs/sling6/index.html">Sling 6</a> <br />
+<a href="/apidocs/sling5/index.html">Sling 5</a> <br />
+<a href="/javadoc-io.html">Archive at javadoc.io</a>   </p>
+<p><strong>Project info</strong> <br />
+<a href="/downloads.cgi">Downloads</a> <br />
+<a href="http://www.apache.org/licenses/">License</a> <br />
+<a href="/contributing.html">Contributing</a> <br />
+<a href="/news.html">News</a> <br />
+<a href="/links.html">Links</a> <br />
+<a href="/project-information.html">Project Information</a> <br />
+<a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a> <br />
+<a href="http://ci.apache.org/builders/sling-trunk">Build Server</a> <br />
+<a href="/project-information/security.html">Security</a>   </p>
+<p><strong>Source</strong> <br />
+<a href="http://svn.apache.org/viewvc/sling/trunk">Subversion</a> <br />
+<a href="git://git.apache.org/sling.git">Git</a> <br />
+<a href="https://github.com/apache/sling">Github Mirror</a>   </p>
+<p><strong>Sponsorship</strong> <br />
+<a href="http://www.apache.org/foundation/thanks.html">Thanks</a> <br />
+<a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a> <br />
+<a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a>   </p>
+<p><strong><a href="/sitemap.html">Site Map</a></strong></p>
+<!-- no valid ads for now, we'll  reactivate this when needed
+<iframe 
+    src="http://www.apache.org/ads/button.html"
+    style="border-width:0; float: left" frameborder="0" 
+    scrolling="no"
+    width="135" 
+    height="135">
+</iframe>
+-->
+    </div>
+    
+    <div class="main">
+      <div class="breadcrump" style="font-size: 80%;">
+        <a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/documentation.html">Documentation</a>&nbsp;&raquo&nbsp;<a href="/documentation/bundles.html">Bundles</a>
+      </div>
+
+      
+      
+      <h1>Sling Pipes</h1>
+      <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<p>tool for doing extract - transform - load operations through a resource tree configuration.</p>
+<p>often one-shot data transformations need sample code to be written &amp; executed. This tiny tool set intends to provide ability to do such transformations with proven &amp; reusable blocks called pipes, streaming resources from one to the other.</p>
+<h2 id="what-is-a-pipe">What is a pipe<a class="headerlink" href="#what-is-a-pipe" title="Permanent link">&para;</a></h2>
+<div class="codehilite"><pre>         <span class="n">getOutputBinding</span>
+               ^
+               <span class="o">|</span>
+ <span class="n">getInput</span>  <span class="o">+---+---+</span>   <span class="n">getOutput</span>
+           <span class="o">|</span>       <span class="o">|</span>
+      <span class="o">+----&gt;</span> <span class="n">Pipe</span>  <span class="o">+----&gt;</span>
+           <span class="o">|</span>       <span class="o">|</span>
+           <span class="o">+-------+</span>
+</pre></div>
+
+
+<p>A sling pipe is essentially a sling resource stream:</p>
+<ul>
+<li>it provides an output as a sling resource iterator</li>
+<li>it gets its input either from a configured path, either, if its chained (see container pipes below), from another pipe's output</li>
+<li>each pipe can have additional dynamic inputs using other's bindings, and outputing its own bindings</li>
+</ul>
+<p>At this moment, there are 3 types of pipes to consider:</p>
+<ul>
+<li>"reader" pipes, that will just output a set of resource depending on the input</li>
+<li>"writer" pipes, that write to the repository, depending on configuration and output</li>
+<li>"container" pipes, that contains pipes, and whose job is to chain their execution : input is the input of their first pipe,
+ output is the output of the last pipe it contains.</li>
+</ul>
+<p>A <code>Plumber</code> osgi service is provided to help getting &amp; executing pipes.</p>
+<h2 id="registered-pipes">Registered Pipes<a class="headerlink" href="#registered-pipes" title="Permanent link">&para;</a></h2>
+<p>a pipe configuration is a jcr node, with:</p>
+<ul>
+<li><code>sling:resourceType</code> property, which must be a pipe type registered by the plumber </li>
+<li><code>name</code> property, that will be used in bindings as an id, and will be the key for the output bindings (default value being a value map of the current output resource). Note that the node name will be used in case no name is provided.</li>
+<li><code>path</code> property, defines pipe's input. Note that property is not mandatory in case the pipe is streamed after another pipe, in which case previous pipe output's can be used as input.</li>
+<li><code>expr</code> property, expression through which the pipe will execute (depending on the type)</li>
+<li><code>additionalBinding</code> is a node you can add to set "global" bindings (property=value) in pipe execution</li>
+<li><code>additionalScripts</code> is a multi value property to declare scripts that can be reused in expressions</li>
+<li><code>conf</code> optional child node that contains addition configuration of the pipe (depending on the type)</li>
+</ul>
+<h3 id="readers">readers<a class="headerlink" href="#readers" title="Permanent link">&para;</a></h3>
+<h4 id="base-pipe">Base pipe<a class="headerlink" href="#base-pipe" title="Permanent link">&para;</a></h4>
+<p>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</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/base</code></li>
+</ul>
+<h4 id="slingquery-pipe">SlingQuery Pipe<a class="headerlink" href="#slingquery-pipe" title="Permanent link">&para;</a></h4>
+<p>executes $(getInput()).children(expression)</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/slingQuery</code></li>
+<li><code>expr</code> mandatory property, contains slingQuery expression through which getInput()'s children will be computed to getOutput()</li>
+</ul>
+<h4 id="jsonpipe">JsonPipe<a class="headerlink" href="#jsonpipe" title="Permanent link">&para;</a></h4>
+<p>feeds bindings with remote json</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/json</code></li>
+<li><code>expr</code> mandatory property contains url that will be called, the json be sent to the output bindings, getOutput = getInput.
+An empty url or a failing url will block the pipe at that given place.</li>
+</ul>
+<h4 id="multipropertypipe">MultiPropertyPipe<a class="headerlink" href="#multipropertypipe" title="Permanent link">&para;</a></h4>
+<p>iterates through values of input multi value property and write them to bindings</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/multiProperty</code></li>
+<li><code>path</code> should be the path of a mv property</li>
+</ul>
+<h4 id="xpathpipe">XPathPipe<a class="headerlink" href="#xpathpipe" title="Permanent link">&para;</a></h4>
+<p>retrieve resources resulting of an xpath query</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/xpath</code></li>
+<li><code>expr</code> should be a valid xpath query</li>
+</ul>
+<h3 id="jsonpipe_1">JsonPipe<a class="headerlink" href="#jsonpipe_1" title="Permanent link">&para;</a></h3>
+<p>feeds bindings with remote json</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/json</code></li>
+<li><code>expr</code> mandatory property contains url that will be called, the json be sent to the output bindings, getOutput = getInput.
+An empty url or a failing url will block the pipe at that given place.</li>
+</ul>
+<h4 id="authorizablepipe">AuthorizablePipe<a class="headerlink" href="#authorizablepipe" title="Permanent link">&para;</a></h4>
+<p>retrieve authorizable resource corresponding to the id passed in expression, or if not found (or void expression),
+from the input path, output the found authorizable's resource</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/authorizable</code></li>
+<li><code>expr</code> should be an authorizable id, or void (but then input should be an authorizable)</li>
+<li><code>autoCreateGroup</code> (boolean) if autorizable id is here, but the authorizable not present, then create group with given id (in that case, considered as a write pipe)</li>
+<li><code>addMembers</code> (stringified json array) if authorizable is a group, add instanciated members to it (in that case, considered as a write pipe)</li>
+<li><code>addToGroup</code> (expression) add found authorizable to instanciated group (in that case, considered as a write pipe)</li>
+<li><code>bindMembers</code> (boolean) if found authorizable is a group, bind the members (in that case, considered as a write pipe)</li>
+</ul>
+<h4 id="parentpipe">ParentPipe<a class="headerlink" href="#parentpipe" title="Permanent link">&para;</a></h4>
+<p>outputs the parent resource of input resource
+- <code>sling:resourceType</code> is <code>slingPipes/parent</code></p>
+<h4 id="filterpipe">FilterPipe<a class="headerlink" href="#filterpipe" title="Permanent link">&para;</a></h4>
+<p>outputs the input resource if its matches its configuration</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/filter</code></li>
+<li><code>conf</code> node tree that will be tested against the current input of the pipe, each <code>/conf/sub@prop=value</code> will triggers a test
+on <code>./sub@prop</code> property of the current input, testing if its value matches <code>value</code> regex. If the special <code>slingPipesFilter_noChildren=${true}</code>
+property is there with the value instantiated as a true boolean, then filter will pass if corresponding node has no children.</li>
+</ul>
+<h3 id="containers">containers<a class="headerlink" href="#containers" title="Permanent link">&para;</a></h3>
+<h4 id="container-pipe">Container Pipe<a class="headerlink" href="#container-pipe" title="Permanent link">&para;</a></h4>
+<p>assemble a sequence of pipes</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/container</code></li>
+<li><code>conf</code> node contains child pipes' configurations, that will be configured in the order they are found (note you should use sling:OrderedFolder)</li>
+</ul>
+<h4 id="referencepipe">ReferencePipe<a class="headerlink" href="#referencepipe" title="Permanent link">&para;</a></h4>
+<p>execute the pipe referenced in path property</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/reference</code></li>
+<li><code>path</code> path of the referenced pipe</li>
+</ul>
+<h3 id="writers">writers<a class="headerlink" href="#writers" title="Permanent link">&para;</a></h3>
+<h4 id="write-pipe">Write Pipe<a class="headerlink" href="#write-pipe" title="Permanent link">&para;</a></h4>
+<p>writes given properties to current input</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/write</code></li>
+<li><code>conf</code> 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. </li>
+</ul>
+<h3 id="movepipe">MovePipe<a class="headerlink" href="#movepipe" title="Permanent link">&para;</a></h3>
+<p>JCR move of current input to target path (can be a node or a property)</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/mv</code></li>
+<li><code>expr</code> target path, note that parent path must exists</li>
+</ul>
+<h4 id="removepipe">RemovePipe<a class="headerlink" href="#removepipe" title="Permanent link">&para;</a></h4>
+<p>removes the input resource, returns the parent, regardless of the resource being a node, or
+a property</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/rm</code></li>
+<li><code>conf</code> node tree that will be used to filter relative properties &amp; subtrees to the current resource to remove.
+A subnode is considered to be removed if it has no property configured, nore any child.</li>
+</ul>
+<h4 id="pathpipe">PathPipe<a class="headerlink" href="#pathpipe" title="Permanent link">&para;</a></h4>
+<p>get or create path given in expression</p>
+<ul>
+<li><code>sling:resourceType</code> is <code>slingPipes/path</code></li>
+<li><code>nodeType</code> node type of the intermediate nodes to create</li>
+<li><code>autosave</code> should save at each creation (will make things slow, but sometimes you don't have choice)</li>
+</ul>
+<h2 id="making-configuration-dynamic-with-pipe-bindings">Making configuration dynamic with pipe bindings<a class="headerlink" href="#making-configuration-dynamic-with-pipe-bindings" title="Permanent link">&para;</a></h2>
+<p>in order to make things interesting, most of the configurations are javascript template strings, hence valid js expressions reusing bindings (from configuration, or other pipes).</p>
+<p>Following configurations are evaluated:</p>
+<ul>
+<li><code>path</code></li>
+<li><code>expr</code></li>
+<li>name/value of each property of some pipes (write, remove)</li>
+</ul>
+<p>you can use name of previous pipes in the pipe container, or the special binding <code>path</code>, where <code>path.previousPipe</code> 
+is the path of the current resource of previous pipe named <code>previousPipe</code></p>
+<p>global bindings can be set at pipe execution, external scripts can be added to the execution as well (see pipe
+ configurations)</p>
+<h2 id="how-to-execute-a-pipe">How to execute a pipe<a class="headerlink" href="#how-to-execute-a-pipe" title="Permanent link">&para;</a></h2>
+<p>for now it's possible to execute Pipes through GET (read) or POST (read/write) commands:</p>
+<h3 id="request-path">Request Path<a class="headerlink" href="#request-path" title="Permanent link">&para;</a></h3>
+<ul>
+<li>
+<p>either you'll need to create a slingPipes/plumber resource, say <code>etc/pipes</code> and then to execute</p>
+<p>curl -u admin:admin -F "path=/etc/pipes/mySamplePipe" http://localhost:8080/etc/pipes.json</p>
+</li>
+<li>
+<p>either you execute the request directly on the pipe Path, e.g.</p>
+<p>curl -u admin:admin http://localhost:8080/etc/pipes/mySamplePipe.json</p>
+</li>
+</ul>
+<p>which will return you the path of the pipes that have been through the output of the configured pipe.</p>
+<h3 id="request-parameter-binding">Request Parameter <code>binding</code><a class="headerlink" href="#request-parameter-binding" title="Permanent link">&para;</a></h3>
+<p>you can add as <code>bindings</code> parameter a json object of global bindings you want to add for the execution of the pipe</p>
+<p>e.g.</p>
+<div class="codehilite"><pre><span class="n">curl</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin</span><span class="p">:</span><span class="n">admin</span> <span class="o">-</span><span class="n">F</span> &quot;<span class="n">path</span><span class="p">=</span><span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">pipes</span><span class="o">/</span><span class="n">test</span>&quot; <span class="o">-</span><span class="n">F</span> &quot;<span class="n">bindings</span><span class="p">={</span><span class="n">testBinding</span><span class="p">:</span><span class="s">&#39;foo&#39;</span><span class="p">}</span>&quot; <span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">localhost</span><span class="p">:</span>4502<span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">pipes</span><span class="p">.</span><span class="n">json</span>
+</pre></div>
+
+
+<p>will returns something like</p>
+<div class="codehilite"><pre><span class="p">{</span>&quot;<span class="nb">size</span>&quot;<span class="p">:</span>2<span class="p">,</span> &quot;<span class="n">items</span>&quot;<span class="p">:[</span>&quot;<span class="o">/</span><span class="n">one</span><span class="o">/</span><span class="n">output</span><span class="o">/</span><span class="n">resource</span>&quot;<span class="p">,</span> &quot;<span class="n">another</span><span class="o">/</span><span class="n">one</span>&quot;<span class="p">]}</span>
+</pre></div>
+
+
+<h3 id="request-parameter-writer">Request Parameter <code>writer</code><a class="headerlink" href="#request-parameter-writer" title="Permanent link">&para;</a></h3>
+<p>you can add as <code>writer</code> parameter a json object as a pattern to the result you want to have. The values of the json
+object are expressions and can reuse each pipe's subpipe binding. 
+Note
+this works only if the pipe called is a container
+pipe.</p>
+<p>e.g.</p>
+<div class="codehilite"><pre>curl -u admin:admin http://localhost:4502/etc/pipes/users.json?writer={&quot;user&quot;:&quot;<span class="cp">${</span><span class="n">user</span><span class="o">.</span><span class="n">fullName</span><span class="cp">}</span>&quot;}
+</pre></div>
+
+
+<p>will returns something similar to</p>
+<p>{"size":2, "items":[{'user':'John Smith','path':'/home/users/q/q123jk1UAZS'},{'user':'John Doe','path':'/home/users/q/q153jk1UAZS'}]}</p>
+<h3 id="request-parameter-dryrun">Request Parameter <code>dryRun</code><a class="headerlink" href="#request-parameter-dryrun" title="Permanent link">&para;</a></h3>
+<p>if parameter dryRun is set to true, and the executed pipe is supposed to modify content, it will log (at best it can) the change it <em>would</em> have done, without doing anything</p>
+<h3 id="request-parameter-size">Request Parameter <code>size</code><a class="headerlink" href="#request-parameter-size" title="Permanent link">&para;</a></h3>
+<p>default response is truncated to 10 items, if you need more (or less), you can modify that settings with the size parameter</p>
+<h2 id="sample-configurations">sample configurations<a class="headerlink" href="#sample-configurations" title="Permanent link">&para;</a></h2>
+<h3 id="slingquery-write">slingQuery | write<a class="headerlink" href="#slingquery-write" title="Permanent link">&para;</a></h3>
+<p>this pipe parse all profile nodes, and</p>
+<div class="codehilite"><pre>{
+  &quot;sling:resourceType&quot;:&quot;slingPipes/container&quot;,
+  &quot;name&quot;:&quot;Dummy User prefix Sample&quot;,
+  &quot;jcr:description&quot;:&quot;prefix all full names of profile with &quot;Mr&quot; or &quot;Ms&quot; depending on gender&quot;,
+  &quot;conf&quot;:{
+    &quot;profile&quot;: {
+        &quot;sling:resourceType&quot;:&quot;slingPipes/slingQuery&quot;,
+        &quot;expr&quot;:&quot;nt:unstructured#profile&quot;,
+        &quot;path&quot;:&quot;/home/users&quot;
+    },
+    &quot;writeFullName&quot;: {
+        &quot;sling:resourceType&quot;:&quot;slingPipes/write&quot;,
+        &quot;conf&quot;: {
+            &quot;fullName&quot;:&quot;<span class="cp">${</span><span class="p">(</span><span class="n">profile</span><span class="o">.</span><span class="n">gender</span> <span class="o">===</span> <span class="s">&#39;female&#39;</span> <span class="err">?</span> <span class="s">&#39;Ms &#39;</span> <span class="o">+</span> <span class="n">profile</span><span class="o">.</span><span class="n">fullName</span> <span class="p">:</span> <span class="s">&#39;Mr &#39;</span> <span class="o">+</span> <span class="n">profile</span><span class="o">.</span><span class="n">fullName</span><span class="p">)</span><span class="cp">}</span>&quot;,
+            &quot;generatedBy&quot;:&quot;slingPipes&quot;
+        }
+    }
+  }
+}
+</pre></div>
+
+
+<h3 id="slingquery-multiproperty-authorizable-write">slingQuery | multiProperty | authorizable | write<a class="headerlink" href="#slingquery-multiproperty-authorizable-write" title="Permanent link">&para;</a></h3>
+<div class="codehilite"><pre><span class="p">{</span>
+  <span class="s">&quot;jcr:primaryType&quot;</span>: <span class="s">&quot;sling:Folder&quot;</span><span class="p">,</span>
+  <span class="s">&quot;jcr:description&quot;</span>: <span class="s">&quot;move badge&lt;-&gt;user relation ship from badge MV property to a user MV property&quot;</span>
+  <span class="s">&quot;name&quot;</span>: <span class="s">&quot;badges&quot;</span><span class="p">,</span>
+  <span class="s">&quot;sling:resourceType&quot;</span>: <span class="s">&quot;slingPipes/container&quot;</span><span class="p">,</span>
+  <span class="s">&quot;conf&quot;</span>: <span class="p">{</span>
+    <span class="s">&quot;jcr:primaryType&quot;</span>: <span class="s">&quot;sling:OrderedFolder&quot;</span><span class="p">,</span>
+    <span class="s">&quot;badge&quot;</span>: <span class="p">{</span>
+      <span class="s">&quot;jcr:primaryType&quot;</span>: <span class="s">&quot;sling:Folder&quot;</span><span class="p">,</span>
+      <span class="s">&quot;jcr:description&quot;</span>: <span class="s">&quot;outputs all badge component resources&quot;</span><span class="p">,</span>
+      <span class="s">&quot;expr&quot;</span>: <span class="s">&quot;[sling:resourceType=myApp/components/badge]&quot;</span><span class="p">,</span>
+      <span class="s">&quot;path&quot;</span>: <span class="s">&quot;/etc/badges/badges-admin/jcr:content&quot;</span><span class="p">,</span>
+      <span class="s">&quot;sling:resourceType&quot;</span>: <span class="s">&quot;slingPipes/slingQuery&quot;</span>
+      <span class="p">},</span>
+    <span class="s">&quot;profile&quot;</span>: <span class="p">{</span>
+      <span class="s">&quot;jcr:primaryType&quot;</span>: <span class="s">&quot;sling:Folder&quot;</span><span class="p">,</span>
+      <span class="s">&quot;jcr:description&quot;</span>: <span class="s">&quot;retrieve all user ids from a mv property&quot;</span><span class="p">,</span>
+      <span class="s">&quot;path&quot;</span>: <span class="s">&quot;${path.badge}/profiles&quot;</span><span class="p">,</span>
+      <span class="s">&quot;sling:resourceType&quot;</span>: <span class="s">&quot;slingPipes/multiProperty&quot;</span>
+    <span class="p">},</span>
+    <span class="s">&quot;user&quot;</span>: <span class="p">{</span>
+      <span class="s">&quot;jcr:primaryType&quot;</span>: <span class="s">&quot;sling:OrderedFolder&quot;</span><span class="p">,</span>
+      <span class="s">&quot;jcr:description&quot;</span>: <span class="s">&quot;outputs user resource&quot;</span><span class="p">,</span>
+      <span class="s">&quot;expr&quot;</span>: <span class="s">&quot;profile&quot;</span><span class="p">,</span>
+      <span class="s">&quot;sling:resourceType&quot;</span>: <span class="s">&quot;slingPipes/authorizable&quot;</span>
+    <span class="p">},</span>
+    <span class="s">&quot;write&quot;</span>: <span class="p">{</span>
+      <span class="s">&quot;jcr:primaryType&quot;</span>: <span class="s">&quot;sling:OrderedFolder&quot;</span><span class="p">,</span>
+      <span class="s">&quot;jcr:descritption&quot;</span>: <span class="s">&quot;patches the badge path to the badges property of the user profile&quot;</span>
+      <span class="s">&quot;path&quot;</span>: <span class="s">&quot;${path.user}/profile&quot;</span><span class="p">,</span>
+      <span class="s">&quot;sling:resourceType&quot;</span>: <span class="s">&quot;slingPipes/write&quot;</span><span class="p">,</span>
+      <span class="s">&quot;conf&quot;</span>: <span class="p">{</span>
+        <span class="s">&quot;jcr:primaryType&quot;</span>: <span class="s">&quot;nt:unstructured&quot;</span><span class="p">,</span>
+        <span class="s">&quot;badges&quot;</span>: <span class="s">&quot;+[${path.badge}]&quot;</span>
+      <span class="p">}</span>
+    <span class="p">}</span>
+  <span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<h3 id="xpath-json-write">xpath | json | write<a class="headerlink" href="#xpath-json-write" title="Permanent link">&para;</a></h3>
+<p>this use case is for completing repository profiles with external system's data (that has an json api)</p>
+<div class="codehilite"><pre>{
+  &quot;jcr:primaryType&quot;: &quot;nt:unstructured&quot;,
+  &quot;jcr:description&quot;: &quot;this pipe retrieves json info from an external system and writes them to the user profile, uses moment.js, it
+  distributes modified resources using publish distribution agent&quot;,
+  &quot;sling:resourceType&quot;: &quot;slingPipes/container&quot;,
+  &quot;distribution.agent&quot;: &quot;publish&quot;,
+  &quot;additionalScripts&quot;: &quot;/etc/source/moment.js&quot;,
+  &quot;conf&quot;: {
+    &quot;jcr:primaryType&quot;: &quot;sling:OrderedFolder&quot;,
+    &quot;profile&quot;: {
+      &quot;jcr:primaryType&quot;: &quot;sling:OrderedFolder&quot;,
+      &quot;expr&quot;: &quot;/jcr:root/home/users//element(profile,nt:unstructured)[@uid]&quot;,
+      &quot;jcr:description&quot;: &quot;query all user profile nodes&quot;,
+      &quot;sling:resourceType&quot;: &quot;slingPipes/xpath&quot;
+    },
+    &quot;json&quot;: {
+      &quot;jcr:primaryType&quot;: &quot;sling:OrderedFolder&quot;,
+      &quot;expr&quot;: &quot;<span class="cp">${</span><span class="p">(</span><span class="n">profile</span><span class="o">.</span><span class="n">uid</span> <span class="err">?</span> <span class="s">&#39;https://my.external.system.corp.com/profiles/&#39;</span> <span class="o">+</span> <span class="n">profile</span><span class="o">.</span><span class="n">uid</span><span class="o">.</span><span class="n">substr</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39;/&#39;</span> <span class="o">+</span> <span class="n">profile</span><span class="o">.</span><span class="n">uid</span> <span class="o">+</span> <span class="s">&#39;.json&#39;</span> <span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">)</span><span class="s">&quot;,</span>
+      <span class="s">&quot;jcr:description&quot;</span><span class="p">:</span> <span class="s">&quot;retrieves json information relative to the given profile, if the uid is not found, expr is empty: the pipe will do nothing&quot;</span><span class="p">,</span>
+      <span class="s">&quot;sling:resourceType&quot;</span><span class="p">:</span> <span class="s">&quot;slingPipes/json&quot;</span>
+    <span class="cp">}</span>,
+    &quot;write&quot;: {
+      &quot;jcr:primaryType&quot;: &quot;sling:OrderedFolder&quot;,
+      &quot;path&quot;: &quot;path.profile&quot;,
+      &quot;jcr:description&quot;: &quot;write json information to the profile node&quot;,
+      &quot;sling:resourceType&quot;: &quot;slingPipes/write&quot;,
+      &quot;conf&quot;: {
+        &quot;jcr:primaryType&quot;: &quot;sling:OrderedFolder&quot;,
+        &quot;background&quot;: &quot;<span class="cp">${</span><span class="n">json</span><span class="o">.</span><span class="n">opt</span><span class="p">(</span><span class="s">&#39;background&#39;</span><span class="p">)</span><span class="cp">}</span>&quot;,
+        &quot;about&quot;: &quot;<span class="cp">${</span><span class="n">json</span><span class="o">.</span><span class="n">opt</span><span class="p">(</span><span class="s">&#39;about&#39;</span><span class="p">)</span><span class="cp">}</span>&quot;,
+        &quot;birthday&quot;: &quot;<span class="cp">${</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">opt</span><span class="p">(</span><span class="s">&#39;birthday&#39;</span><span class="p">)</span> <span class="err">?</span> <span class="n">moment</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">opt</span><span class="p">(</span><span class="s">&#39;birthday&#39;</span><span class="p">),</span> \<span class="s">&quot;MMMM DD</span><span class="se">\&quot;</span><span class="s">).toDate() : &#39;&#39;)</span><span class="cp">}</span>&quot;,
+        &quot;mobile&quot;: &quot;<span class="cp">${</span><span class="n">json</span><span class="o">.</span><span class="n">opt</span><span class="p">(</span><span class="s">&#39;mobile&#39;</span><span class="p">)</span><span class="cp">}</span>&quot;
+      }
+    }
+  }
+}
+</pre></div>
+
+
+<h3 id="xpath-parent-rm">xpath | parent | rm<a class="headerlink" href="#xpath-parent-rm" title="Permanent link">&para;</a></h3>
+<div class="codehilite"><pre><span class="p">{</span>
+  &quot;<span class="n">jcr</span><span class="p">:</span><span class="n">primaryType</span>&quot;<span class="p">:</span> &quot;<span class="n">nt</span><span class="p">:</span><span class="n">unstructured</span>&quot;<span class="p">,</span>
+  &quot;<span class="n">jcr</span><span class="p">:</span><span class="n">description</span>&quot;<span class="p">:</span> &quot;<span class="n">this</span> <span class="n">pipe</span> <span class="n">removes</span> <span class="n">user</span> <span class="n">with</span> <span class="n">bad</span> <span class="n">property</span> <span class="n">in</span> <span class="n">their</span> <span class="n">profile</span>&quot;<span class="p">,</span>
+  &quot;<span class="n">sling</span><span class="p">:</span><span class="n">resourceType</span>&quot;<span class="p">:</span> &quot;<span class="n">slingPipes</span><span class="o">/</span><span class="n">container</span>&quot;<span class="p">,</span>
+  &quot;<span class="n">conf</span>&quot;<span class="p">:</span> <span class="p">{</span>
+    &quot;<span class="n">jcr</span><span class="p">:</span><span class="n">primaryType</span>&quot;<span class="p">:</span> &quot;<span class="n">sling</span><span class="p">:</span><span class="n">OrderedFolder</span>&quot;<span class="p">,</span>
+    &quot;<span class="n">profile</span>&quot;<span class="p">:</span> <span class="p">{</span>
+      &quot;<span class="n">jcr</span><span class="p">:</span><span class="n">primaryType</span>&quot;<span class="p">:</span> &quot;<span class="n">sling</span><span class="p">:</span><span class="n">OrderedFolder</span>&quot;<span class="p">,</span>
+      &quot;<span class="n">expr</span>&quot;<span class="p">:</span> &quot;<span class="o">/</span><span class="n">jcr</span><span class="p">:</span><span class="n">root</span><span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">users</span><span class="o">//</span><span class="n">element</span><span class="p">(</span><span class="n">profile</span><span class="p">,</span><span class="n">nt</span><span class="p">:</span><span class="n">unstructured</span><span class="p">)[@</span><span class="n">bad</span><span class="p">]</span>&quot;<span class="p">,</span>
+      &quot;<span class="n">jcr</span><span class="p">:</span><span class="n">description</span>&quot;<span class="p">:</span> &quot;<span class="n">query</span> <span class="n">all</span> <span class="n">user</span> <span class="n">profile</span> <span class="n">nodes</span> <span class="n">with</span> <span class="n">bad</span> <span class="k">properties</span>&quot;<span class="p">,</span>
+      &quot;<span class="n">sling</span><span class="p">:</span><span class="n">resourceType</span>&quot;<span class="p">:</span> &quot;<span class="n">slingPipes</span><span class="o">/</span><span class="n">xpath</span>&quot;
+    <span class="p">},</span>
+    &quot;<span class="n">parent</span>&quot;<span class="p">:</span> <span class="p">{</span>
+      &quot;<span class="n">jcr</span><span class="p">:</span><span class="n">primaryType</span>&quot;<span class="p">:</span> &quot;<span class="n">sling</span><span class="p">:</span><span class="n">OrderedFolder</span>&quot;<span class="p">,</span>
+      &quot;<span class="n">jcr</span><span class="p">:</span><span class="n">description</span>&quot;<span class="p">:</span> &quot;<span class="n">get</span> <span class="n">the</span> <span class="n">parent</span> <span class="n">node</span> <span class="p">(</span><span class="n">user</span> <span class="n">node</span><span class="p">)</span>&quot;<span class="p">,</span>
+      &quot;<span class="n">sling</span><span class="p">:</span><span class="n">resourceType</span>&quot;<span class="p">:</span> &quot;<span class="n">slingPipes</span><span class="o">/</span><span class="n">parent</span>&quot;
+    <span class="p">},</span>
+    &quot;<span class="n">rm</span>&quot;<span class="p">:</span> <span class="p">{</span>
+      &quot;<span class="n">jcr</span><span class="p">:</span><span class="n">primaryType</span>&quot;<span class="p">:</span> &quot;<span class="n">sling</span><span class="p">:</span><span class="n">OrderedFolder</span>&quot;<span class="p">,</span>
+      &quot;<span class="n">jcr</span><span class="p">:</span><span class="n">description</span>&quot;<span class="p">:</span> &quot;<span class="n">remove</span> <span class="n">it</span>&quot;<span class="p">,</span>
+      &quot;<span class="n">sling</span><span class="p">:</span><span class="n">resourceType</span>&quot;<span class="p">:</span> &quot;<span class="n">slingPipes</span><span class="o">/</span><span class="n">rm</span>&quot;<span class="p">,</span>
+    <span class="p">}</span>
+  <span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>some other samples are in https://github.com/npeltier/sling-pipes/tree/master/src/test/</p>
+<h1 id="compatibility">Compatibility<a class="headerlink" href="#compatibility" title="Permanent link">&para;</a></h1>
+<p>For running this tool on a sling instance you need:</p>
+<ul>
+<li>java 8 (Nashorn is used for expression)</li>
+<li>slingQuery (3.0.0) (used in SlingQueryPipe)</li>
+<li>jackrabbit api (2.7.5+) (used in AuthorizablePipe)</li>
+</ul>
+      <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+        Rev. 1719873 by rombert on Mon, 14 Dec 2015 10:09:03 +0000
+      </div>
+      <div class="trademarkFooter"> 
+        Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project
+        logo are trademarks of The Apache Software Foundation. All other marks mentioned
+        may be trademarks or registered trademarks of their respective owners.
+      </div>
+    </div>
+  </body>
+</html>




Mime
View raw message