import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.apache.log4j.Logger;
-import org.onap.aaf.cadi.PropAccess;
import org.onap.dmaap.datarouter.node.eelf.EelfMsgs;
import java.io.File;
* Maintain the configuration of a Data Router node
* <p>
* The NodeConfigManager is the single point of contact for servlet, delivery, event logging, and log retention
- * subsystems to access configuration information. (Log4J has its own configuration mechanism).
+ * subsystems to access configuration information.
* <p>
* There are two basic sets of configuration data. The static local configuration data, stored in a local configuration
* file (created as part of installation by SWM), and the dynamic global configuration data fetched from the data router
*/
public class NodeConfigManager implements DeliveryQueueHelper {
- private static EELFLogger eelflogger = EELFManager.getInstance()
+ private static EELFLogger eelfLogger = EELFManager.getInstance()
.getLogger(NodeConfigManager.class);
- private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.node.NodeConfigManager");
private static NodeConfigManager base = new NodeConfigManager();
private Timer timer = new Timer("Node Configuration Timer", true);
Properties drNodeProperties = new Properties();
try {
- logger.info("NODE0301 Loading local config file node.properties");
+ eelfLogger.info("NODE0301 Loading local config file node.properties");
drNodeProperties.load(new FileInputStream(System
.getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties")));
} catch (Exception e) {
NodeUtils.setIpAndFqdnForEelf("NodeConfigManager");
- eelflogger.error(EelfMsgs.MESSAGE_PROPERTIES_LOAD_ERROR);
- logger.error("NODE0301 Unable to load local configuration file " + System
- .getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties"), e);
+ eelfLogger.error(EelfMsgs.MESSAGE_PROPERTIES_LOAD_ERROR, e, System.getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties"));
}
provurl = drNodeProperties.getProperty("ProvisioningURL", "https://dmaap-dr-prov:8443/internal/prov");
/*
provhost = (new URL(provurl)).getHost();
} catch (Exception e) {
NodeUtils.setIpAndFqdnForEelf("NodeConfigManager");
- eelflogger.error(EelfMsgs.MESSAGE_BAD_PROV_URL, provurl);
- logger.error("NODE0302 Bad provisioning server URL " + provurl);
+ eelfLogger.error(EelfMsgs.MESSAGE_BAD_PROV_URL, e, provurl);
System.exit(1);
}
- logger.info("NODE0303 Provisioning server is " + provhost);
+ eelfLogger.info("NODE0303 Provisioning server is " + provhost);
eventlogurl = drNodeProperties.getProperty("LogUploadURL", "https://feeds-drtr.web.att.com/internal/logs");
provcheck = new IsFrom(provhost);
gfport = Integer.parseInt(drNodeProperties.getProperty("IntHttpPort", "8080"));
myname = NodeUtils.getCanonicalName(kstype, ksfile, kspass);
if (myname == null) {
NodeUtils.setIpAndFqdnForEelf("NodeConfigManager");
- eelflogger.error(EelfMsgs.MESSAGE_KEYSTORE_FETCH_ERROR, ksfile);
- logger.error("NODE0309 Unable to fetch canonical name from keystore file " + ksfile);
+ eelfLogger.error(EelfMsgs.MESSAGE_KEYSTORE_FETCH_ERROR, ksfile);
+ eelfLogger.error("NODE0309 Unable to fetch canonical name from keystore file " + ksfile);
System.exit(1);
}
- logger.info("NODE0304 My certificate says my name is " + myname);
+ eelfLogger.info("NODE0304 My certificate says my name is " + myname);
pid = new PublishId(myname);
rdmgr = new RedirManager(redirfile, minrsinterval, timer);
pfetcher = new RateLimitedOperation(minpfinterval, timer) {
fetchconfig();
}
};
- logger.info("NODE0305 Attempting to fetch configuration at " + provurl);
+ eelfLogger.info("NODE0305 Attempting to fetch configuration at " + provurl);
pfetcher.request();
}
try {
initfailuretimer = (long) (Double.parseDouble(getProvParam("DELIVERY_INIT_RETRY_INTERVAL")) * 1000);
} catch (Exception e) {
+ eelfLogger.error("Error parsing DELIVERY_INIT_RETRY_INTERVAL", e);
}
try {
waitForFileProcessFailureTimer = (long) (Double.parseDouble(getProvParam("DELIVERY_FILE_PROCESS_INTERVAL")) * 1000);
} catch (Exception e) {
+ eelfLogger.error("Error parsing DELIVERY_FILE_PROCESS_INTERVAL", e);
}
try {
maxfailuretimer = (long) (Double.parseDouble(getProvParam("DELIVERY_MAX_RETRY_INTERVAL")) * 1000);
} catch (Exception e) {
+ eelfLogger.error("Error parsing DELIVERY_MAX_RETRY_INTERVAL", e);
}
try {
expirationtimer = (long) (Double.parseDouble(getProvParam("DELIVERY_MAX_AGE")) * 1000);
} catch (Exception e) {
+ eelfLogger.error("Error parsing DELIVERY_MAX_AGE", e);
}
try {
failurebackoff = Double.parseDouble(getProvParam("DELIVERY_RETRY_RATIO"));
} catch (Exception e) {
+ eelfLogger.error("Error parsing DELIVERY_RETRY_RATIO", e);
}
try {
deliverythreads = Integer.parseInt(getProvParam("DELIVERY_THREADS"));
} catch (Exception e) {
+ eelfLogger.error("Error parsing DELIVERY_THREADS", e);
}
try {
fairfilelimit = Integer.parseInt(getProvParam("FAIR_FILE_LIMIT"));
} catch (Exception e) {
+ eelfLogger.error("Error parsing FAIR_FILE_LIMIT", e);
}
try {
fairtimelimit = (long) (Double.parseDouble(getProvParam("FAIR_TIME_LIMIT")) * 1000);
} catch (Exception e) {
+ eelfLogger.error("Error parsing FAIR_TIME_LIMIT", e);
}
try {
fdpstart = Double.parseDouble(getProvParam("FREE_DISK_RED_PERCENT")) / 100.0;
} catch (Exception e) {
+ eelfLogger.error("Error parsing FREE_DISK_RED_PERCENT", e);
}
try {
fdpstop = Double.parseDouble(getProvParam("FREE_DISK_YELLOW_PERCENT")) / 100.0;
} catch (Exception e) {
+ eelfLogger.error("Error parsing FREE_DISK_YELLOW_PERCENT", e);
}
if (fdpstart < 0.01) {
fdpstart = 0.01;
private void fetchconfig() {
try {
- logger.info("NodeConfigMan.fetchConfig: provurl:: " + provurl);
+ eelfLogger.info("NodeConfigMan.fetchConfig: provurl:: " + provurl);
Reader r = new InputStreamReader((new URL(provurl)).openStream());
config = new NodeConfig(new ProvData(r), myname, spooldir, port, nak);
localconfig();
try {
rr.run();
} catch (Exception e) {
- logger.error("NODE0518 Exception fetchconfig: " + e);
+ eelfLogger.error("NODE0518 Exception fetchconfig: " + e);
}
}
} catch (Exception e) {
NodeUtils.setIpAndFqdnForEelf("fetchconfigs");
- eelflogger.error(EelfMsgs.MESSAGE_CONF_FAILED, e.toString());
- logger.error("NODE0306 Configuration failed " + e.toString() + " - try again later", e);
+ eelfLogger.error(EelfMsgs.MESSAGE_CONF_FAILED, e.toString());
+ eelfLogger.error("NODE0306 Configuration failed " + e.toString() + " - try again later", e);
pfetcher.request();
}
}
*/
public synchronized void gofetch(String remoteAddr) {
if (provcheck.isReachable(remoteAddr)) {
- logger.info("NODE0307 Received configuration fetch request from provisioning server " + remoteAddr);
+ eelfLogger.info("NODE0307 Received configuration fetch request from provisioning server " + remoteAddr);
pfetcher.request();
} else {
- logger.info("NODE0308 Received configuration fetch request from unexpected server " + remoteAddr);
+ eelfLogger.info("NODE0308 Received configuration fetch request from unexpected server " + remoteAddr);
}
}
public String isPublishPermitted(String feedid, String ip) {
return(config.isPublishPermitted(feedid, ip));
}
-
+
/**
* Check who the user is given the feed ID and the offered credentials.
*
if (provcheck.isFrom(remoteaddr)) {
String sdir = config.getSpoolDir(subid);
if (sdir != null) {
- logger.info("NODE0310 Received subscription reset request for subscription " + subid
+ eelfLogger.info("NODE0310 Received subscription reset request for subscription " + subid
+ " from provisioning server " + remoteaddr);
} else {
- logger.info("NODE0311 Received subscription reset request for unknown subscription " + subid
+ eelfLogger.info("NODE0311 Received subscription reset request for unknown subscription " + subid
+ " from provisioning server " + remoteaddr);
}
return (sdir);
} else {
- logger.info("NODE0312 Received subscription reset request from unexpected server " + remoteaddr);
+ eelfLogger.info("NODE0312 Received subscription reset request from unexpected server " + remoteaddr);
return (null);
}
}
}
return type + "|" + aafInstance + "|" + action;
} catch (Exception e) {
- logger.error("NODE0543 NodeConfigManager.getPermission: ", e);
+ eelfLogger.error("NODE0543 NodeConfigManager.getPermission: ", e);
}
return null;
}