public class PipeBuilderImpl extends Object implements PipeBuilder
Modifier and Type | Class and Description |
---|---|
class |
PipeBuilderImpl.Step
holds a subpipe set of informations
|
Modifier and Type | Field and Description |
---|---|
static String[] |
DEFAULT_NAMES |
static String |
PIPES_REPOSITORY_PATH |
Modifier | Constructor and Description |
---|---|
protected |
PipeBuilderImpl(org.apache.sling.api.resource.ResourceResolver resolver,
Plumber plumber)
protected constructor (to only allow internal classes to build it out)
|
Modifier and Type | Method and Description |
---|---|
PipeBuilder |
$(String expr)
attach a sling query find pipe to the current context
|
PipeBuilder |
acls()
attach an ACL pipe to the current context
|
PipeBuilder |
allow(String expr)
attach an ACL pipe to the current context and sets allow acls on the resource
|
PipeBuilder |
auth(Object... conf)
attach an authorizable pipe to the current context
|
Pipe |
build()
builds a configured pipe.
|
Pipe |
build(String path)
builds a configured pipe.
|
protected String |
buildRandomPipePath()
build a time + random based path under /var/pipes
|
PipeBuilder |
children(String expr)
attach a sling query children pipe to the current context
|
PipeBuilder |
closest(String expr)
attach a sling query closest pipe to the current context
|
PipeBuilder |
conf(Object... properties)
Building up a set of configurations for the current pipe
|
protected org.apache.sling.api.resource.Resource |
createResource(org.apache.sling.api.resource.ResourceResolver resolver,
String path,
String type,
Map data)
Create a configuration resource
|
PipeBuilder |
csv(String expr)
attach a csv pipe to the current context
|
PipeBuilder |
deny(String expr)
attach an ACL pipe to the current context and sets deny acls on the resource
|
PipeBuilder |
echo(String path)
attach a base pipe to the current context
|
PipeBuilder |
egrep(String expr)
attach a Regexp pipe to the current context
|
PipeBuilder |
expr(String value)
set an expr configuration to the current pipe in the context
|
PipeBuilder |
grep(Object... conf)
attach a filter pipe to the current context
|
PipeBuilder |
json(String expr)
attach a json pipe to the current context
|
PipeBuilder |
mkdir(String expr)
Attach a path pipe to the current context
|
PipeBuilder |
mp()
attach a MULTI value property pipe to the current context
|
PipeBuilder |
mv(String expr)
attach a move pipe to the current context
|
PipeBuilder |
name(String name)
sets a pipe name, important in case you want to reuse it in another expression
|
PipeBuilder |
not(String expr)
attach a not pipe to the current context
|
PipeBuilder |
outputs(String... keys)
add outputs passed key
|
PipeBuilder |
parent()
attach a sling query parent pipe to the current context
|
PipeBuilder |
parents(String expr)
attach a sling query parents pipe to the current context
|
PipeBuilder |
path(String value)
set a path configuration to the current pipe in the context
|
protected org.apache.sling.api.resource.Resource |
persistStep(String path,
String parentType,
PipeBuilderImpl.Step step)
Persist a step at a given path
|
PipeBuilder |
pipe(String type)
attach a new pipe to the current context
|
protected PipeBuilder |
pipeWithExpr(String type,
String expr)
internal utility to glob pipe configuration & expression configuration
|
PipeBuilder |
pkg(String expr)
attach a package pipe, in filter collection mode as default
|
PipeBuilder |
ref(String expr)
attach a reference pipe to the current context
|
PipeBuilder |
rm()
attach a rm pipe to the current context
|
ExecutionResult |
run()
builds and run configured pipe
|
ExecutionResult |
run(Map bindings)
allow execution of a pipe, with more parameter
|
org.apache.sling.event.jobs.Job |
runAsync(Map bindings)
run a pipe asynchronously
|
ExecutionResult |
runParallel(int numThreads,
Map additionalBindings)
run referenced pipes in parallel
|
ExecutionResult |
runWith(Object... bindings)
allow execution of a pipe, with more parameter
|
PipeBuilder |
siblings(String expr)
attach a sling query siblings pipe to the current context
|
PipeBuilder |
traverse()
attach a traverse pipe to the current context
|
PipeBuilder |
with(Object... params)
parameterized current pipe in the context
|
PipeBuilder |
write(Object... conf)
attach a write pipe to the current context
|
protected PipeBuilder |
writeToCurrentStep(String name,
Object... params)
Add some configurations to current's Step node defined by name (if null, will be step's properties)
|
PipeBuilder |
xpath(String expr)
attach a xpath pipe to the current context
|
public static final String PIPES_REPOSITORY_PATH
public static final String[] DEFAULT_NAMES
protected PipeBuilderImpl(org.apache.sling.api.resource.ResourceResolver resolver, Plumber plumber)
resolver
- resolver with which the pipe will be built and executedplumber
- instance of the plumberpublic PipeBuilder pipe(String type)
PipeBuilder
pipe
in interface PipeBuilder
type
- resource type (should be registered by the plumber)protected PipeBuilder pipeWithExpr(String type, String expr)
type
- pipe typeexpr
- expressionpublic PipeBuilder mv(String expr)
PipeBuilder
mv
in interface PipeBuilder
expr
- target of the resource to movepublic PipeBuilder write(Object... conf) throws IllegalAccessException
PipeBuilder
write
in interface PipeBuilder
conf
- configuration parametersIllegalAccessException
- in case it's called with bad configurationpublic PipeBuilder grep(Object... conf) throws IllegalAccessException
PipeBuilder
grep
in interface PipeBuilder
conf
- configuration parametersIllegalAccessException
- in case it's called with bad configurationpublic PipeBuilder auth(Object... conf) throws IllegalAccessException
PipeBuilder
auth
in interface PipeBuilder
conf
- configuration key value pairs for authorizable (see pipe's doc)IllegalAccessException
- in case it's called with bad configurationpublic PipeBuilder xpath(String expr)
PipeBuilder
xpath
in interface PipeBuilder
expr
- xpath expressionpublic PipeBuilder children(String expr)
PipeBuilder
children
in interface PipeBuilder
expr
- sling query expressionpublic PipeBuilder rm()
PipeBuilder
rm
in interface PipeBuilder
public PipeBuilder traverse()
PipeBuilder
traverse
in interface PipeBuilder
public PipeBuilder csv(String expr)
PipeBuilder
csv
in interface PipeBuilder
expr
- csv expr or URL or path in the resource treepublic PipeBuilder json(String expr)
PipeBuilder
json
in interface PipeBuilder
expr
- json expr or URL or path in the resource treepublic PipeBuilder egrep(String expr)
PipeBuilder
egrep
in interface PipeBuilder
expr
- text expr or URL or path in the resource treepublic PipeBuilder mkdir(String expr)
PipeBuilder
mkdir
in interface PipeBuilder
expr
- path to createpublic PipeBuilder echo(String path)
PipeBuilder
echo
in interface PipeBuilder
path
- pipe pathpublic PipeBuilder parent()
PipeBuilder
parent
in interface PipeBuilder
public PipeBuilder parents(String expr)
PipeBuilder
parents
in interface PipeBuilder
expr
- expressionpublic PipeBuilder siblings(String expr)
PipeBuilder
siblings
in interface PipeBuilder
expr
- sling query expressionpublic PipeBuilder closest(String expr)
PipeBuilder
closest
in interface PipeBuilder
expr
- expressionpublic PipeBuilder $(String expr)
PipeBuilder
$
in interface PipeBuilder
expr
- expressionpublic PipeBuilder ref(String expr)
PipeBuilder
ref
in interface PipeBuilder
expr
- referencepublic PipeBuilder mp()
PipeBuilder
mp
in interface PipeBuilder
public PipeBuilder pkg(String expr)
PipeBuilder
pkg
in interface PipeBuilder
expr
- path of the pipepublic PipeBuilder not(String expr)
PipeBuilder
not
in interface PipeBuilder
expr
- referencepublic PipeBuilder with(Object... params) throws IllegalAccessException
PipeBuilder
with
in interface PipeBuilder
params
- key value pair of parametersIllegalAccessException
- in case it's called with wrong # of argumentspublic PipeBuilder conf(Object... properties) throws IllegalAccessException
PipeBuilder
conf
in interface PipeBuilder
properties
- configuration key value pairs (must be an even number of arguments)IllegalAccessException
- in case it's called in a bad timepublic PipeBuilder acls() throws IllegalAccessException
PipeBuilder
acls
in interface PipeBuilder
IllegalAccessException
- in case it's called with bad configurationpublic PipeBuilder allow(String expr) throws IllegalAccessException
PipeBuilder
allow
in interface PipeBuilder
expr
- prinicipalName/AuthorizableId of the user to give allow privileges toIllegalAccessException
- in case it's called with bad configurationpublic PipeBuilder deny(String expr) throws IllegalAccessException
PipeBuilder
deny
in interface PipeBuilder
expr
- prinicipalName/AuthorizableId of the user/group to give deny privileges toIllegalAccessException
- in case it's called with bad configurationprotected PipeBuilder writeToCurrentStep(String name, Object... params) throws IllegalAccessException
name
- name of the configuration node, can be null in which case it's the subpipe itselfparams
- key/value pair list of configurationIllegalAccessException
- in case configuration is wrongpublic PipeBuilder expr(String value) throws IllegalAccessException
PipeBuilder
expr
in interface PipeBuilder
value
- expression valueIllegalAccessException
- in case it's called in a bad timepublic PipeBuilder path(String value) throws IllegalAccessException
PipeBuilder
path
in interface PipeBuilder
value
- path valueIllegalAccessException
- in case it's called before a pipe is configuredpublic PipeBuilder name(String name) throws IllegalAccessException
PipeBuilder
name
in interface PipeBuilder
name
- to overwrite default binding name (otherwise it will be "one", "two", ...)IllegalAccessException
- in case it's called before a pipe is configuredprotected String buildRandomPipePath()
protected org.apache.sling.api.resource.Resource createResource(org.apache.sling.api.resource.ResourceResolver resolver, String path, String type, Map data) throws org.apache.sling.api.resource.PersistenceException
resolver
- current resolverpath
- path of the resourcetype
- type of the node to be createddata
- map of properties to addorg.apache.sling.api.resource.PersistenceException
- in case configuration resource couldn't be persistedpublic PipeBuilder outputs(String... keys)
PipeBuilder
outputs
in interface PipeBuilder
keys
- properties of the outputs resource to outputpublic Pipe build() throws org.apache.sling.api.resource.PersistenceException
PipeBuilder
/var/pipes
build
in interface PipeBuilder
org.apache.sling.api.resource.PersistenceException
- error occuring when saving the pipe configurationprotected org.apache.sling.api.resource.Resource persistStep(String path, String parentType, PipeBuilderImpl.Step step) throws org.apache.sling.api.resource.PersistenceException
path
- path into which step should be persistedparentType
- type of the parent resourcestep
- step to persistorg.apache.sling.api.resource.PersistenceException
- in case persistence failspublic Pipe build(String path) throws org.apache.sling.api.resource.PersistenceException
PipeBuilder
path
build
in interface PipeBuilder
path
- path under which the generated configuration should be storedorg.apache.sling.api.resource.PersistenceException
- error occuring when saving the pipe configurationpublic ExecutionResult run() throws Exception
PipeBuilder
run
in interface PipeBuilder
Exception
- exceptions thrown by the build or the pipe execution itselfpublic ExecutionResult runWith(Object... bindings) throws Exception
PipeBuilder
runWith
in interface PipeBuilder
bindings
- additional bindings, should be key/value formatException
- in case something goes wrong with pipe executionpublic ExecutionResult run(Map bindings) throws Exception
PipeBuilder
run
in interface PipeBuilder
bindings
- additional bindingsException
- in case something goes wrong with pipe executionpublic org.apache.sling.event.jobs.Job runAsync(Map bindings) throws org.apache.sling.api.resource.PersistenceException
PipeBuilder
runAsync
in interface PipeBuilder
bindings
- additional bindings for the execution (can be null)org.apache.sling.api.resource.PersistenceException
- in case something goes wrong in the job creationpublic ExecutionResult runParallel(int numThreads, Map additionalBindings) throws Exception
PipeBuilder
runParallel
in interface PipeBuilder
numThreads
- number of threads to use for running the contained pipesadditionalBindings
- additional bindings for the execution (can be null)Exception
- in case something went wrong in run executionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.