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 {
35 private String logdata;
37 private String authuser;
38 private String authentication;
39 private boolean metaonly;
40 private boolean use100;
41 private boolean privilegedSubscriber;
42 private boolean decompress;
43 private boolean followRedirects;
46 * Create a destination information object.
48 * @param destInfoBuilder DestInfo Object Builder
50 public DestInfo(DestInfoBuilder destInfoBuilder) {
51 this.name = destInfoBuilder.getName();
52 this.spool = destInfoBuilder.getSpool();
53 this.subid = destInfoBuilder.getSubid();
54 this.logdata = destInfoBuilder.getLogdata();
55 this.url = destInfoBuilder.getUrl();
56 this.authuser = destInfoBuilder.getAuthuser();
57 this.authentication = destInfoBuilder.getAuthentication();
58 this.metaonly = destInfoBuilder.isMetaonly();
59 this.use100 = destInfoBuilder.isUse100();
60 this.privilegedSubscriber = destInfoBuilder.isPrivilegedSubscriber();
61 this.followRedirects = destInfoBuilder.isFollowRedirects();
62 this.decompress = destInfoBuilder.isDecompress();
66 * Create a destination information object.
68 * @param name n:fqdn or s:subid
69 * @param spool The directory where files are spooled.
70 * @param subscription The subscription.
72 public DestInfo(String name, String spool, NodeConfig.ProvSubscription subscription) {
75 this.subid = subscription.getSubId();
76 this.logdata = subscription.getFeedId();
77 this.url = subscription.getURL();
78 this.authuser = subscription.getAuthUser();
79 this.authentication = subscription.getCredentials();
80 this.metaonly = subscription.isMetaDataOnly();
81 this.use100 = subscription.isUsing100();
82 this.privilegedSubscriber = subscription.isPrivilegedSubscriber();
83 this.followRedirects = subscription.getFollowRedirect();
84 this.decompress = subscription.isDecompress();
87 public boolean equals(Object object) {
88 return ((object instanceof DestInfo) && ((DestInfo) object).spool.equals(spool));
91 public int hashCode() {
92 return (spool.hashCode());
96 * Get the name of this destination.
98 public String getName() {
103 * Get the spool directory for this destination.
105 * @return The spool directory
107 public String getSpool() {
112 * Get the subscription ID.
114 * @return Subscription ID or null if this is a node to node delivery.
116 public String getSubId() {
123 * @return Text to be included in a log message about delivery attempts.
125 public String getLogData() {
130 * Get the delivery URL.
132 * @return The URL to deliver to (the primary URL).
134 public String getURL() {
140 * Get the user for authentication.
142 * @return The name of the user for logging
144 public String getAuthUser() {
149 * Get the authentication header.
151 * @return The string to use to authenticate to the recipient.
153 public String getAuth() {
154 return (authentication);
158 * Is this a metadata only delivery.
160 * @return True if this is a metadata only delivery
162 public boolean isMetaDataOnly() {
167 * Should I send expect 100-continue header.
169 * @return True if I should.
171 public boolean isUsing100() {
176 * Should we wait to receive a file processed acknowledgement before deleting file.
178 public boolean isPrivilegedSubscriber() {
179 return (privilegedSubscriber);
183 * Should I follow redirects.
185 * @return True if I should.
187 public boolean isFollowRedirects() {
188 return (followRedirects);
192 * Should i decompress the file before sending it on.
194 * @return True if I should.
196 public boolean isDecompress() {