aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/guard/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/guard/src/main/java')
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java14
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java12
2 files changed, 19 insertions, 7 deletions
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
index 57f520894..702edab1f 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java
@@ -38,6 +38,7 @@ import javax.persistence.NonUniqueResultException;
import javax.persistence.Persistence;
import javax.persistence.Query;
+import org.onap.policy.drools.system.PolicyEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -77,7 +78,8 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
private static final Logger logger = LoggerFactory.getLogger(PIPEngineGetHistory.class);
public static final String DEFAULT_DESCRIPTION = "PIP for retrieving Operations History from DB";
- public static final String OPS_HIST_PROPS_LOC = "/operation_history.properties";
+
+
//
// Base issuer string. The issuer in the policy will also contain time window information
@@ -320,12 +322,10 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{
// DB Properties
Properties props = new Properties();
- try (InputStream is = org.onap.policy.guard.PIPEngineGetHistory.class.getResourceAsStream(OPS_HIST_PROPS_LOC)){
- props.load(is);
- } catch (IOException ex) {
- logger.error("getCountFromDB threw: ", ex);
- return -1;
- }
+ props.put(Util.ECLIPSE_LINK_KEY_URL, PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_URL));
+ props.put(Util.ECLIPSE_LINK_KEY_USER, PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_USER));
+ props.put(Util.ECLIPSE_LINK_KEY_PASS, PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_PASS));
+
EntityManager em = null;
String OpsHistPU = System.getProperty("OperationsHistoryPU");
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java
index f572cd7fa..ca62f6149 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java
@@ -48,6 +48,18 @@ public final class Util {
public static final String PROP_GUARD_CLIENT_USER = "pdpx.client.username";
public static final String PROP_GUARD_CLIENT_PASS = "pdpx.client.password";
public static final String PROP_GUARD_ENV = "pdpx.environment";
+ public static final String PROP_GUARD_DISABLED = "guard.disabled";
+
+ /*
+ * Keys for eclipse link and ONAP properties
+ */
+ public static final String ECLIPSE_LINK_KEY_URL = "javax.persistence.jdbc.url";
+ public static final String ECLIPSE_LINK_KEY_USER = "javax.persistence.jdbc.user";
+ public static final String ECLIPSE_LINK_KEY_PASS = "javax.persistence.jdbc.password";
+
+ public static final String ONAP_KEY_URL = "guard.jdbc.url";
+ public static final String ONAP_KEY_USER = "sql.db.username";
+ public static final String ONAP_KEY_PASS = "sql.db.password";
/*
* Guard responses