This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.distribution.api-0.1.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-api.git
commit 40c480440f2d62e451f0a0d9c7d039065efe71a9 Author: Marius Petria <[email protected]> AuthorDate: Fri Dec 5 09:55:53 2014 +0000 SLING-3836: adding shallow distribution option to requests git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/distribution/api@1643219 13f79535-47bb-0310-9956-ffa450edef68 --- .../communication/DistributionParameter.java | 3 +- .../communication/DistributionRequest.java | 40 ++++++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/sling/distribution/communication/DistributionParameter.java b/src/main/java/org/apache/sling/distribution/communication/DistributionParameter.java index 9ff292b..38bf2e5 100644 --- a/src/main/java/org/apache/sling/distribution/communication/DistributionParameter.java +++ b/src/main/java/org/apache/sling/distribution/communication/DistributionParameter.java @@ -26,7 +26,8 @@ public enum DistributionParameter { QUEUE("queue"), TYPE("type"), ACTION("action"), - PATH("path"); + PATH("path"), + DEEP("deep"); private final String name; diff --git a/src/main/java/org/apache/sling/distribution/communication/DistributionRequest.java b/src/main/java/org/apache/sling/distribution/communication/DistributionRequest.java index 0792999..107139a 100644 --- a/src/main/java/org/apache/sling/distribution/communication/DistributionRequest.java +++ b/src/main/java/org/apache/sling/distribution/communication/DistributionRequest.java @@ -28,22 +28,39 @@ import java.util.Arrays; public final class DistributionRequest { - private final DistributionRequestType actionType; + private final DistributionRequestType requestType; + private final boolean deep; private final String[] paths; - public DistributionRequest(@Nonnull DistributionRequestType actionType, @Nonnull String... paths) { - this.actionType = actionType; + /** + * Creates distribution request with "deep" or "shallow" paths. + * @param requestType the request type + * @param isDeep is <code>true</code> if all paths are "deep" and is <code>false</code> if all paths are "shallow" + * @param paths the array of paths to be distributed + */ + public DistributionRequest(@Nonnull DistributionRequestType requestType, boolean isDeep, @Nonnull String... paths) { + this.requestType = requestType; + deep = isDeep; this.paths = paths; } /** + * Creates a distribution request with "shallow" paths. + * @param requestType the request type + * @param paths the array of paths to be distributed + */ + public DistributionRequest(@Nonnull DistributionRequestType requestType, @Nonnull String... paths) { + this(requestType, false, paths); + } + + /** * get the {@link DistributionRequestType} associated with this request * - * @return the type of actionType for request as a {@link DistributionRequestType} + * @return the type of the request as a {@link DistributionRequestType} */ public DistributionRequestType getRequestType() { - return actionType; + return requestType; } /** @@ -55,11 +72,22 @@ public final class DistributionRequest { return paths; } + + /** + * Returns whether the paths are covering the entire subtree (deep) or just the specified nodes (shallow) + * @return <code>true</code> if the paths are deep + */ + public boolean isDeep() { + return deep; + } + @Override public String toString() { return "DistributionRequest{" + - "actionType=" + actionType + + ", requestType=" + requestType + ", paths=" + Arrays.toString(paths) + '}'; } + + } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
