X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=datarouter-node%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fnode%2FNodeConfig.java;h=791eee12b305d99041c01dea5000a6a79676a011;hb=5b4d074b2f317ffe2cd9cdae5292b0ea94b35fb3;hp=265aafd34a1cb243009580f36ab1271548a6fa03;hpb=6d10bed2c0a833ae38d49efe8df0b74c825633e8;p=dmaap%2Fdatarouter.git diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java index 265aafd3..791eee12 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfig.java @@ -24,22 +24,27 @@ package org.onap.dmaap.datarouter.node; -import java.util.*; -import java.io.*; +import java.io.File; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Vector; +import org.apache.log4j.Logger; /** * Processed configuration for this node. *
- * The NodeConfig represents a processed configuration from the Data Router
- * provisioning server. Each time configuration data is received from the
- * provisioning server, a new NodeConfig is created and the previous one
+ * The NodeConfig represents a processed configuration from the Data Router provisioning server. Each time
+ * configuration data is received from the provisioning server, a new NodeConfig is created and the previous one
* discarded.
*/
public class NodeConfig {
+ private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.NodeConfig");
/**
* Raw configuration entry for a data router node
*/
public static class ProvNode {
+
private String cname;
/**
@@ -63,14 +68,15 @@ public class NodeConfig {
* Raw configuration entry for a provisioning parameter
*/
public static class ProvParam {
+
private String name;
private String value;
/**
* Construct a provisioning parameter configuration entry.
*
- * @param name The name of the parameter.
- * @param value The value of the parameter.
+ * @param name The name of the parameter.
+ * @param value The value of the parameter.
*/
public ProvParam(String name, String value) {
this.name = name;
@@ -96,21 +102,46 @@ public class NodeConfig {
* Raw configuration entry for a data feed.
*/
public static class ProvFeed {
+
private String id;
private String logdata;
private String status;
+ private String createdDate;
+ /*
+ * AAF changes: TDP EPIC US# 307413
+ * Passing aafInstance from to identify legacy/AAF feeds
+ */
+ private String aafInstance;
/**
* Construct a feed configuration entry.
*
- * @param id The feed ID of the entry.
+ * @param id The feed ID of the entry.
* @param logdata String for log entries about the entry.
- * @param status The reason why this feed cannot be used (Feed has been deleted, Feed has been suspended) or null if it is valid.
+ * @param status The reason why this feed cannot be used (Feed has been deleted, Feed has been suspended) or
+ * null if it is valid.
*/
- public ProvFeed(String id, String logdata, String status) {
+ public ProvFeed(String id, String logdata, String status, String createdDate, String aafInstance) {
this.id = id;
this.logdata = logdata;
this.status = status;
+ this.createdDate = createdDate;
+ this.aafInstance = aafInstance;
+ }
+
+ /**
+ * Get the created date of the data feed.
+ */
+ public String getCreatedDate()
+ {
+ return(createdDate);
+ }
+
+ /**
+ * Get the aafInstance of the data feed.
+ */
+ public String getAafInstance() {
+ return aafInstance;
}
/**
@@ -139,6 +170,7 @@ public class NodeConfig {
* Raw configuration entry for a feed user.
*/
public static class ProvFeedUser {
+
private String feedid;
private String user;
private String credentials;
@@ -146,8 +178,8 @@ public class NodeConfig {
/**
* Construct a feed user configuration entry
*
- * @param feedid The feed id.
- * @param user The user that will publish to the feed.
+ * @param feedid The feed id.
+ * @param user The user that will publish to the feed.
* @param credentials The Authorization header the user will use to publish.
*/
public ProvFeedUser(String feedid, String user, String credentials) {
@@ -182,6 +214,7 @@ public class NodeConfig {
* Raw configuration entry for a feed subnet
*/
public static class ProvFeedSubnet {
+
private String feedid;
private String cidr;
@@ -189,7 +222,7 @@ public class NodeConfig {
* Construct a feed subnet configuration entry
*
* @param feedid The feed ID
- * @param cidr The CIDR allowed to publish to the feed.
+ * @param cidr The CIDR allowed to publish to the feed.
*/
public ProvFeedSubnet(String feedid, String cidr) {
this.feedid = feedid;
@@ -215,6 +248,7 @@ public class NodeConfig {
* Raw configuration entry for a subscription
*/
public static class ProvSubscription {
+
private String subid;
private String feedid;
private String url;
@@ -222,19 +256,26 @@ public class NodeConfig {
private String credentials;
private boolean metaonly;
private boolean use100;
+ private boolean privilegedSubscriber;
+ private boolean followRedirect;
+ private boolean decompress;
/**
* Construct a subscription configuration entry
*
- * @param subid The subscription ID
- * @param feedid The feed ID
- * @param url The base delivery URL (not including the fileid)
- * @param authuser The user in the credentials used to deliver
- * @param credentials The credentials used to authenticate to the delivery URL exactly as they go in the Authorization header.
- * @param metaonly Is this a meta data only subscription?
- * @param use100 Should we send Expect: 100-continue?
- */
- public ProvSubscription(String subid, String feedid, String url, String authuser, String credentials, boolean metaonly, boolean use100) {
+ * @param subid The subscription ID
+ * @param feedid The feed ID
+ * @param url The base delivery URL (not including the fileid)
+ * @param authuser The user in the credentials used to deliver
+ * @param credentials The credentials used to authenticate to the delivery URL exactly as they go in the
+ * Authorization header.
+ * @param metaonly Is this a meta data only subscription?
+ * @param use100 Should we send Expect: 100-continue?
+ * @param privilegedSubscriber Can we wait to receive a delete file call before deleting file
+ * @param followRedirect Is follow redirect of destination enabled?
+ * @param decompress To see if they want their information compressed or decompressed
+ */
+ public ProvSubscription(String subid, String feedid, String url, String authuser, String credentials, boolean metaonly, boolean use100, boolean privilegedSubscriber, boolean followRedirect, boolean decompress) {
this.subid = subid;
this.feedid = feedid;
this.url = url;
@@ -242,6 +283,9 @@ public class NodeConfig {
this.credentials = credentials;
this.metaonly = metaonly;
this.use100 = use100;
+ this.privilegedSubscriber = privilegedSubscriber;
+ this.followRedirect = followRedirect;
+ this.decompress = decompress;
}
/**
@@ -292,12 +336,35 @@ public class NodeConfig {
public boolean isUsing100() {
return (use100);
}
+
+ /**
+ * Can we wait to receive a delete file call before deleting file
+ */
+ public boolean isPrivilegedSubscriber() {
+ return (privilegedSubscriber);
+ }
+
+ /**
+ * Should i decompress the file before sending it on
+ */
+ public boolean isDecompress() {
+ return (decompress);
+ }
+
+ /**
+ * New field is added - FOLLOW_REDIRECTS feature iTrack:DATARTR-17 - 1706
+ * Get the followRedirect of this destination
+ */
+ boolean getFollowRedirect() {
+ return(followRedirect);
+ }
}
/**
* Raw configuration entry for controlled ingress to the data router node
*/
public static class ProvForceIngress {
+
private String feedid;
private String subnet;
private String user;
@@ -307,15 +374,21 @@ public class NodeConfig {
* Construct a forced ingress configuration entry
*
* @param feedid The feed ID that this entry applies to
- * @param subnet The CIDR for which publisher IP addresses this entry applies to or "" if it applies to all publisher IP addresses
- * @param user The publishing user this entry applies to or "" if it applies to all publishing users.
- * @param nodes The array of FQDNs of the data router nodes to redirect publication attempts to.
+ * @param subnet The CIDR for which publisher IP addresses this entry applies to or "" if it applies to all
+ * publisher IP addresses
+ * @param user The publishing user this entry applies to or "" if it applies to all publishing users.
+ * @param nodes The array of FQDNs of the data router nodes to redirect publication attempts to.
*/
public ProvForceIngress(String feedid, String subnet, String user, String[] nodes) {
this.feedid = feedid;
this.subnet = subnet;
this.user = user;
- this.nodes = nodes;
+ //Sonar fix
+ if(nodes == null) {
+ this.nodes = new String[0];
+ } else {
+ this.nodes = Arrays.copyOf(nodes, nodes.length);
+ }
}
/**
@@ -351,6 +424,7 @@ public class NodeConfig {
* Raw configuration entry for controlled egress from the data router
*/
public static class ProvForceEgress {
+
private String subid;
private String node;
@@ -358,7 +432,7 @@ public class NodeConfig {
* Construct a forced egress configuration entry
*
* @param subid The subscription ID the subscription with forced egress
- * @param node The node handling deliveries for this subscription
+ * @param node The node handling deliveries for this subscription
*/
public ProvForceEgress(String subid, String node) {
this.subid = subid;
@@ -384,6 +458,7 @@ public class NodeConfig {
* Raw configuration entry for routing within the data router network
*/
public static class ProvHop {
+
private String from;
private String to;
private String via;
@@ -399,8 +474,8 @@ public class NodeConfig {
* Construct a hop entry
*
* @param from The FQDN of the node with the data to be delivered
- * @param to The FQDN of the node that will deliver to the subscriber
- * @param via The FQDN of the node where the from node should send the data
+ * @param to The FQDN of the node that will deliver to the subscriber
+ * @param via The FQDN of the node where the from node should send the data
*/
public ProvHop(String from, String to, String via) {
this.from = from;
@@ -431,25 +506,30 @@ public class NodeConfig {
}
private static class Redirection {
+
SubnetMatcher snm;
String user;
String[] nodes;
}
private static class Feed {
+
String loginfo;
String status;
SubnetMatcher[] subnets;
Hashtable