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;
27 import org.onap.dmaap.datarouter.node.config.NodeConfig;
30 * Information for a delivery destination that doesn't change from message to message.
32 public class DestInfo {
37 private String logdata;
39 private String authuser;
40 private String authentication;
41 private boolean metaonly;
42 private boolean use100;
43 private boolean privilegedSubscriber;
44 private boolean decompress;
45 private boolean followRedirects;
48 * Create a destination information object.
50 * @param destInfoBuilder DestInfo Object Builder
52 public DestInfo(DestInfoBuilder destInfoBuilder) {
53 this.name = destInfoBuilder.getName();
54 this.spool = destInfoBuilder.getSpool();
55 this.subid = destInfoBuilder.getSubid();
56 this.logdata = destInfoBuilder.getLogdata();
57 this.url = destInfoBuilder.getUrl();
58 this.authuser = destInfoBuilder.getAuthuser();
59 this.authentication = destInfoBuilder.getAuthentication();
60 this.metaonly = destInfoBuilder.isMetaonly();
61 this.use100 = destInfoBuilder.isUse100();
62 this.privilegedSubscriber = destInfoBuilder.isPrivilegedSubscriber();
63 this.followRedirects = destInfoBuilder.isFollowRedirects();
64 this.decompress = destInfoBuilder.isDecompress();
68 * Create a destination information object.
70 * @param name n:fqdn or s:subid
71 * @param spool The directory where files are spooled.
72 * @param subscription The subscription.
74 public DestInfo(String name, String spool, NodeConfig.ProvSubscription subscription) {
77 this.subid = subscription.getSubId();
78 this.logdata = subscription.getFeedId();
79 this.url = subscription.getURL();
80 this.authuser = subscription.getAuthUser();
81 this.authentication = subscription.getCredentials();
82 this.metaonly = subscription.isMetaDataOnly();
83 this.use100 = subscription.isUsing100();
84 this.privilegedSubscriber = subscription.isPrivilegedSubscriber();
85 this.followRedirects = subscription.getFollowRedirect();
86 this.decompress = subscription.isDecompress();
89 public boolean equals(Object object) {
90 return ((object instanceof DestInfo) && ((DestInfo) object).spool.equals(spool));
93 public int hashCode() {
94 return (spool.hashCode());
98 * Get the name of this destination.
100 public String getName() {
105 * Get the spool directory for this destination.
107 * @return The spool directory
109 public String getSpool() {
114 * Get the subscription ID.
116 * @return Subscription ID or null if this is a node to node delivery.
118 public String getSubId() {
125 * @return Text to be included in a log message about delivery attempts.
127 public String getLogData() {
132 * Get the delivery URL.
134 * @return The URL to deliver to (the primary URL).
136 public String getURL() {
142 * Get the user for authentication.
144 * @return The name of the user for logging
146 public String getAuthUser() {
151 * Get the authentication header.
153 * @return The string to use to authenticate to the recipient.
155 public String getAuth() {
156 return (authentication);
160 * Is this a metadata only delivery.
162 * @return True if this is a metadata only delivery
164 public boolean isMetaDataOnly() {
169 * Should I send expect 100-continue header.
171 * @return True if I should.
173 public boolean isUsing100() {
178 * Should we wait to receive a file processed acknowledgement before deleting file.
180 public boolean isPrivilegedSubscriber() {
181 return (privilegedSubscriber);
185 * Should I follow redirects.
187 * @return True if I should.
189 public boolean isFollowRedirects() {
190 return (followRedirects);
194 * Should i decompress the file before sending it on.
196 * @return True if I should.
198 public boolean isDecompress() {