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 8af85bbbc0be5f14c353432a57edb35c15116a89 Author: Tommaso Teofili <[email protected]> AuthorDate: Mon Nov 24 11:31:15 2014 +0000 SLING-4153 - Queue#remove returns the removed item, Importer#importPackage returns void git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/distribution/api@1641370 13f79535-47bb-0310-9956-ffa450edef68 --- .../distribution/event/DistributionEventType.java | 2 +- .../distribution/packaging/DistributionPackage.java | 3 +-- .../packaging/DistributionPackageExporter.java | 19 ++++++++++++++----- .../packaging/DistributionPackageImporter.java | 5 ++--- .../packaging/DistributionPackageInfo.java | 10 ++++++++++ .../sling/distribution/queue/DistributionQueue.java | 3 ++- .../distribution/queue/DistributionQueueItem.java | 9 +++++++++ 7 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/sling/distribution/event/DistributionEventType.java b/src/main/java/org/apache/sling/distribution/event/DistributionEventType.java index 442bb6e..3042c94 100644 --- a/src/main/java/org/apache/sling/distribution/event/DistributionEventType.java +++ b/src/main/java/org/apache/sling/distribution/event/DistributionEventType.java @@ -66,7 +66,7 @@ public enum DistributionEventType { /** * common event topic base for distribution events */ - public static final String EVENT_TOPIC = "org/apache/sling/distribution/event"; + public static final String EVENT_TOPIC = "org/apache/sling/distribution"; /** * get the event topic for this event type diff --git a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackage.java b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackage.java index 9aca4e8..ec661f2 100644 --- a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackage.java +++ b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackage.java @@ -66,8 +66,7 @@ public interface DistributionPackage { * gets an additional info holder for this package. * The additional info object contains control information rather than content information. * For example info.origin can be used to skip distributing back to the originating endpoint. - * It should not be be serialized between instances as its main purpose is to allow - * inter component communication on the same instance. + * * @return the associated metadata to this package */ @Nonnull diff --git a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageExporter.java b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageExporter.java index 25ec006..8525abf 100644 --- a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageExporter.java +++ b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageExporter.java @@ -32,6 +32,10 @@ import org.apache.sling.distribution.component.DistributionComponent; * A {@link DistributionPackageExporter ) is responsible of exporting * {@link DistributionPackage }s to be then imported by a {@link org.apache.sling.distribution.agent.DistributionAgent } * (via a {@link DistributionPackageImporter }). + * <p/> + * Exporting a {@link org.apache.sling.distribution.packaging.DistributionPackage} means obtaining that package by either + * directly creating it by bundling local Sling resources together or retrieving it from a remote endpoint, e.g. by + * executing an HTTP request to another Sling instance exposing already created packages (for remotely changed resources). */ @ConsumerType public interface DistributionPackageExporter extends DistributionComponent { @@ -40,18 +44,23 @@ public interface DistributionPackageExporter extends DistributionComponent { * Exports the {@link DistributionPackage}s built from the * passed {@link org.apache.sling.distribution.communication.DistributionRequest}. * - * @param resourceResolver - the resource resolver used to export the packages - * @param distributionRequest - the request containing the information about which content is to be exported + * @param resourceResolver - the resource resolver used to export the packages, for example a 'local' exporter + * will use the resource resolver to read the content and assemble the binary in a certain + * location in the repository while a 'remote' exporter will use the resolver just to + * store the binary of the remotely fetched packages in the repository. + * @param distributionRequest - the request containing the needed information for content to be exported * @return a {@link java.util.List} of {@link DistributionPackage}s */ @Nonnull List<DistributionPackage> exportPackages(@Nonnull ResourceResolver resourceResolver, @Nonnull DistributionRequest distributionRequest) throws DistributionPackageExportException; /** - * Retrieves a {@link DistributionPackage} given its 'id', if it already exists. + * Retrieves a {@link DistributionPackage} given its identifier, if it already exists. + * This will be used for example to get already created (and cached) packages that were not yet distributed to the + * target instance. * - * @param resourceResolver - the resource resolver use to obtain the package. - * @param distributionPackageId - the id of the package to be retrieved + * @param resourceResolver - the resource resolver use to obtain the package. + * @param distributionPackageId - the {@link DistributionPackage#getId() id of the package} to be retrieved * @return a {@link DistributionPackage} if available, {@code null} otherwise */ @CheckForNull diff --git a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageImporter.java b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageImporter.java index 9dfafba..46b4092 100644 --- a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageImporter.java +++ b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageImporter.java @@ -36,12 +36,11 @@ public interface DistributionPackageImporter extends DistributionComponent { /** * Imports the given distribution package into the underlying system * - * @param resourceResolver - the resource resolver used to import the resources + * @param resourceResolver - the resource resolver used to import the resources * @param distributionPackage - the package to be imported - * @return {@code true} if the import succeeded, {@code false} otherwise * @throws DistributionPackageImportException if any error occurs during import */ - boolean importPackage(@Nonnull ResourceResolver resourceResolver, @Nonnull DistributionPackage distributionPackage) throws DistributionPackageImportException; + void importPackage(@Nonnull ResourceResolver resourceResolver, @Nonnull DistributionPackage distributionPackage) throws DistributionPackageImportException; /** * Tries to convert an {@link java.io.InputStream} to a {@link DistributionPackage} and then imports it into the underlying system diff --git a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageInfo.java b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageInfo.java index 31d62ea..c5b55ee 100644 --- a/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageInfo.java +++ b/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageInfo.java @@ -20,6 +20,7 @@ package org.apache.sling.distribution.packaging; import javax.annotation.CheckForNull; import java.net.URI; +import java.util.Arrays; import org.apache.sling.distribution.communication.DistributionRequestType; @@ -102,4 +103,13 @@ public final class DistributionPackageInfo { this.setRequestType(packageInfo.getRequestType()); } } + + @Override + public String toString() { + return "DistributionPackageInfo{" + + "origin=" + origin + + ", requestType=" + requestType + + ", paths=" + Arrays.toString(paths) + + '}'; + } } diff --git a/src/main/java/org/apache/sling/distribution/queue/DistributionQueue.java b/src/main/java/org/apache/sling/distribution/queue/DistributionQueue.java index 7e62c1c..62bd838 100644 --- a/src/main/java/org/apache/sling/distribution/queue/DistributionQueue.java +++ b/src/main/java/org/apache/sling/distribution/queue/DistributionQueue.java @@ -87,6 +87,7 @@ public interface DistributionQueue { * remove an item from the queue by specifying its id * * @param id an item's identifier + * @return the removed item, or {@code null} if no item could be removed */ - void remove(@Nonnull String id); + DistributionQueueItem remove(@Nonnull String id); } diff --git a/src/main/java/org/apache/sling/distribution/queue/DistributionQueueItem.java b/src/main/java/org/apache/sling/distribution/queue/DistributionQueueItem.java index f9cacf3..bca8db9 100644 --- a/src/main/java/org/apache/sling/distribution/queue/DistributionQueueItem.java +++ b/src/main/java/org/apache/sling/distribution/queue/DistributionQueueItem.java @@ -57,4 +57,13 @@ public class DistributionQueueItem { public DistributionPackageInfo getPackageInfo() { return packageInfo; } + + @Override + public String toString() { + return "DistributionQueueItem{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", packageInfo=" + packageInfo + + '}'; + } } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
