Author: npeltier
Date: Thu Jul 6 19:38:20 2017
New Revision: 1801100
URL: http://svn.apache.org/viewvc?rev=1801100&view=rev
Log:
Fix javadoc error
Modified:
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/OutputWriter.java
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Pipe.java
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/PipeBuilder.java
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Plumber.java
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberServlet.java
Modified:
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/OutputWriter.java
URL:
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/OutputWriter.java?rev=1801100&r1=1801099&r2=1801100&view=diff
==============================================================================
---
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/OutputWriter.java
(original)
+++
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/OutputWriter.java
Thu Jul 6 19:38:20 2017
@@ -55,7 +55,7 @@ public abstract class OutputWriter {
* @param request request from which writer will output
* @param response response on which writer will output
* @throws IOException error handling streams
- * @throws JSONException in case invalid json is written
+ * @throws JsonException in case invalid json is written
*/
public void init(SlingHttpServletRequest request, SlingHttpServletResponse
response) throws IOException, JsonException {
max = request.getParameter(PARAM_SIZE) != null ?
Integer.parseInt(request.getParameter(PARAM_SIZE)) : NB_MAX;
@@ -70,14 +70,14 @@ public abstract class OutputWriter {
* @param request request from which writer will output
* @param response response on which writer will output
* @throws IOException error handling streams
- * @throws JSONException in case invalid json is written
+ * @throws JsonException in case invalid json is written
*/
protected abstract void initInternal(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws IOException, JsonException;
/**
* Write a given resource
* @param resource resource that will be written
- * @throws JSONException in case write fails
+ * @throws JsonException in case write fails
*/
public void write(Resource resource) throws JsonException {
if (size++ < max) {
@@ -88,20 +88,20 @@ public abstract class OutputWriter {
/**
* Write a given resource
* @param resource resource that will be written
- * @throws JSONException in case write fails
+ * @throws JsonException in case write fails
*/
protected abstract void writeItem(Resource resource) throws JsonException;
/**
* writes the end of the output
- * @throws JSONException in case invalid json is written
+ * @throws JsonException in case invalid json is written
*/
public abstract void ends() throws JsonException;
/**
- *
- * @param pipe
+ * Setter
+ * @param pipe pipe this writer should be associated with
*/
public void setPipe(Pipe pipe) {
this.pipe = pipe;
Modified:
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Pipe.java
URL:
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Pipe.java?rev=1801100&r1=1801099&r2=1801100&view=diff
==============================================================================
---
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Pipe.java
(original)
+++
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Pipe.java
Thu Jul 6 19:38:20 2017
@@ -44,10 +44,13 @@ public interface Pipe {
*/
String NN_CONF = "conf";
+ /**
+ * Distribution agent (for distributing output resources)
+ */
String PN_DISTRIBUTION_AGENT = "distribution.agent";
/**
- * returns true if that pipe will modify content during its execution
+ * returns true if that pipe modifies content during its execution
* @return true for write / false for read
*/
boolean modifiesContent();
@@ -92,7 +95,7 @@ public interface Pipe {
/**
* get the pipe configuration resource
- * @return
+ * @return Pipe configruation root resource
*/
Resource getResource();
Modified:
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/PipeBuilder.java
URL:
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/PipeBuilder.java?rev=1801100&r1=1801099&r2=1801100&view=diff
==============================================================================
---
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/PipeBuilder.java
(original)
+++
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/PipeBuilder.java
Thu Jul 6 19:38:20 2017
@@ -21,138 +21,151 @@ import org.apache.sling.api.resource.Per
import java.util.Set;
/**
- * Builder & Runner of a pipe, based on a fluent API, for script & java usage.
+ * Builder and Runner of a pipe, based on a fluent API, for script and java
usage.
*/
public interface PipeBuilder {
/**
* attach a new pipe to the current context
- * @param type
- * @return
+ * @param type resource type (should be registered by the plumber)
+ * @return updated instance of PipeBuilder
*/
PipeBuilder pipe(String type);
/**
* attach a move pipe to the current context
- * @param expr
- * @return
+ * @param expr target of the resource to move
+ * @return updated instance of PipeBuilder
*/
PipeBuilder mv(String expr);
/**
* attach a write pipe to the current context
* @param conf configuration parameters
- * @return
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder write(Object... conf) throws IllegalAccessException;
/**
* attach a filter pipe to the current context
* @param conf configuration parameters
- * @return
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder filter(Object... conf) throws IllegalAccessException;
/**
* attach an authorizable pipe to the current context
- * @param conf
- * @return
+ * @param conf configuration key value pairs for authorizable (see pipe's
doc)
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder auth(Object... conf) throws IllegalAccessException;
/**
* attach a xpath pipe to the current context
* @param expr xpath expression
- * @return
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder xpath(String expr) throws IllegalAccessException;
/**
* attach a sling query pipe to the current context
* @param expr sling query expression
- * @return
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder $(String expr) throws IllegalAccessException;
/**
* attach a rm pipe to the current context
- * @return
+ * @return updated instance of PipeBuilder
*/
PipeBuilder rm();
/**
* attach a json pipe to the current context
* @param expr json expr or URL
- * @return
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder json(String expr) throws IllegalAccessException;
/**
* Attach a path pipe to the current context
- * @param expr
- * @return
+ * @param expr path to create
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder mkdir(String expr) throws IllegalAccessException;
/**
* attach a base pipe to the current context
* @param path pipe path
- * @return
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder echo(String path) throws IllegalAccessException;
/**
- * attach a new pipe to the current context
- * @return
+ * attach a parent pipe to the current context
+ * @return updated instance of PipeBuilder
*/
PipeBuilder parent();
/**
* parameterized current pipe in the context
- * @param param
- * @param value
- * @return
+ * @param param key (property name) of the property
+ * @param value value of te property
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder with(String param, String value) throws IllegalAccessException;
/**
- * add an expr configuration to the current pipe in the context
- * @param value
- * @return
+ * set an expr configuration to the current pipe in the context
+ * @param value expression value
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder expr(String value) throws IllegalAccessException;
/**
* sets a pipe name, important in case you want to reuse it in another
expression
- * @param name
- * @return
- * @throws IllegalAccessException
+ * @param name to overwrite default binding name (otherwise it will be
"one", "two", ...)
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder name(String name) throws IllegalAccessException;
/**
- * add a path configuration to the current pipe in the context
- * @param value
- * @return
+ * set a path configuration to the current pipe in the context
+ * @param value path value
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder path(String value) throws IllegalAccessException;
/**
* Building up a set of configurations for the current pipe
- * @param properties
- * @return
+ * @param properties configuration key value pairs (must be an even number
of arguments)
+ * @return updated instance of PipeBuilder
+ * @throws IllegalAccessException in case it's called in a bad time
*/
PipeBuilder conf(Object... properties) throws IllegalAccessException;
/**
* builds a configured pipe
- * @return
+ * @return Created (not executed) Pipe instance
+ * @throws PersistenceException error occuring when saving the pipe
configuration
*/
Pipe build() throws PersistenceException;
/**
- * builds & run configured pipe
- * @return
- * @throws Exception
+ * builds and run configured pipe
+ * @return set of resource path, output of the pipe execution
+ * @throws Exception exceptions thrown by the build or the pipe execution
itself
*/
Set<String> run() throws Exception;
}
Modified:
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Plumber.java
URL:
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Plumber.java?rev=1801100&r1=1801099&r2=1801100&view=diff
==============================================================================
---
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Plumber.java
(original)
+++
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/Plumber.java
Thu Jul 6 19:38:20 2017
@@ -40,9 +40,9 @@ public interface Plumber {
/**
* executes in a background thread
- * @param resolver
- * @param path
- * @param bindings
+ * @param resolver resolver used for registering the execution (id will be
checked against the configuration)
+ * @param path path of the pipe to execute
+ * @param bindings additional bindings to use when executing
* @return Job if registered, null otherwise
*/
Job executeAsync(ResourceResolver resolver, String path, Map bindings);
@@ -81,28 +81,29 @@ public interface Plumber {
/**
* returns wether or not a pipe type is registered
- * @param type
- * @return
+ * @param type resource type tested
+ * @return true if the type is registered, false if not
*/
boolean isTypeRegistered(String type);
/**
* status of the pipe
* @param pipeResource resource corresponding to the pipe
- * @return
+ * @return status of the pipe, can be blank, 'started' or 'finished'
*/
String getStatus(Resource pipeResource);
/**
- * Provides a builder helping quickly build & execute a pipe
- * @return
+ * Provides a builder helping quickly build and execute a pipe
+ * @param resolver resource resolver that will be used for building the
pipe
+ * @return instance of PipeBuilder
*/
PipeBuilder getBuilder(ResourceResolver resolver);
/**
* returns true if the pipe is considered to be running
* @param pipeResource resource corresponding to the pipe
- * @return
+ * @return true if still running
*/
boolean isRunning(Resource pipeResource);
}
Modified:
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java
URL:
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java?rev=1801100&r1=1801099&r2=1801100&view=diff
==============================================================================
---
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java
(original)
+++
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PipeBuilderImpl.java
Thu Jul 6 19:38:20 2017
@@ -51,8 +51,8 @@ public class PipeBuilderImpl implements
/**
* protected constructor (to only allow internal classes to build it out)
- * @param resolver
- * @param plumber
+ * @param resolver resolver with which the pipe will be built and executed
+ * @param plumber instance of the plumber
*/
protected PipeBuilderImpl(ResourceResolver resolver, Plumber plumber){
this.plumber = plumber;
@@ -129,7 +129,7 @@ public class PipeBuilderImpl implements
/**
* check of presence of a current step, fails loudly if it's not the case
- * @throws IllegalAccessException
+ * @throws IllegalAccessException exception thrown if current step is not
present
*/
protected void checkCurrentStep() throws IllegalAccessException {
if (currentStep == null){
@@ -175,7 +175,7 @@ public class PipeBuilderImpl implements
/**
* build a time + random based path under /var/pipes
- * @return
+ * @return full path of future Pipe
*/
protected String buildPipePath() {
final Calendar now = Calendar.getInstance();
@@ -204,11 +204,7 @@ public class PipeBuilderImpl implements
return plumber.getPipe(pipeResource);
}
- /**
- * builds & run configured pipe
- * @return
- * @throws Exception
- */
+ @Override
public Set<String> run() throws Exception {
Pipe pipe = this.build();
return plumber.execute(resolver, pipe, null, new NopWriter(), true);
Modified:
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java
URL:
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java?rev=1801100&r1=1801099&r2=1801100&view=diff
==============================================================================
---
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java
(original)
+++
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberImpl.java
Thu Jul 6 19:38:20 2017
@@ -118,7 +118,6 @@ public class PlumberImpl implements Plum
registerPipe(PathPipe.RESOURCE_TYPE, PathPipe.class);
registerPipe(FilterPipe.RESOURCE_TYPE, FilterPipe.class);
registerPipe(NotPipe.RESOURCE_TYPE, NotPipe.class);
-
}
@Reference(policy= ReferencePolicy.DYNAMIC, cardinality=
ReferenceCardinality.OPTIONAL)
@@ -210,11 +209,11 @@ public class PlumberImpl implements Plum
/**
* Persists pipe change if big enough, or ended, and eventually distribute
changes
- * @param resolver
- * @param pipe
- * @param paths
+ * @param resolver resolver to use
+ * @param pipe pipe at the origin of the changes,
+ * @param paths paths that have been changed,
* @param currentResource if running, null if ended
- * @throws PersistenceException
+ * @throws PersistenceException in case save fails
*/
protected void persist(ResourceResolver resolver, Pipe pipe, Set<String>
paths, Resource currentResource) throws Exception {
if (pipe.modifiesContent() && resolver.hasChanges() &&
!pipe.isDryRun()){
@@ -243,9 +242,10 @@ public class PlumberImpl implements Plum
}
/**
- * writes the status of the pipe
- * @param pipe
- * @param status
+ * writes the status of the pipe, also update
<code>PN_STATUS_MODIFIED</code> date
+ * @param pipe target pipe
+ * @param status status to write
+ * @throws RepositoryException in case write goes wrong
*/
protected void writeStatus(Pipe pipe, String status) throws
RepositoryException {
if (StringUtils.isNotBlank(status)){
Modified:
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberServlet.java
URL:
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberServlet.java?rev=1801100&r1=1801099&r2=1801100&view=diff
==============================================================================
---
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberServlet.java
(original)
+++
sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/internal/PlumberServlet.java
Thu Jul 6 19:38:20 2017
@@ -82,6 +82,13 @@ public class PlumberServlet extends Slin
execute(request, response, true);
}
+ /**
+ * Execution of a pipe corresponding to a request
+ * @param request original request
+ * @param response given response
+ * @param writeAllowed should we consider this execution is about to
modify content
+ * @throws ServletException in case something is wrong...
+ */
protected void execute(SlingHttpServletRequest request,
SlingHttpServletResponse response, boolean writeAllowed) throws
ServletException {
String path =
request.getResource().getResourceType().equals(Plumber.RESOURCE_TYPE) ?
request.getParameter(PARAM_PATH) : request.getResource().getPath();
try {
@@ -109,8 +116,9 @@ public class PlumberServlet extends Slin
/**
* Converts request into pipe bindings
- * @param request
- * @return
+ * @param request from where to extract bindings
+ * @param writeAllowed should we consider this execution is about to
modify content
+ * @return map of bindings
*/
protected Map getBindingsFromRequest(SlingHttpServletRequest request,
boolean writeAllowed){
Map bindings = new HashMap<>();
@@ -130,6 +138,14 @@ public class PlumberServlet extends Slin
return bindings;
}
+ /**
+ * Retrieve an output writer depending on the request
+ * @param request original request against which writers will be tested
+ * @param response response writers will point to
+ * @return instance of the created writer
+ * @throws IOException bad handling of I/O streams,
+ * @throws JsonException bad handling of json output
+ */
OutputWriter getWriter(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws IOException, JsonException {
OutputWriter[] candidates = new OutputWriter[]{new CustomJsonWriter(),
new CustomWriter(), new DefaultOutputWriter()};
for (OutputWriter candidate : candidates) {