[DMAAP-48] Initial code import
[dmaap/datarouter.git] / datarouter-node / src / main / java / com / att / research / datarouter / node / DeliveryTaskHelper.java
diff --git a/datarouter-node/src/main/java/com/att/research/datarouter/node/DeliveryTaskHelper.java b/datarouter-node/src/main/java/com/att/research/datarouter/node/DeliveryTaskHelper.java
new file mode 100644 (file)
index 0000000..702bb29
--- /dev/null
@@ -0,0 +1,72 @@
+/*******************************************************************************\r
+ * ============LICENSE_START==================================================\r
+ * * org.onap.dmaap\r
+ * * ===========================================================================\r
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
+ * * ===========================================================================\r
+ * * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * * you may not use this file except in compliance with the License.\r
+ * * You may obtain a copy of the License at\r
+ * * \r
+ *  *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * * \r
+ *  * Unless required by applicable law or agreed to in writing, software\r
+ * * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * * See the License for the specific language governing permissions and\r
+ * * limitations under the License.\r
+ * * ============LICENSE_END====================================================\r
+ * *\r
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ * *\r
+ ******************************************************************************/\r
+\r
+\r
+package com.att.research.datarouter.node;\r
+\r
+/**\r
+ *     Interface to allow independent testing of the DeliveryTask code.\r
+ *     <p>\r
+ *     This interface represents all the configuraiton information and\r
+ *     feedback mechanisms that a delivery task needs.\r
+ */\r
+\r
+public interface DeliveryTaskHelper    {\r
+       /**\r
+        *      Report that a delivery attempt failed due to an exception (like can't connect to remote host)\r
+        *      @param task     The task that failed\r
+        *      @param exception        The exception that occurred\r
+        */\r
+       public void reportException(DeliveryTask task, Exception exception);\r
+       /**\r
+        *      Report that a delivery attempt completed (successfully or unsuccessfully)\r
+        *      @param task     The task that failed\r
+        *      @param status   The HTTP status\r
+        *      @param xpubid   The publish ID from the far end (if any)\r
+        *      @param location The redirection location for a 3XX response\r
+        */\r
+       public void reportStatus(DeliveryTask task, int status, String xpubid, String location);\r
+       /**\r
+        *      Report that a delivery attempt either failed while sending data or that an error was returned instead of a 100 Continue.\r
+        *      @param task     The task that failed\r
+        *      @param sent     The number of bytes sent or -1 if an error was returned instead of 100 Continue.\r
+        */\r
+       public void reportDeliveryExtra(DeliveryTask task, long sent);\r
+       /**\r
+        *      Get the destination information for the delivery queue\r
+        *      @return The destination information\r
+        */\r
+       public DestInfo getDestInfo();\r
+       /**\r
+        *      Given a file ID, get the URL to deliver to\r
+        *      @param fileid   The file id\r
+        *      @return The URL to deliver to\r
+        */\r
+       public String   getDestURL(String fileid);\r
+       /**\r
+        *      Get the feed ID for a subscription\r
+        *      @param subid    The subscription ID\r
+        *      @return The feed iD\r
+        */\r
+       public String   getFeedId(String subid);\r
+}\r