X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fadmin%2FCheckPDP.java;h=7ac9ca31082edd84b53a346b88fc8fcf8e243a4d;hb=1b6feb8d0ca8094a0b7a552f1e3907f206be2527;hp=87ed1fec961a400f317a5956c97e2cc9623ac624;hpb=65f1e2bfc7d34ed125055f5c881d44bd4f5d38d0;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java index 87ed1fec9..7ac9ca310 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java @@ -34,6 +34,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Properties; import org.onap.policy.common.logging.flexlogger.FlexLogger; @@ -49,9 +50,14 @@ public class CheckPDP { private static HashMap pdpMap = null; private static final Logger LOGGER = FlexLogger.getLogger(CheckPDP.class); - private CheckPDP(){ + public static Map getPdpMap() { + return pdpMap; + } + + public CheckPDP(){ //default constructor } + public static boolean validateID(String id) { // ReadFile try { @@ -66,7 +72,6 @@ public class CheckPDP { private static void readFile(){ String pdpFile = null; - Long newModified = null; try{ pdpFile = XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_IDFILE); }catch (Exception e){ @@ -90,7 +95,7 @@ public class CheckPDP { } // Check if File is updated recently else { - newModified = pdpPath.toFile().lastModified(); + Long newModified = pdpPath.toFile().lastModified(); if (!newModified.equals(oldModified)) { // File has been updated. readProps(); @@ -100,7 +105,7 @@ public class CheckPDP { @SuppressWarnings({ "unchecked", "rawtypes" }) private static void readProps() { - Properties pdpProp = null; + Properties pdpProp; pdpProp = new Properties(); try { InputStream in = new FileInputStream(pdpPath.toFile()); @@ -126,15 +131,15 @@ public class CheckPDP { private static void loadPDPProperties(String propKey, Properties pdpProp){ if (propKey.startsWith("PDP_URL")) { - String check_val = pdpProp.getProperty(propKey); - if (check_val == null) { + String checkVal = pdpProp.getProperty(propKey); + if (checkVal == null) { LOGGER.error("Properties file doesn't have the PDP_URL parameter"); } - if (check_val != null && check_val.contains(";")) { - List pdp_default = new ArrayList<>(Arrays.asList(check_val.split("\\s*;\\s*"))); + if (checkVal != null && checkVal.contains(";")) { + List pdpDefault = new ArrayList<>(Arrays.asList(checkVal.split("\\s*;\\s*"))); int pdpCount = 0; - while (pdpCount < pdp_default.size()) { - String pdpVal = pdp_default.get(pdpCount); + while (pdpCount < pdpDefault.size()) { + String pdpVal = pdpDefault.get(pdpCount); readPDPParam(pdpVal); pdpCount++; }