Package org.apache.sling.pipes

## Interface Plumber

    @ProviderType
    public interface Plumber

Plumber is an osgi service aiming to make pipes available to the sling system, in order to

### Method Summary

All Methods Instance Methods Abstract Methods
`boolean` `allowAdditionalScripts()`
`Object` `evaluate​(String expr, Bindings bindings)` evaluates a given expression with internal embedded engine
`ExecutionResult` `execute​(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,​Object> bindings, OutputWriter writer, boolean save)` Executes a pipe at a certain path
`ExecutionResult` `execute​(org.apache.sling.api.resource.ResourceResolver resolver, Pipe pipe, Map<String,​Object> bindings, OutputWriter writer, boolean save)` Executes a given pipe
`org.apache.sling.event.jobs.Job` `executeAsync​(String path, Map<String,​Object> bindings)` executes in a background thread
`org.apache.sling.event.jobs.Job` `executeAsync​(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,​Object> bindings)` executes in a background thread
`String` `generateUniquePath()`
`Map<String,​Object>` `getBindingsFromRequest​(org.apache.sling.api.SlingHttpServletRequest request, boolean writeAllowed)` Extract pipe bindings from the request
`Map` `getContextAwareConfigurationMap​(org.apache.sling.api.resource.Resource currentResource)`
`Pipe` `getPipe​(org.apache.sling.api.resource.Resource resource)` Instantiate a pipe from the given resource and returns it
`Pipe` `getPipe​(org.apache.sling.api.resource.Resource resource, PipeBindings upperBindings)` Instantiate a pipe from the given resource and returns it
`@Nullable org.apache.sling.api.resource.Resource` `getReferencedResource​(org.apache.sling.api.resource.Resource referrer, String reference)`
`Map<String,​Object>` `getServiceUser()`
`String` `getStatus​(org.apache.sling.api.resource.Resource pipeResource)` status of the pipe
`boolean` `isRunning​(org.apache.sling.api.resource.Resource pipeResource)` returns true if the pipe is considered to be running
`boolean` `isTypeRegistered​(String type)` returns wether or not a pipe type is registered
`void` `markWithJcrLastModified​(@NotNull Pipe pipe, @NotNull org.apache.sling.api.resource.Resource resource)` marks a given resource as updated
`PipeBuilder` `newPipe​(org.apache.sling.api.resource.ResourceResolver resolver)` Provides a builder helping quickly build and execute a pipe
`void` `registerPipe​(String type, Class<? extends BasePipe> pipeClass)` Registers

### Method Detail

#### getPipe

    Pipe getPipe​(org.apache.sling.api.resource.Resource resource)

Instantiate a pipe from the given resource and returns it

Parameters:
  `resource` - configuration resource
Returns:
  pipe instantiated from the resource, null otherwise

#### getPipe

    Pipe getPipe​(org.apache.sling.api.resource.Resource resource,
                 PipeBindings upperBindings)

Instantiate a pipe from the given resource and returns it

Parameters:
  `resource` - configuration resource
  `upperBindings` - already set binding we want to initiate our pipe with
Returns:
  pipe instantiated from the resource, null otherwise

#### executeAsync

    org.apache.sling.event.jobs.Job executeAsync​(org.apache.sling.api.resource.ResourceResolver resolver,
                                                 String path,
                                                 Map<String,​Object> bindings)

executes in a background thread

Parameters:
  `resolver` - resolver used for registering the execution (id will be checked against the configuration)
  `path` - path of the pipe to execute
  `bindings` - additional bindings to use when executing
Returns:
  Job if registered, null otherwise

#### executeAsync

    org.apache.sling.event.jobs.Job executeAsync​(String path,
                                                 Map<String,​Object> bindings)

executes in a background thread

Parameters:
  `path` - path of the pipe to execute
  `bindings` - additional bindings to use when executing
Returns:
  Job if registered, null otherwise

#### execute

    ExecutionResult execute​(org.apache.sling.api.resource.ResourceResolver resolver,
                            String path,
                            Map<String,​Object> bindings,
                            OutputWriter writer,
                            boolean save)

Executes a pipe at a certain path

Parameters:
  `resolver` - resource resolver with which pipe will be executed
  `path` - path of a valid pipe configuration
  `bindings` - bindings to add to the execution of the pipe, can be null
  `writer` - output of the pipe
  `save` - in case that pipe writes anything, wether the plumber should save changes or not
Returns:
  instance of `ExecutionResult`

#### execute

    ExecutionResult execute​(org.apache.sling.api.resource.ResourceResolver resolver,
                            Pipe pipe,
                            Map<String,​Object> bindings,
                            OutputWriter writer,
                            boolean save)

Executes a given pipe

Parameters:
  `resolver` - resource resolver with which pipe will be executed
  `pipe` - pipe to execute
  `bindings` - bindings to add to the execution of the pipe, can be null
  `writer` - output of the pipe
  `save` - in case that pipe writes anything, wether the plumber should save changes or not
Returns:
  instance of `ExecutionResult`

#### registerPipe

    void registerPipe​(String type,
                      Class<? extends BasePipe> pipeClass)

Registers

Parameters:
  `type` - resource type of the pipe to register
  `pipeClass` - class of the pipe to register

#### isTypeRegistered

    boolean isTypeRegistered​(String type)

returns wether or not a pipe type is registered

Parameters:
  `type` - resource type tested
Returns:
  true if the type is registered, false if not

#### getStatus

    String getStatus​(org.apache.sling.api.resource.Resource pipeResource)

status of the pipe

Parameters:
  `pipeResource` - resource corresponding to the pipe
Returns:
  status of the pipe, can be blank, 'started' or 'finished'

#### newPipe

    PipeBuilder newPipe​(org.apache.sling.api.resource.ResourceResolver resolver)

Provides a builder helping quickly build and execute a pipe

Parameters:
  `resolver` - resource resolver that will be used for building the pipe
Returns:
  instance of PipeBuilder

#### isRunning

    boolean isRunning​(org.apache.sling.api.resource.Resource pipeResource)

returns true if the pipe is considered to be running

Parameters:
  `pipeResource` - resource corresponding to the pipe
Returns:
  true if still running

#### getBindingsFromRequest

    Map<String,​Object> getBindingsFromRequest​(org.apache.sling.api.SlingHttpServletRequest request,
                                                    boolean writeAllowed)
                                             throws IOException

Extract pipe bindings from the request

Parameters:
  `request` - from where to extract bindings
  `writeAllowed` - should we consider this execution is about to modify content
Returns:
  map of bindings
Throws:
  `IOException` - in case something turns wrong with an input stream

#### getServiceUser

    Map<String,​Object> getServiceUser()

Returns:
  service user that has been configured for executing pipes;

#### getContextAwareConfigurationMap

    Map getContextAwareConfigurationMap​(org.apache.sling.api.resource.Resource currentResource)

Parameters:
  `currentResource` -
Returns:
  context aware configuration map

#### getReferencedResource

    @Nullable
    @Nullable org.apache.sling.api.resource.Resource getReferencedResource​(org.apache.sling.api.resource.Resource referrer,
                                                                           String reference)

Parameters:
  `referrer` - resource from which is made the fetch
  `reference` - reference we are searching a resource for (assuming this is *not* a full path already)
Returns:
  referenced resource, null otherwise

#### markWithJcrLastModified

    void markWithJcrLastModified​(@NotNull
                                 @NotNull Pipe pipe,
                                 @NotNull
                                 @NotNull org.apache.sling.api.resource.Resource resource)

marks a given resource as updated

Parameters:
  `resource` - resource to mark

#### generateUniquePath

    String generateUniquePath()

#### evaluate

    Object evaluate​(String expr,
                    Bindings bindings)

evaluates a given expression with internal embedded engine

Parameters:
  `expr` - expression to evaluate
  `bindings` - context bindings
Returns:
  evaluation result

#### allowAdditionalScripts

    boolean allowAdditionalScripts()

Returns:
  flag indicating wether additional scripts can be executed