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 c2e9e7a75bd7c939e3501cf55b9024cab5e2053a
Author: Marius Petria <[email protected]>
AuthorDate: Mon Dec 15 12:16:35 2014 +0000

    SLING-4153: changing distribution response to a provider interface
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/distribution/api@1645630
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../communication/DistributionRequest.java         |  8 +++-
 .../communication/DistributionResponse.java        | 52 ++++++++++++----------
 2 files changed, 36 insertions(+), 24 deletions(-)

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 331803c..3bb64d2 100644
--- 
a/src/main/java/org/apache/sling/distribution/communication/DistributionRequest.java
+++ 
b/src/main/java/org/apache/sling/distribution/communication/DistributionRequest.java
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.distribution.communication;
 
+import aQute.bnd.annotation.ProviderType;
+
+import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import java.util.Arrays;
 
@@ -25,6 +28,7 @@ import java.util.Arrays;
  * A {@link org.apache.sling.distribution.communication.DistributionRequest} 
represents the need from the caller to have
  * some content being distributed from a source instance to a target instance.
  */
+@ProviderType
 public interface DistributionRequest {
 
 
@@ -33,6 +37,7 @@ public interface DistributionRequest {
      *
      * @return the type of the request as a {@link DistributionRequestType}
      */
+    @Nonnull
     public DistributionRequestType getRequestType();
 
     /**
@@ -40,6 +45,7 @@ public interface DistributionRequest {
      *
      * @return an array of paths
      */
+    @CheckForNull
     public String[] getPaths();
 
 
@@ -49,7 +55,7 @@ public interface DistributionRequest {
      * @param path the path to be checked
      * @return <code>true</code> if the paths are deep
      */
-    public boolean isDeep(String path);
+    public boolean isDeep(@Nonnull String path);
 
 
 }
diff --git 
a/src/main/java/org/apache/sling/distribution/communication/DistributionResponse.java
 
b/src/main/java/org/apache/sling/distribution/communication/DistributionResponse.java
index 3282e48..44c35a5 100644
--- 
a/src/main/java/org/apache/sling/distribution/communication/DistributionResponse.java
+++ 
b/src/main/java/org/apache/sling/distribution/communication/DistributionResponse.java
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.distribution.communication;
 
+import aQute.bnd.annotation.ProviderType;
+
+import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
@@ -28,27 +31,30 @@ import javax.annotation.Nullable;
  * the {@link org.apache.sling.distribution.communication.DistributionRequest 
request} and optionally a message for more
  * verbose information about the outcome of the request.
  */
-public class DistributionResponse {
-
-    private final DistributionRequestState state;
-    private final String message;
-
-    public DistributionResponse(@Nonnull DistributionRequestState state, 
@Nullable String message) {
-        this.state = state;
-        this.message = message;
-    }
-
-    public DistributionRequestState getState() {
-        return state;
-    }
-
-    public String getMessage() {
-        return message != null ? message : "";
-    }
-
-    @Override
-    public String toString() {
-        return "{\"state\":" + state + ", \"message\":\"" + message + "\"}";
-    }
-
+@ProviderType
+public interface DistributionResponse {
+
+    /**
+     * returns the status of the request, whether it is successful or not.
+     * A successful request it is not necessarily distributed, it is just 
successfully received by the agent.
+     * To check the exact state of the request one can retrieve it with 
<code>getState</code>
+     *
+     * @return <code>true</code> if request has been accepted by the agent.
+     */
+    boolean isSuccessful();
+
+    /**
+     * returns the state of the associated {@link DistributionRequest}
+     *
+     * @return the state of the associated request
+     */
+    @Nonnull
+    DistributionRequestState getState();
+
+    /**
+     * returns a verbose message of the response
+     * @return
+     */
+    @CheckForNull
+    String getMessage();
 }

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to