aboutsummaryrefslogtreecommitdiffstats
path: root/policy-core/src/main
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-06-22 17:17:28 -0500
committerJorge Hernandez <jh1730@att.com>2017-06-22 17:17:28 -0500
commit8f61e18ef0457745719f05bd5c186992a7155416 (patch)
tree884f4653f957a88a65ea981727dfe26494fb7c55 /policy-core/src/main
parent3cc1a85a832771cb70ed9cbaab9031bc4a114308 (diff)
[POLICY-30] remove problematic layers
add configurability through telemetry API Change-Id: I77ebde12a417d421b98646c32dc74824f4494c2e Signed-off-by: Jorge Hernandez <jh1730@att.com>
Diffstat (limited to 'policy-core/src/main')
-rw-r--r--policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java62
-rw-r--r--policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java12
-rw-r--r--policy-core/src/main/java/org/openecomp/policy/drools/core/jmx/PdpJmxListener.java15
3 files changed, 22 insertions, 67 deletions
diff --git a/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java
index 26a80558..1b7941db 100644
--- a/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java
+++ b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java
@@ -20,12 +20,10 @@
package org.openecomp.policy.drools.core;
-import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import org.kie.api.KieBase;
@@ -36,12 +34,9 @@ import org.kie.api.builder.ReleaseId;
import org.kie.api.builder.Results;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
-import org.openecomp.policy.common.logging.flexlogger.Logger;
-import org.openecomp.policy.common.logging.flexlogger.PropertyUtil;
import org.openecomp.policy.drools.properties.Startable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class is a wrapper around 'KieContainer', which adds the ability
@@ -50,7 +45,7 @@ import org.openecomp.policy.drools.properties.Startable;
public class PolicyContainer implements Startable
{
// get an instance of logger
- private static Logger logger = FlexLogger.getLogger(PolicyContainer.class);
+ private static Logger logger = LoggerFactory.getLogger(PolicyContainer.class);
// 'KieServices' singleton
static private KieServices kieServices = KieServices.Factory.get();
@@ -80,9 +75,6 @@ public class PolicyContainer implements Startable
// (it can block for a long time)
private boolean scannerStarted = false;
- // Used to set relative pathing to config files for unit test environment
- public static boolean isUnitTesting = false;
-
/**
* uses 'groupId', 'artifactId' and 'version', and fetches the associated
* artifact and remaining dependencies from the Maven repository to create
@@ -528,7 +520,7 @@ public class PolicyContainer implements Startable
catch (Exception e)
{
// sometimes the scanner initialization fails for some reason
- logger.error(MessageCodes.EXCEPTION_ERROR, e, "main", "startServer");
+ logger.error("startScanner error", e);
}
}
}
@@ -752,10 +744,7 @@ public class PolicyContainer implements Startable
}
catch (Exception e)
{
- e.printStackTrace();
- logger.error(MessageCodes.EXCEPTION_ERROR, e,
- "activate",
- "PolicyContainer.start()");
+ logger.error("PolicyContainer.start() error in activate", e);
}
}
}
@@ -774,10 +763,7 @@ public class PolicyContainer implements Startable
}
catch (Exception e)
{
- e.printStackTrace();
- logger.error(MessageCodes.EXCEPTION_ERROR, e,
- "deactivate",
- "PolicyContainer.stop()");
+ logger.error("PolicyContainer.start() error in deactivate", e);
}
}
}
@@ -796,23 +782,8 @@ public class PolicyContainer implements Startable
*/
public static void globalInit(String args[])
{
-
- /*
- * When JUnit testing, working directory should be
- * "../policy-management". In test environment, command line argument
- * should specify the relative path from this directory to the config
- * directory ("src/test/server/config")
- */
String configDir = "config";
- if (isUnitTesting) {
- configDir = "src/test/server/config";
- }
- System.out.println("PolicyContainer.main: configDir=" + configDir);
-
- logger.info("Calling initlogger");
-
- initlogger(configDir);
- logger.info("initlogger returned");
+ logger.info("PolicyContainer.main: configDir=" + configDir);
// invoke 'globalInit' on all of the features
for (PolicySessionFeatureAPI feature :
@@ -829,25 +800,6 @@ public class PolicyContainer implements Startable
}
}
}
-
- /**
- * Read in the logger properties
- */
- private static void initlogger(String configDir){
- try {
- Properties properties =
- PropertyUtil.getProperties(configDir + "/policyLogger.properties");
- try {
-
- PolicyLogger.init(properties);
-
- } catch (Exception e) {
- logger.error(MessageCodes.MISS_PROPERTY_ERROR, e, "initlogger");
- }
- } catch (IOException e1) {
- logger.error(MessageCodes.MISS_PROPERTY_ERROR, e1, "initlogger");
- }
- }
/**
* Fetch the adjunct object associated with a given feature
diff --git a/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java
index 4d717f5d..ebfcb025 100644
--- a/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java
+++ b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java
@@ -36,10 +36,10 @@ import org.kie.api.event.rule.RuleFlowGroupActivatedEvent;
import org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent;
import org.kie.api.event.rule.RuleRuntimeEventListener;
import org.kie.api.runtime.KieSession;
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
-import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.drools.core.jmx.PdpJmx;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* This class is a wrapper around 'KieSession', which adds the following:
@@ -52,7 +52,7 @@ public class PolicySession
implements AgendaEventListener, RuleRuntimeEventListener
{
// get an instance of logger
- private static Logger logger = FlexLogger.getLogger(PolicySession.class);
+ private static Logger logger = LoggerFactory.getLogger(PolicySession.class);
// name of the 'PolicySession' and associated 'KieSession'
private String name;
@@ -526,7 +526,7 @@ public class PolicySession
}
catch (Exception e)
{
- logger.error(MessageCodes.EXCEPTION_ERROR, e, "stopThread", "thread.join");
+ logger.error("stopThread in thread.join error");
}
}
@@ -567,7 +567,7 @@ public class PolicySession
}
catch (Throwable e)
{
- logger.error(MessageCodes.EXCEPTION_ERROR, e, "startThread", "kieSession.fireUntilHalt");
+ logger.error("startThread error in kieSession.fireUntilHalt", e);
}
}
logger.info("fireUntilHalt() returned");
diff --git a/policy-core/src/main/java/org/openecomp/policy/drools/core/jmx/PdpJmxListener.java b/policy-core/src/main/java/org/openecomp/policy/drools/core/jmx/PdpJmxListener.java
index 4b48da07..87354bf4 100644
--- a/policy-core/src/main/java/org/openecomp/policy/drools/core/jmx/PdpJmxListener.java
+++ b/policy-core/src/main/java/org/openecomp/policy/drools/core/jmx/PdpJmxListener.java
@@ -30,13 +30,12 @@ import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
-import org.openecomp.policy.common.logging.flexlogger.Logger;
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class PdpJmxListener {
- public static final Logger logger = FlexLogger.getLogger(PdpJmxListener.class);
+ public static final Logger logger = LoggerFactory.getLogger(PdpJmxListener.class);
public static void stop() {
final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
@@ -44,7 +43,9 @@ public class PdpJmxListener {
server.unregisterMBean(new ObjectName("PolicyEngine:type=PdpJmx"));
} catch (MBeanRegistrationException | InstanceNotFoundException
| MalformedObjectNameException e) {
- logger.error(MessageCodes.EXCEPTION_ERROR, e, "PdpJmxListener.stop()", "Could not unregister PolicyEngine:type=PdpJmx MBean with the MBean server");
+ logger.error("PdpJmxListener.stop(): " +
+ "Could not unregister PolicyEngine:type=PdpJmx MBean " +
+ "with the MBean server", e);
}
}
@@ -56,7 +57,9 @@ public class PdpJmxListener {
server.registerMBean(PdpJmx.getInstance(), new ObjectName("PolicyEngine:type=PdpJmx"));
} catch (InstanceAlreadyExistsException | MBeanRegistrationException
| NotCompliantMBeanException | MalformedObjectNameException e) {
- logger.error(MessageCodes.EXCEPTION_ERROR, e, "PdpJmxListener.start()", "Could not register PolicyEngine:type=PdpJmx MBean with the MBean server");
+ logger.error("PdpJmxListener.start(): " +
+ "Could not unregister PolicyEngine:type=PdpJmx MBean " +
+ "with the MBean server", e);
}
}