Agenda
- What is Sling Pipes ?
- Installation
- Different Types of Pipes
- Executing Pipes
- Demo
What is sling pipes ?
- Toolset for performing extract, load & transform operations on content within JCR repository using reusable code blocks called pipes.
Why sling pipes ?
- Let’s say business requests us to enable override title & description on all game pages
- OR due to a component update we had to remove/modify a property in all occurrences of that component’s node
- OR create a CSV of pages which are using image components
installation
- Sling pipes is not included with vanilla AEM installation, following bundles have be to installed:
- Create the node hierarchy: /system/sling/permissions/pipes/exec
- Note: For updating which groups can run sling pipes on a AEM instance, update Apache Sling Pipes : Plumber configuration
What is sling Query ?
- Sling resource tree traversal tool inspired by the jQuery JavaScript API, providing convenient way to traverse resource tree.
- Note: Sling query is not a replacement of JCR query, its just a tool for making traversal of resources easier, more details can be found here: sling query
Types of pipes
- Reader Pipes – only used for reading resources, usually used with writer & logical pipes
- Writer Pipes – used for performing write, update, move or remove operations in JCR repository, can even create packages
- Logical Pipes - can be used for referring to other pipes, chaining them or using their results in a general way
Executing pipes
- A Pipe can persist in JCR
- Groovy console
- Java class
- HTTP call to JCR persisted pipe
- PipeModel Sling Model
Reader pipes
- Base Pipe: echo(path)
- Xpath pipe: xpath(expr)
- Sling Query Pipes
- Find pipe: $(expr)
- Children Pipe: children(expr)
- Siblings Pipe: siblings(expr)
- Parent Pipe: parent()
- Closest Pipe: closest(expr)
write pipes
- Write Pipe: write(conf)
- Path Pipe: mkdir(expr)
- Move pipe: mv(expr)
- Remove Pipe: rm()
- Package Pipe: pkg(expr)
Demo