By: Ankit Gubrani / @ankitgubrani90

.about-me{

name: Ankit Gubrani;
title: Sr. Software Engineer;
working at: Playstation;
email-id: [email protected];
linkedIn: linkedin.com/in/ankitgubrani;
twitter: @ankitgubrani90;
blog: codebrains.co.in;

}

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

 

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

Thank You

 

Contact Me :
LinkedIn : Ankit Gubrani
Twitter : @ankitgubrani90
Email-ID : [email protected]
Blog : www.codebrains.co.in