[DMAAP-DR] Remove cadi/aaf from dr-node
[dmaap/datarouter.git] / datarouter-node / src / main / java / org / onap / dmaap / datarouter / node / delivery / DeliveryTaskHelper.java
1 /*******************************************************************************
2  * ============LICENSE_START==================================================
3  * * org.onap.dmaap
4  * * ===========================================================================
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * * ===========================================================================
7  * * Licensed under the Apache License, Version 2.0 (the "License");
8  * * you may not use this file except in compliance with the License.
9  * * You may obtain a copy of the License at
10  * *
11  *  *      http://www.apache.org/licenses/LICENSE-2.0
12  * *
13  *  * Unless required by applicable law or agreed to in writing, software
14  * * distributed under the License is distributed on an "AS IS" BASIS,
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * * See the License for the specific language governing permissions and
17  * * limitations under the License.
18  * * ============LICENSE_END====================================================
19  * *
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21  * *
22  ******************************************************************************/
23
24
25 package org.onap.dmaap.datarouter.node.delivery;
26
27 import org.onap.dmaap.datarouter.node.DestInfo;
28
29 /**
30  * Interface to allow independent testing of the DeliveryTask code.
31  *
32  * <p>This interface represents all the configuraiton information and feedback mechanisms that a delivery task needs.
33  */
34
35 public interface DeliveryTaskHelper {
36
37     /**
38      * Report that a delivery attempt failed due to an exception (like can't connect to remote host).
39      *
40      * @param task The task that failed
41      * @param exception The exception that occurred
42      */
43     void reportException(DeliveryTask task, Exception exception);
44
45     /**
46      * Report that a delivery attempt completed (successfully or unsuccessfully).
47      *
48      * @param task The task that failed
49      * @param status The HTTP status
50      * @param xpubid The publish ID from the far end (if any)
51      * @param location The redirection location for a 3XX response
52      */
53     void reportStatus(DeliveryTask task, int status, String xpubid, String location);
54
55     /**
56      * Report that a delivery attempt either failed while sending data or that an error was returned instead of a 100
57      * Continue.
58      *
59      * @param task The task that failed
60      * @param sent The number of bytes sent or -1 if an error was returned instead of 100 Continue.
61      */
62     void reportDeliveryExtra(DeliveryTask task, long sent);
63
64     /**
65      * Get the destination information for the delivery queue.
66      *
67      * @return The destination information
68      */
69     DestInfo getDestinationInfo();
70
71     /**
72      * Given a file ID, get the URL to deliver to.
73      *
74      * @param fileid The file id
75      * @return The URL to deliver to
76      */
77     String getDestURL(String fileid);
78
79     /**
80      * Get the feed ID for a subscription.
81      *
82      * @param subid The subscription ID
83      * @return The feed iD
84      */
85     String getFeedId(String subid);
86 }