public class PlumberImpl extends Object implements Plumber, org.apache.sling.event.jobs.consumer.JobConsumer, PlumberMXBean
| Modifier and Type | Class and Description |
|---|---|
static interface |
PlumberImpl.Configuration |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
protected org.apache.sling.distribution.Distributor |
distributor |
protected static String |
MBEAN_NAME_FORMAT |
protected static String |
MONITORED_PIPES_QUERY |
protected static String |
PN_MONITORED |
static String |
SLING_EVENT_TOPIC |
RESOURCE_TYPE| Constructor and Description |
|---|
PlumberImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
activate(PlumberImpl.Configuration configuration) |
void |
deactivate() |
ExecutionResult |
execute(org.apache.sling.api.resource.ResourceResolver resolver,
Pipe pipe,
Map additionalBindings,
OutputWriter writer,
boolean save)
Executes a given pipe
|
ExecutionResult |
execute(org.apache.sling.api.resource.ResourceResolver resolver,
String path,
Map additionalBindings,
OutputWriter writer,
boolean save)
Executes a pipe at a certain path
|
org.apache.sling.event.jobs.Job |
executeAsync(org.apache.sling.api.resource.ResourceResolver resolver,
String path,
Map bindings)
executes in a background thread
|
org.apache.sling.event.jobs.Job |
executeAsync(String path,
Map bindings)
executes in a background thread
|
protected Collection<PipeMonitor> |
getMonitoredPipes() |
Pipe |
getPipe(org.apache.sling.api.resource.Resource resource)
Instantiate a pipe from the given resource and returns it
|
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
|
PipeBuilder |
newPipe(org.apache.sling.api.resource.ResourceResolver resolver)
Provides a builder helping quickly build and execute a pipe
|
protected void |
persist(org.apache.sling.api.resource.ResourceResolver resolver,
Pipe pipe,
ExecutionResult result,
org.apache.sling.api.resource.Resource currentResource)
Persists pipe change if big enough, or ended, and eventually distribute changes
|
org.apache.sling.event.jobs.consumer.JobConsumer.JobResult |
process(org.apache.sling.event.jobs.Job job) |
void |
refreshMonitoredPipes() |
void |
registerPipe(String type,
Class<? extends BasePipe> pipeClass)
Registers
|
protected void |
writeStatus(Pipe pipe,
String status)
writes the status of the pipe, also update
PN_STATUS_MODIFIED date |
public static final int DEFAULT_BUFFER_SIZE
protected static final String PN_MONITORED
protected static final String MONITORED_PIPES_QUERY
protected static final String MBEAN_NAME_FORMAT
public static final String SLING_EVENT_TOPIC
protected volatile org.apache.sling.distribution.Distributor distributor
public void activate(PlumberImpl.Configuration configuration)
public void deactivate()
public Pipe getPipe(org.apache.sling.api.resource.Resource resource)
Plumberpublic org.apache.sling.event.jobs.Job executeAsync(org.apache.sling.api.resource.ResourceResolver resolver,
String path,
Map bindings)
PlumberexecuteAsync in interface Plumberresolver - 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 executingpublic org.apache.sling.event.jobs.Job executeAsync(String path, Map bindings)
PlumberexecuteAsync in interface Plumberpath - path of the pipe to executebindings - additional bindings to use when executingpublic ExecutionResult execute(org.apache.sling.api.resource.ResourceResolver resolver, String path, Map additionalBindings, OutputWriter writer, boolean save) throws Exception
Plumberexecute in interface Plumberresolver - resource resolver with which pipe will be executedpath - path of a valid pipe configurationadditionalBindings - 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 notExecutionResultException - in case execution failspublic ExecutionResult execute(org.apache.sling.api.resource.ResourceResolver resolver, Pipe pipe, Map additionalBindings, OutputWriter writer, boolean save) throws Exception
Plumberexecute in interface Plumberresolver - resource resolver with which pipe will be executedpipe - pipe to executeadditionalBindings - 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 notExecutionResultException - in case execution failsprotected void persist(org.apache.sling.api.resource.ResourceResolver resolver,
Pipe pipe,
ExecutionResult result,
org.apache.sling.api.resource.Resource currentResource)
throws Exception
resolver - resolver to usepipe - pipe at the origin of the changes,result - execution result object,currentResource - if running, null if endedorg.apache.sling.api.resource.PersistenceException - in case save failsExceptionpublic void registerPipe(String type, Class<? extends BasePipe> pipeClass)
PlumberregisterPipe in interface Plumbertype - resource type of the pipe to registerpipeClass - class of the pipe to registerpublic boolean isTypeRegistered(String type)
PlumberisTypeRegistered in interface Plumbertype - resource type testedprotected void writeStatus(Pipe pipe, String status) throws javax.jcr.RepositoryException
PN_STATUS_MODIFIED datepipe - target pipestatus - status to writejavax.jcr.RepositoryException - in case write goes wrongpublic String getStatus(org.apache.sling.api.resource.Resource pipeResource)
Plumberpublic PipeBuilder newPipe(org.apache.sling.api.resource.ResourceResolver resolver)
Plumberpublic boolean isRunning(org.apache.sling.api.resource.Resource pipeResource)
Plumberpublic org.apache.sling.event.jobs.consumer.JobConsumer.JobResult process(org.apache.sling.event.jobs.Job job)
process in interface org.apache.sling.event.jobs.consumer.JobConsumerpublic void refreshMonitoredPipes()
refreshMonitoredPipes in interface PlumberMXBeanprotected Collection<PipeMonitor> getMonitoredPipes()
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.