From d9007d680d19734d5dc106479784c420236cca4b Mon Sep 17 00:00:00 2001 From: Ravindra Bakkamanthala Date: Wed, 31 May 2017 15:54:24 -0400 Subject: [Policy-17] Removed the sql scripts from sdk app Change-Id: I5b017aad569014c7f12eab35e1dbd1c215f90ebe Signed-off-by: Ravindra Bakkamanthala --- .../openecomp/policy/pdp/rest/PapUrlResolver.java | 49 +++++++++++----------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/PapUrlResolver.java') diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/PapUrlResolver.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/PapUrlResolver.java index 44a1f5e17..9d7ebbe6e 100644 --- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/PapUrlResolver.java +++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/PapUrlResolver.java @@ -24,35 +24,34 @@ import java.net.URI; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.Date; import java.util.NoSuchElementException; import java.util.Properties; +import org.openecomp.policy.common.logging.flexlogger.FlexLogger; +import org.openecomp.policy.common.logging.flexlogger.Logger; import org.openecomp.policy.rest.XACMLRestProperties; import com.att.research.xacml.util.XACMLProperties; -import org.openecomp.policy.common.logging.flexlogger.*; - public class PapUrlResolver { private static final Logger LOGGER = FlexLogger.getLogger(PapUrlResolver.class); //how long to keep a pap failed before making it un-failed, in milli-seconds private static final long FAIL_TIMEOUT = 18000000; //thread locks - public static Object propertyLock = new Object(); + public static final Object propertyLock = new Object(); - public static void setPapUrls(String[] papUrls){ - - } //keeping this here for backward compatibility public static String extractIdFromUrl(String url){ return extractQuery(url); } public static String extractQuery(String url){ try{ - return URI.create(url).getQuery(); + return URI.create(url).getQuery(); } catch(Exception e){ + LOGGER.error("Exception occured while extracting query. So, empty string is returned"+e); return ""; } } @@ -92,22 +91,24 @@ public class PapUrlResolver { //because it is used for a difference purpose. private PapUrlResolver(String urlList, String failedList, String succeededList, boolean autoUpdateProperties){ this.autoUpdateProperties = autoUpdateProperties; - //synchronized(propertyLock){ - if(urlList == null){ - urlList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URLS); - if(urlList == null){ - urlList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL); + String papUrlLists = urlList; + String papUrlFailedList = failedList; + String papUrlSuccessList = succeededList; + if(papUrlLists == null){ + papUrlLists = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URLS); + if(papUrlLists == null){ + papUrlLists = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL); } - failedList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS); - succeededList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS); + papUrlFailedList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS); + papUrlSuccessList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS); } - //} - String[] urls = urlList.split(","); + + String[] urls = papUrlLists.split(","); if(urls.length == 0){ //log error } - String[] failed = emptyOrSplit(failedList,urls.length); - String[] succeeded = emptyOrSplit(succeededList,urls.length); + String[] failed = emptyOrSplit(papUrlFailedList,urls.length); + String[] succeeded = emptyOrSplit(papUrlSuccessList,urls.length); sortedUrlNodes = new PapUrlNode[urls.length]; for(int i=0;i