******************************************************************************/
-package org.onap.dmaap.datarouter.node;
+package org.onap.dmaap.datarouter.node.config;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import java.util.HashMap;
import java.util.HashSet;
import org.jetbrains.annotations.NotNull;
+import org.onap.dmaap.datarouter.node.DestInfo;
+import org.onap.dmaap.datarouter.node.DestInfoBuilder;
+import org.onap.dmaap.datarouter.node.IsFrom;
+import org.onap.dmaap.datarouter.node.Target;
+import org.onap.dmaap.datarouter.node.utils.NodeUtils;
/**
* Processed configuration for this node.
public class NodeConfig {
private static final String PUBLISHER_NOT_PERMITTED = "Publisher not permitted for this feed";
- private static EELFLogger logger = EELFManager.getInstance().getLogger(NodeConfig.class);
- private HashMap<String, String> params = new HashMap<>();
- private HashMap<String, Feed> feeds = new HashMap<>();
- private HashMap<String, DestInfo> nodeinfo = new HashMap<>();
- private HashMap<String, DestInfo> subinfo = new HashMap<>();
- private HashMap<String, IsFrom> nodes = new HashMap<>();
- private HashMap<String, ProvSubscription> provSubscriptions = new HashMap<>();
- private String myname;
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(NodeConfig.class);
+ private final HashMap<String, String> params = new HashMap<>();
+ private final HashMap<String, Feed> feeds = new HashMap<>();
+ private final HashMap<String, DestInfo> nodeinfo = new HashMap<>();
+ private final HashMap<String, DestInfo> subinfo = new HashMap<>();
+ private final HashMap<String, IsFrom> nodes = new HashMap<>();
+ private final HashMap<String, ProvSubscription> provSubscriptions = new HashMap<>();
+ private final String myname;
private String myauth;
- private DestInfo[] alldests;
+ private final DestInfo[] alldests;
private int rrcntr;
/**
feed.createdDate = pfx.getCreatedDate();
feed.loginfo = pfx.getLogData();
feed.status = pfx.getStatus();
- /*
- * AAF changes: TDP EPIC US# 307413
- * Passing aafInstance from ProvFeed to identify legacy/AAF feeds
- */
- feed.aafInstance = pfx.getAafInstance();
ArrayList<SubnetMatcher> v1 = pfstab.get(fid);
if (v1 == null) {
feed.subnets = new SubnetMatcher[0];
return (PUBLISHER_NOT_PERMITTED);
}
- /**
- * Check whether publication is allowed for AAF Feed.
- *
- * @param feedid The ID of the feed being requested.
- * @param ip The requesting IP address
- */
- public String isPublishPermitted(String feedid, String ip) {
- Feed feed = feeds.get(feedid);
- String nf = "Feed does not exist";
- if (feed != null) {
- nf = feed.status;
- }
- if (nf != null) {
- return nf;
- }
- if (feed.subnets.length == 0) {
- return null;
- }
- byte[] addr = NodeUtils.getInetAddress(ip);
- for (SubnetMatcher snm : feed.subnets) {
- if (snm.matches(addr)) {
- return null;
- }
- }
- return PUBLISHER_NOT_PERMITTED;
- }
-
/**
* Check whether delete file is allowed.
*
return (feeds.get(feedid).authusers.get(credentials));
}
- /**
- * AAF changes: TDP EPIC US# 307413 Check AAF_instance for feed ID.
- *
- * @param feedid The ID of the feed specified
- */
- public String getAafInstance(String feedid) {
- Feed feed = feeds.get(feedid);
- return feed.aafInstance;
- }
-
/**
* Check if the request should be redirected to a different ingress node.
*/
*/
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;
+ private final String id;
+ private final String logdata;
+ private final String status;
+ private final String createdDate;
/**
* Construct a feed configuration 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.
*/
- public ProvFeed(String id, String logdata, String status, String createdDate, String aafInstance) {
+ public ProvFeed(String id, String logdata, String status, String createdDate) {
this.id = id;
this.logdata = logdata;
this.status = status;
this.createdDate = createdDate;
- this.aafInstance = aafInstance;
}
/**
return (createdDate);
}
- /**
- * Get the aafInstance of the data feed.
- */
- public String getAafInstance() {
- return aafInstance;
- }
-
/**
* Get the feed id of the data feed.
*/
*/
public static class ProvFeedUser {
- private String feedid;
- private String user;
- private String credentials;
+ private final String feedid;
+ private final String user;
+ private final String credentials;
/**
* Construct a feed user configuration entry.
*/
public static class ProvFeedSubnet {
- private String feedid;
- private String cidr;
+ private final String feedid;
+ private final String cidr;
/**
* Construct a feed subnet configuration entry.
*/
public static class ProvSubscription {
- private String subid;
- private String feedid;
- private String url;
- private String authuser;
- private String credentials;
- private boolean metaonly;
- private boolean use100;
- private boolean privilegedSubscriber;
- private boolean followRedirect;
- private boolean decompress;
+ private final String subid;
+ private final String feedid;
+ private final String url;
+ private final String authuser;
+ private final String credentials;
+ private final boolean metaonly;
+ private final boolean use100;
+ private final boolean privilegedSubscriber;
+ private final boolean followRedirect;
+ private final boolean decompress;
/**
* Construct a subscription configuration entry.
* New field is added - FOLLOW_REDIRECTS feature iTrack:DATARTR-17 - 1706 Get the followRedirect of this
* destination.
*/
- boolean getFollowRedirect() {
+ public boolean getFollowRedirect() {
return (followRedirect);
}
}
*/
public static class ProvForceIngress {
- private String feedid;
- private String subnet;
- private String user;
- private String[] nodes;
+ private final String feedid;
+ private final String subnet;
+ private final String user;
+ private final String[] nodes;
/**
* Construct a forced ingress configuration entry.
*/
public static class ProvForceEgress {
- private String subid;
- private String node;
+ private final String subid;
+ private final String node;
/**
* Construct a forced egress configuration entry.
*/
public static class ProvHop {
- private String from;
- private String to;
- private String via;
+ private final String from;
+ private final String to;
+ private final String via;
/**
* Construct a hop entry.
Redirection[] redirections;
Target[] targets;
String createdDate;
- String aafInstance;
}
}