diff options
author | Ravindra Bakkamanthala <rb7147@att.com> | 2017-05-23 14:56:12 -0400 |
---|---|---|
committer | Ravindra Bakkamanthala <rb7147@att.com> | 2017-05-23 16:49:56 -0400 |
commit | 87c95be02a8a4d77e165dede90777e811b59dcae (patch) | |
tree | 4712199fc3520b530dda0c4d3b074c327df547f2 /PolicyEngineAPI/src/main/java/org/openecomp | |
parent | 7e547eaa55920dfbc9691eab33bb728395b50cf2 (diff) |
Commit includes ControlLoopPolicy API and bugfixes
Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63
Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
Diffstat (limited to 'PolicyEngineAPI/src/main/java/org/openecomp')
7 files changed, 28 insertions, 34 deletions
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java index 4fad508f6..4e2c092c1 100644 --- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java +++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java @@ -326,8 +326,8 @@ public class PolicyEngine{ /** * Retrieves the count of policies on the PAP, PDP, and Policy Engine as a whole * - * @param parameters {@link com.att.labs.ecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics - * @return {@link com.att.labs.ecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request. + * @param parameters {@link org.openecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics + * @return {@link org.openecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request. * @throws PolicyException PolicyException related to the operation * * */ diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java index 91d81d043..782187720 100644 --- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java +++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java @@ -22,7 +22,6 @@ package org.openecomp.policy.std; import java.net.MalformedURLException; import java.net.URL; -import java.security.GeneralSecurityException; import java.util.List; import java.util.UUID; @@ -127,11 +126,9 @@ public class AutoClientUEB implements Runnable { CConsumer = builder.build(); - } catch (MalformedURLException e1) { - e1.printStackTrace(); - } catch (GeneralSecurityException e1) { - e1.printStackTrace(); - } + } catch (Exception e1) { + logger.error("Exception Occured" + e1); + } while (this.isRunning() ) { try { diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java index 0e30ada39..f4a218d66 100644 --- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java +++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java @@ -60,7 +60,9 @@ public class ManualClientEndDMAAP { } catch (Exception e) { logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Unable to create DMaaP Publisher: ", e); } - pub.close (); + if(pub != null){ + pub.close (); + } } //NOTE: should be able to remove this for DMAAP since we will not be creating topics dynamically diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java index f2a6a96d8..287e5c851 100644 --- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java +++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java @@ -23,7 +23,6 @@ package org.openecomp.policy.std; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; -import java.security.GeneralSecurityException; import java.util.List; import org.json.JSONObject; @@ -90,10 +89,8 @@ public class ManualClientEndUEB { CambriaPublisher pub = null; try { pub = CambriaClientFactory.createSimplePublisher(null, UEBlist, pubTopic); - } catch (MalformedURLException e1) { - e1.printStackTrace(); - } catch (GeneralSecurityException e1) { - e1.printStackTrace(); + } catch (Exception e1) { + logger.error("Exception Occured"+e1); } final JSONObject msg1 = new JSONObject (); @@ -135,11 +132,9 @@ public class ManualClientEndUEB { String id = "0"; try { CConsumer = CambriaClientFactory.createConsumer ( null, uebURLList, topic + uniquID, "clientGroup", id, 15*1000, 1000 ); - } catch (MalformedURLException e1) { - e1.printStackTrace(); - } catch (GeneralSecurityException e1) { - e1.printStackTrace(); - } + } catch (Exception e1) { + logger.error("Exception Occured"+e1); + } int count = 1; while (count < 4) { publishMessage(topic + "UpdateRequest", uniquID, uebURLList); diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java index ac3c9e968..1459dd9d9 100644 --- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java +++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java @@ -34,7 +34,7 @@ import org.openecomp.policy.std.StdRemovedPolicy; import org.openecomp.policy.common.logging.flexlogger.*; public class MatchStore { - private static HashSet<Matches> matchStore = new HashSet<Matches>(); + private static HashSet<Matches> matchStore = new HashSet<>(); private static Logger logger = FlexLogger.getLogger(MatchStore.class.getName()); public static HashSet<Matches> getMatchStore() { @@ -115,7 +115,7 @@ public class MatchStore { } if(oldNotification.getRemovedPolicies()!=null && !oldNotification.getRemovedPolicies().isEmpty()){ // send all removed policies to client. - Collection<StdRemovedPolicy> removedPolicies = new HashSet<StdRemovedPolicy>(); + Collection<StdRemovedPolicy> removedPolicies = new HashSet<>(); StdRemovedPolicy newRemovedPolicy; for(RemovedPolicy removedPolicy: oldNotification.getRemovedPolicies()){ newRemovedPolicy = new StdRemovedPolicy(); @@ -127,7 +127,7 @@ public class MatchStore { removed = true; } if(oldNotification.getLoadedPolicies()!=null && !oldNotification.getLoadedPolicies().isEmpty()){ - Collection<StdLoadedPolicy> updatedPolicies = new HashSet<StdLoadedPolicy>(); + Collection<StdLoadedPolicy> updatedPolicies = new HashSet<>(); StdLoadedPolicy newUpdatedPolicy; for(LoadedPolicy updatedPolicy: oldNotification.getLoadedPolicies()){ // if it is config policies check their matches.. diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java index a09391baf..196f89b3d 100644 --- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java +++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java @@ -39,7 +39,7 @@ public class NotificationUnMarshal { notification = mapper.readValue(json, StdPDPNotification.class); if(notification!=null){ if(notification.getLoadedPolicies()!=null){ - Collection<StdLoadedPolicy> stdLoadedPolicies = new ArrayList<StdLoadedPolicy>(); + Collection<StdLoadedPolicy> stdLoadedPolicies = new ArrayList<>(); for(LoadedPolicy loadedPolicy: notification.getLoadedPolicies()){ StdLoadedPolicy stdLoadedPolicy = (StdLoadedPolicy) loadedPolicy; if(notification.getRemovedPolicies()!=null){ diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java index abe5ee767..5b10f3066 100644 --- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java +++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java @@ -97,9 +97,9 @@ import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; import org.xml.sax.InputSource; -import com.att.aft.dme2.internal.gson.Gson; -import com.att.aft.dme2.internal.gson.GsonBuilder; import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; /** * PolicyEngine Implementation class @@ -565,7 +565,7 @@ public class StdPolicyEngine { public Collection<PolicyConfig> getConfigImpl(ConfigRequestParameters configRequestParameters) throws PolicyConfigException{ String resource= "getConfig"; - ArrayList<PolicyConfig> response = new ArrayList<PolicyConfig>(); + ArrayList<PolicyConfig> response = new ArrayList<>(); String body = new String(); // Create Request. try { @@ -598,7 +598,7 @@ public class StdPolicyEngine { } private ArrayList<PolicyConfig> configResult(APIPolicyConfigResponse[] response) throws PolicyConfigException { - ArrayList<PolicyConfig> result = new ArrayList<PolicyConfig>(); + ArrayList<PolicyConfig> result = new ArrayList<>(); if(response!=null && response.length>0){ for(APIPolicyConfigResponse policyConfigResponse: response){ StdPolicyConfig policyConfig = new StdPolicyConfig(); @@ -647,7 +647,7 @@ public class StdPolicyEngine { private void setMatches(Map<String, String> matchingConditions) { Matches match = new Matches(); - HashMap<String, String> configAttributes = new HashMap<String,String>(); + HashMap<String, String> configAttributes = new HashMap<>(); try{ for(String key: matchingConditions.keySet()){ if(key.equalsIgnoreCase("ECOMPName")){ @@ -741,7 +741,7 @@ public class StdPolicyEngine { } public Collection<String> listConfigImpl(ConfigRequestParameters listRequestParameters) throws PolicyConfigException{ - Collection<String> policyList = new ArrayList<String>(); + Collection<String> policyList = new ArrayList<>(); if (junit){ policyList.add("Policy Name: listConfigTest"); return policyList; @@ -796,7 +796,7 @@ public class StdPolicyEngine { } private ArrayList<PolicyResponse> eventResult(StdPolicyResponse[] response) throws PolicyEventException{ - ArrayList<PolicyResponse> eventResult = new ArrayList<PolicyResponse>(); + ArrayList<PolicyResponse> eventResult = new ArrayList<>(); if(response!=null && response.length>0){ for(StdPolicyResponse policyConfigResponse: response){ eventResult.add(policyConfigResponse); @@ -860,7 +860,7 @@ public class StdPolicyEngine { typeDefault = new ArrayList<String>(Arrays.asList(prop.getProperty("NOTIFICATION_TYPE").split(","))); notificationType = typeDefault; } else { - notificationType = new ArrayList<String>(); + notificationType = new ArrayList<>(); notificationType.add(check_type); } } @@ -873,7 +873,7 @@ public class StdPolicyEngine { if(serverList.contains(",")) { notificationURLList = new ArrayList<String>(Arrays.asList(serverList.split(","))); } else { - notificationURLList = new ArrayList<String>(); + notificationURLList = new ArrayList<>(); notificationURLList.add(serverList); } } @@ -911,8 +911,8 @@ public class StdPolicyEngine { environment = Environment.DEVL.toString(); } // Initializing the values. - pdps = new ArrayList<String>(); - encoding = new ArrayList<String>(); + pdps = new ArrayList<>(); + encoding = new ArrayList<>(); // Check the Keys for PDP_URLs Collection<Object> unsorted = prop.keySet(); @SuppressWarnings({ "rawtypes", "unchecked" }) |