[DMAAP-48] Initial code import
[dmaap/datarouter.git] / datarouter-node / src / main / java / com / att / research / datarouter / node / DestInfo.java
1 /*******************************************************************************\r
2  * ============LICENSE_START==================================================\r
3  * * org.onap.dmaap\r
4  * * ===========================================================================\r
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * * ===========================================================================\r
7  * * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * * you may not use this file except in compliance with the License.\r
9  * * You may obtain a copy of the License at\r
10  * * \r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * * \r
13  *  * Unless required by applicable law or agreed to in writing, software\r
14  * * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * * See the License for the specific language governing permissions and\r
17  * * limitations under the License.\r
18  * * ============LICENSE_END====================================================\r
19  * *\r
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
21  * *\r
22  ******************************************************************************/\r
23 \r
24 \r
25 package com.att.research.datarouter.node;\r
26 \r
27 /**\r
28  *      Information for a delivery destination that doesn't change from message to message\r
29  */\r
30 public class DestInfo   {\r
31         private String  name;\r
32         private String  spool;\r
33         private String  subid;\r
34         private String  logdata;\r
35         private String  url;\r
36         private String  authuser;\r
37         private String  authentication;\r
38         private boolean metaonly;\r
39         private boolean use100;\r
40         /**\r
41          *      Create a destination information object.\r
42          *      @param  name    n:fqdn or s:subid\r
43          *      @param  spool   The directory where files are spooled.\r
44          *      @param  subid   The subscription ID (if applicable).\r
45          *      @param  logdata Text to be included in log messages\r
46          *      @param  url     The URL to deliver to.\r
47          *      @param  authuser        The auth user for logging.\r
48          *      @param  authentication  The credentials.\r
49          *      @param  metaonly        Is this a metadata only delivery?\r
50          *      @param  use100  Should I use expect 100-continue?\r
51          */\r
52         public DestInfo(String name, String spool, String subid, String logdata, String url, String authuser, String authentication, boolean metaonly, boolean use100) {\r
53                 this.name = name;\r
54                 this.spool = spool;\r
55                 this.subid = subid;\r
56                 this.logdata = logdata;\r
57                 this.url = url;\r
58                 this.authuser = authuser;\r
59                 this.authentication = authentication;\r
60                 this.metaonly = metaonly;\r
61                 this.use100 = use100;\r
62         }\r
63         public boolean equals(Object o) {\r
64                 return((o instanceof DestInfo) && ((DestInfo)o).spool.equals(spool));\r
65         }\r
66         public int hashCode() {\r
67                 return(spool.hashCode());\r
68         }\r
69         /**\r
70          *      Get the name of this destination\r
71          */\r
72         public String getName() {\r
73                 return(name);\r
74         }\r
75         /**\r
76          *      Get the spool directory for this destination.\r
77          *      @return The spool directory\r
78          */\r
79         public String getSpool() {\r
80                 return(spool);\r
81         }\r
82         /**\r
83          *      Get the subscription ID.\r
84          *      @return Subscription ID or null if this is a node to node delivery.\r
85          */\r
86         public String getSubId() {\r
87                 return(subid);\r
88         }\r
89         /**\r
90          *      Get the log data.\r
91          *      @return Text to be included in a log message about delivery attempts.\r
92          */\r
93         public String getLogData() {\r
94                 return(logdata);\r
95         }\r
96         /**\r
97          *      Get the delivery URL.\r
98          *      @return The URL to deliver to (the primary URL).\r
99          */\r
100         public String getURL() {\r
101                 return(url);\r
102 \r
103         }\r
104         /**\r
105          *      Get the user for authentication\r
106          *      @return The name of the user for logging\r
107          */\r
108         public String   getAuthUser() {\r
109                 return(authuser);\r
110         }\r
111         /**\r
112          *      Get the authentication header\r
113          *      @return The string to use to authenticate to the recipient.\r
114          */\r
115         public String getAuth() {\r
116                 return(authentication);\r
117         }\r
118         /**\r
119          *      Is this a metadata only delivery?\r
120          *      @return True if this is a metadata only delivery\r
121          */\r
122         public boolean  isMetaDataOnly() {\r
123                 return(metaonly);\r
124         }\r
125         /**\r
126          *      Should I send expect 100-continue header?\r
127          *      @return True if I should.\r
128          */\r
129         public boolean isUsing100() {\r
130                 return(use100);\r
131         }\r
132 }\r