1 /*******************************************************************************
2 * ============LICENSE_START==================================================
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
11 * * http://www.apache.org/licenses/LICENSE-2.0
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====================================================
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 ******************************************************************************/
25 package org.onap.dmaap.datarouter.node;
28 * Information for a delivery destination that doesn't change from message to message
30 public class DestInfo {
34 private String logdata;
36 private String authuser;
37 private String authentication;
38 private boolean metaonly;
39 private boolean use100;
40 private boolean privilegedSubscriber;
41 private boolean decompress;
42 private boolean followRedirects;
43 private String aafInstance;
45 * Create a destination information object.
47 * @param name n:fqdn or s:subid
48 * @param spool The directory where files are spooled.
49 * @param subid The subscription ID (if applicable).
50 * @param logdata Text to be included in log messages
51 * @param url The URL to deliver to.
52 * @param authuser The auth user for logging.
53 * @param authentication The credentials.
54 * @param metaonly Is this a metadata only delivery?
55 * @param use100 Should I use expect 100-continue?
56 * @param privilegedSubscriber Can we wait to receive a file processed acknowledgement before deleting file
57 * @param followRedirects Is follow redirect of destination enabled?
58 * @param decompress To see if the they want there information compressed or decompressed
60 public DestInfo(String name, String spool, String subid, String logdata, String url, String authuser, String authentication, boolean metaonly, boolean use100, boolean privilegedSubscriber, boolean followRedirects, boolean decompress) {
64 this.logdata = logdata;
66 this.authuser = authuser;
67 this.authentication = authentication;
68 this.metaonly = metaonly;
70 this.privilegedSubscriber = privilegedSubscriber;
71 this.followRedirects = followRedirects;
72 this.decompress = decompress;
76 * Create a destination information object.
78 * @param name n:fqdn or s:subid
79 * @param spool The directory where files are spooled.
80 * @param subscription The subscription.
82 public DestInfo(String name, String spool, NodeConfig.ProvSubscription subscription) {
85 this.subid = subscription.getSubId();
86 this.logdata = subscription.getFeedId();
87 this.url = subscription.getURL();
88 this.authuser = subscription.getAuthUser();
89 this.authentication = subscription.getCredentials();
90 this.metaonly = subscription.isMetaDataOnly();
91 this.use100 = subscription.isUsing100();
92 this.privilegedSubscriber = subscription.isPrivilegedSubscriber();
93 this.followRedirects = subscription.getFollowRedirect();
94 this.decompress = subscription.isDecompress();
97 public boolean equals(Object o) {
98 return ((o instanceof DestInfo) && ((DestInfo) o).spool.equals(spool));
101 public int hashCode() {
102 return (spool.hashCode());
106 * Get the name of this destination
108 public String getName() {
113 * Get the spool directory for this destination.
115 * @return The spool directory
117 public String getSpool() {
122 * Get the subscription ID.
124 * @return Subscription ID or null if this is a node to node delivery.
126 public String getSubId() {
133 * @return Text to be included in a log message about delivery attempts.
135 public String getLogData() {
140 * Get the delivery URL.
142 * @return The URL to deliver to (the primary URL).
144 public String getURL() {
150 * Get the user for authentication
152 * @return The name of the user for logging
154 public String getAuthUser() {
159 * Get the authentication header
161 * @return The string to use to authenticate to the recipient.
163 public String getAuth() {
164 return (authentication);
168 * Is this a metadata only delivery?
170 * @return True if this is a metadata only delivery
172 public boolean isMetaDataOnly() {
177 * Should I send expect 100-continue header?
179 * @return True if I should.
181 public boolean isUsing100() {
186 * Should we wait to receive a file processed acknowledgement before deleting file
188 public boolean isPrivilegedSubscriber() {
189 return (privilegedSubscriber);
193 * Should I follow redirects?
195 * @return True if I should.
197 public boolean isFollowRedirects() {
198 return (followRedirects);
202 * Should i decompress the file before sending it on
204 * @return True if I should.
206 public boolean isDecompress() {