Package org.apache.sling.pipes
Interface Plumber
-
@ProviderType public interface PlumberPlumber is an osgi service aiming to make pipes available to the sling system, in order to
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanallowAdditionalScripts()Objectevaluate(String expr, Bindings bindings)evaluates a given expression with internal embedded engineExecutionResultexecute(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,Object> bindings, OutputWriter writer, boolean save)Executes a pipe at a certain pathExecutionResultexecute(org.apache.sling.api.resource.ResourceResolver resolver, Pipe pipe, Map<String,Object> bindings, OutputWriter writer, boolean save)Executes a given pipeorg.apache.sling.event.jobs.JobexecuteAsync(String path, Map<String,Object> bindings)executes in a background threadorg.apache.sling.event.jobs.JobexecuteAsync(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map<String,Object> bindings)executes in a background threadStringgenerateUniquePath()Map<String,Object>getBindingsFromRequest(org.apache.sling.api.SlingHttpServletRequest request, boolean writeAllowed)Extract pipe bindings from the requestMapgetContextAwareConfigurationMap(org.apache.sling.api.resource.Resource currentResource)PipegetPipe(org.apache.sling.api.resource.Resource resource)Instantiate a pipe from the given resource and returns itPipegetPipe(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.ResourcegetReferencedResource(org.apache.sling.api.resource.Resource referrer, String reference)Map<String,Object>getServiceUser()StringgetStatus(org.apache.sling.api.resource.Resource pipeResource)status of the pipebooleanisRunning(org.apache.sling.api.resource.Resource pipeResource)returns true if the pipe is considered to be runningbooleanisTypeRegistered(String type)returns wether or not a pipe type is registeredvoidmarkWithJcrLastModified(@NotNull Pipe pipe, @NotNull org.apache.sling.api.resource.Resource resource)marks a given resource as updatedPipeBuildernewPipe(org.apache.sling.api.resource.ResourceResolver resolver)Provides a builder helping quickly build and execute a pipevoidregisterPipe(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 resourceupperBindings- 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 executebindings- 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 executebindings- 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 executedpath- path of a valid pipe configurationbindings- bindings to add to the execution of the pipe, can be nullwriter- output of the pipesave- 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 executedpipe- pipe to executebindings- bindings to add to the execution of the pipe, can be nullwriter- output of the pipesave- 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 registerpipeClass- 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 bindingswriteAllowed- 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 fetchreference- 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 evaluatebindings- context bindings- Returns:
- evaluation result
-
allowAdditionalScripts
boolean allowAdditionalScripts()
- Returns:
- flag indicating wether additional scripts can be executed
-
-