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 |
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
|
protected void |
checkArguments(Object... params)
Checks arguments and throws exception if there is an issue
|
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 |
echo(String path)
attach a base 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 |
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 |
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 |
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)
|
protected void |
writeToMap(Map map,
Object... params)
write key/value pairs into a map
|
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)
PipeBuilderpipe in interface PipeBuildertype - resource type (should be registered by the plumber)protected PipeBuilder pipeWithExpr(String type, String expr)
type - pipe typeexpr - expressionpublic PipeBuilder mv(String expr)
PipeBuildermv in interface PipeBuilderexpr - target of the resource to movepublic PipeBuilder write(Object... conf) throws IllegalAccessException
PipeBuilderwrite in interface PipeBuilderconf - configuration parametersIllegalAccessException - in case it's called with bad configurationpublic PipeBuilder grep(Object... conf) throws IllegalAccessException
PipeBuildergrep in interface PipeBuilderconf - configuration parametersIllegalAccessException - in case it's called with bad configurationpublic PipeBuilder auth(Object... conf) throws IllegalAccessException
PipeBuilderauth in interface PipeBuilderconf - configuration key value pairs for authorizable (see pipe's doc)IllegalAccessException - in case it's called with bad configurationpublic PipeBuilder xpath(String expr)
PipeBuilderxpath in interface PipeBuilderexpr - xpath expressionpublic PipeBuilder children(String expr)
PipeBuilderchildren in interface PipeBuilderexpr - sling query expressionpublic PipeBuilder rm()
PipeBuilderrm in interface PipeBuilderpublic PipeBuilder traverse()
PipeBuildertraverse in interface PipeBuilderpublic PipeBuilder csv(String expr)
PipeBuildercsv in interface PipeBuilderexpr - csv expr or URL or path in the resource treepublic PipeBuilder json(String expr)
PipeBuilderjson in interface PipeBuilderexpr - json expr or URL or path in the resource treepublic PipeBuilder mkdir(String expr)
PipeBuildermkdir in interface PipeBuilderexpr - path to createpublic PipeBuilder echo(String path)
PipeBuilderecho in interface PipeBuilderpath - pipe pathpublic PipeBuilder parent()
PipeBuilderparent in interface PipeBuilderpublic PipeBuilder parents(String expr)
PipeBuilderparents in interface PipeBuilderexpr - expressionpublic PipeBuilder siblings(String expr)
PipeBuildersiblings in interface PipeBuilderexpr - sling query expressionpublic PipeBuilder closest(String expr)
PipeBuilderclosest in interface PipeBuilderexpr - expressionpublic PipeBuilder $(String expr)
PipeBuilder$ in interface PipeBuilderexpr - expressionpublic PipeBuilder ref(String expr)
PipeBuilderref in interface PipeBuilderexpr - referencepublic PipeBuilder not(String expr)
PipeBuildernot in interface PipeBuilderexpr - referencepublic PipeBuilder with(Object... params) throws IllegalAccessException
PipeBuilderwith in interface PipeBuilderparams - key value pair of parametersIllegalAccessException - in case it's called with wrong # of argumentspublic PipeBuilder conf(Object... properties) throws IllegalAccessException
PipeBuilderconf in interface PipeBuilderproperties - configuration key value pairs (must be an even number of arguments)IllegalAccessException - in case it's called in a bad timeprotected void checkArguments(Object... params) throws IllegalArgumentException
params - arguments to checkIllegalArgumentException - exception thrown in case arguments are wrongprotected void writeToMap(Map map, Object... params)
map - target mapparams - key/value pairs to write into the mapprotected 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
PipeBuilderexpr in interface PipeBuildervalue - expression valueIllegalAccessException - in case it's called in a bad timepublic PipeBuilder path(String value) throws IllegalAccessException
PipeBuilderpath in interface PipeBuildervalue - path valueIllegalAccessException - in case it's called before a pipe is configuredpublic PipeBuilder name(String name) throws IllegalAccessException
PipeBuildername in interface PipeBuildername - 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)
PipeBuilderoutputs in interface PipeBuilderkeys - properties of the outputs resource to outputpublic Pipe build() throws org.apache.sling.api.resource.PersistenceException
PipeBuilder/var/pipesbuild in interface PipeBuilderorg.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
PipeBuilderpathbuild in interface PipeBuilderpath - 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
PipeBuilderrun in interface PipeBuilderException - exceptions thrown by the build or the pipe execution itselfpublic ExecutionResult runWith(Object... bindings) throws Exception
PipeBuilderrunWith in interface PipeBuilderbindings - additional bindings, should be key/value formatException - in case something goes wrong with pipe executionpublic ExecutionResult run(Map bindings) throws Exception
PipeBuilderrun in interface PipeBuilderbindings - 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
PipeBuilderrunAsync in interface PipeBuilderbindings - additional bindings for the execution (can be null)org.apache.sling.api.resource.PersistenceException - in case something goes wrong in the job creationCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.