Merge "Unit test base"
[dmaap/datarouter.git] / datarouter-node / src / main / java / org / onap / dmaap / datarouter / node / DestInfo.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;
26
27 /**
28  * Information for a delivery destination that doesn't change from message to message
29  */
30 public class DestInfo {
31     private String name;
32     private String spool;
33     private String subid;
34     private String logdata;
35     private String url;
36     private String authuser;
37     private String authentication;
38     private boolean metaonly;
39     private boolean use100;
40
41     /**
42      * Create a destination information object.
43      *
44      * @param    name    n:fqdn or s:subid
45      * @param    spool    The directory where files are spooled.
46      * @param    subid    The subscription ID (if applicable).
47      * @param    logdata    Text to be included in log messages
48      * @param    url    The URL to deliver to.
49      * @param    authuser    The auth user for logging.
50      * @param    authentication    The credentials.
51      * @param    metaonly    Is this a metadata only delivery?
52      * @param    use100    Should I use expect 100-continue?
53      */
54     public DestInfo(String name, String spool, String subid, String logdata, String url, String authuser, String authentication, boolean metaonly, boolean use100) {
55         this.name = name;
56         this.spool = spool;
57         this.subid = subid;
58         this.logdata = logdata;
59         this.url = url;
60         this.authuser = authuser;
61         this.authentication = authentication;
62         this.metaonly = metaonly;
63         this.use100 = use100;
64     }
65
66     public boolean equals(Object o) {
67         return ((o instanceof DestInfo) && ((DestInfo) o).spool.equals(spool));
68     }
69
70     public int hashCode() {
71         return (spool.hashCode());
72     }
73
74     /**
75      * Get the name of this destination
76      */
77     public String getName() {
78         return (name);
79     }
80
81     /**
82      * Get the spool directory for this destination.
83      *
84      * @return The spool directory
85      */
86     public String getSpool() {
87         return (spool);
88     }
89
90     /**
91      * Get the subscription ID.
92      *
93      * @return Subscription ID or null if this is a node to node delivery.
94      */
95     public String getSubId() {
96         return (subid);
97     }
98
99     /**
100      * Get the log data.
101      *
102      * @return Text to be included in a log message about delivery attempts.
103      */
104     public String getLogData() {
105         return (logdata);
106     }
107
108     /**
109      * Get the delivery URL.
110      *
111      * @return The URL to deliver to (the primary URL).
112      */
113     public String getURL() {
114         return (url);
115
116     }
117
118     /**
119      * Get the user for authentication
120      *
121      * @return The name of the user for logging
122      */
123     public String getAuthUser() {
124         return (authuser);
125     }
126
127     /**
128      * Get the authentication header
129      *
130      * @return The string to use to authenticate to the recipient.
131      */
132     public String getAuth() {
133         return (authentication);
134     }
135
136     /**
137      * Is this a metadata only delivery?
138      *
139      * @return True if this is a metadata only delivery
140      */
141     public boolean isMetaDataOnly() {
142         return (metaonly);
143     }
144
145     /**
146      * Should I send expect 100-continue header?
147      *
148      * @return True if I should.
149      */
150     public boolean isUsing100() {
151         return (use100);
152     }
153 }