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;
44 * Create a destination information object.
46 * @param name n:fqdn or s:subid
47 * @param spool The directory where files are spooled.
48 * @param subid The subscription ID (if applicable).
49 * @param logdata Text to be included in log messages
50 * @param url The URL to deliver to.
51 * @param authuser The auth user for logging.
52 * @param authentication The credentials.
53 * @param metaonly Is this a metadata only delivery?
54 * @param use100 Should I use expect 100-continue?
55 * @param privilegedSubscriber Can we wait to receive a file processed acknowledgement before deleting file
56 * @param decompress To see if the they want there information compressed or decompressed
58 public DestInfo(String name, String spool, String subid, String logdata, String url, String authuser, String authentication, boolean metaonly, boolean use100, boolean privilegedSubscriber, boolean decompress) {
62 this.logdata = logdata;
64 this.authuser = authuser;
65 this.authentication = authentication;
66 this.metaonly = metaonly;
68 this.privilegedSubscriber = privilegedSubscriber;
69 this.decompress = decompress;
73 * Create a destination information object.
75 * @param name n:fqdn or s:subid
76 * @param spool The directory where files are spooled.
77 * @param subscription The subscription.
79 public DestInfo(String name, String spool, NodeConfig.ProvSubscription subscription) {
82 this.subid = subscription.getSubId();
83 this.logdata = subscription.getFeedId();
84 this.url = subscription.getURL();
85 this.authuser = subscription.getAuthUser();
86 this.authentication = subscription.getCredentials();
87 this.metaonly = subscription.isMetaDataOnly();
88 this.use100 = subscription.isUsing100();
89 this.privilegedSubscriber = subscription.isPrivilegedSubscriber();
90 this.decompress = subscription.isDecompress();
93 public boolean equals(Object o) {
94 return ((o instanceof DestInfo) && ((DestInfo) o).spool.equals(spool));
97 public int hashCode() {
98 return (spool.hashCode());
102 * Get the name of this destination
104 public String getName() {
109 * Get the spool directory for this destination.
111 * @return The spool directory
113 public String getSpool() {
118 * Get the subscription ID.
120 * @return Subscription ID or null if this is a node to node delivery.
122 public String getSubId() {
129 * @return Text to be included in a log message about delivery attempts.
131 public String getLogData() {
136 * Get the delivery URL.
138 * @return The URL to deliver to (the primary URL).
140 public String getURL() {
146 * Get the user for authentication
148 * @return The name of the user for logging
150 public String getAuthUser() {
155 * Get the authentication header
157 * @return The string to use to authenticate to the recipient.
159 public String getAuth() {
160 return (authentication);
164 * Is this a metadata only delivery?
166 * @return True if this is a metadata only delivery
168 public boolean isMetaDataOnly() {
173 * Should I send expect 100-continue header?
175 * @return True if I should.
177 public boolean isUsing100() {
182 * Should we wait to receive a file processed acknowledgement before deleting file
184 public boolean isPrivilegedSubscriber() {
185 return (privilegedSubscriber);
189 * Should i decompress the file before sending it on
191 * @return True if I should.
193 public boolean isDecompress() {