From 87c95be02a8a4d77e165dede90777e811b59dcae Mon Sep 17 00:00:00 2001 From: Ravindra Bakkamanthala Date: Tue, 23 May 2017 14:56:12 -0400 Subject: Commit includes ControlLoopPolicy API and bugfixes Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63 Signed-off-by: Ravindra Bakkamanthala --- .../policy/brmsInterface/BRMSHandler.java | 3 +- .../openecomp/policy/brmsInterface/BRMSPush.java | 34 +++++++++++----------- BRMSGateway/src/main/resources/logback.xml | 2 +- 3 files changed, 19 insertions(+), 20 deletions(-) (limited to 'BRMSGateway/src/main') diff --git a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java index b28624e61..ef990aa01 100644 --- a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java +++ b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java @@ -125,7 +125,6 @@ public class BRMSHandler implements BackUpHandler{ ArrayList brmsPolicies = addedPolicies(notification); Boolean successFlag = false; for(int i=0; !successFlag && i< bRMSPush.URLListSize(); i++){ - successFlag = false; if(i!=0 && !successFlag){ for(PolicyConfig policyConfig: brmsPolicies){ logger.info("Policy Retry with this Name notified: " + policyConfig.getPolicyName()); @@ -148,7 +147,7 @@ public class BRMSHandler implements BackUpHandler{ * Executed when a policy is added to PDP. */ private ArrayList addedPolicies(PDPNotification notification) { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){ logger.info("policyName : " + updatedPolicy.getPolicyName()); logger.info("policyVersion :" + updatedPolicy.getVersionNo()); diff --git a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java index 7e9b64c33..1fbd2aa08 100644 --- a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java +++ b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java @@ -110,7 +110,7 @@ public class BRMSPush { private static final String DEFAULT_VERSION = "1.1.0-SNAPSHOT"; private static final String DEPENDENCY_FILE = "dependency.json"; - private static Map modifiedGroups = new HashMap(); + private static Map modifiedGroups = new HashMap<>(); private static IntegrityMonitor im; private static BackUpMonitor bm; private static String resourceName = null; @@ -131,8 +131,8 @@ public class BRMSPush { private Long dmaapDelay = Long.parseLong("5000"); private String notificationType = null; private ArrayList controllers; - private HashMap> groupMap = new HashMap>(); - private Map policyMap = new HashMap(); + private HashMap> groupMap = new HashMap<>(); + private Map policyMap = new HashMap<>(); private String brmsdependencyversion; private EntityManager em; private boolean syncFlag = false; @@ -206,7 +206,7 @@ public class BRMSPush { throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + "repositoryURL property is missing from the property file "); } if(repURL.contains(",")){ - repURLs = new ArrayList(Arrays.asList(repURL.trim().split(","))); + repURLs = new ArrayList<>(Arrays.asList(repURL.trim().split(","))); }else{ repURLs = new ArrayList<>(); repURLs.add(repURL); @@ -258,9 +258,9 @@ public class BRMSPush { pubTopic = pubTopic.trim(); if(dmaapServers.contains(",")) { - dmaapList = new ArrayList(Arrays.asList(dmaapServers.split("\\s*,\\s*"))); + dmaapList = new ArrayList<>(Arrays.asList(dmaapServers.split("\\s*,\\s*"))); } else { - dmaapList = new ArrayList(); + dmaapList = new ArrayList<>(); dmaapList.add(dmaapServers); } @@ -322,8 +322,8 @@ public class BRMSPush { * Will Initialize the variables required for BRMSPush. */ public void initiate(boolean flag) { - modifiedGroups = new HashMap(); - controllers = new ArrayList(); + modifiedGroups = new HashMap<>(); + controllers = new ArrayList<>(); try { bm.updateNotification(); } catch (Exception e) { @@ -346,7 +346,7 @@ public class BRMSPush { if(!responseAttributes.isEmpty()){ // Pick selected Value String userControllerName = null; - ArrayList userDependencies = new ArrayList(); + ArrayList userDependencies = new ArrayList<>(); for(String key: responseAttributes.keySet()){ if(key.equals(policyKeyID)){ selectedName = responseAttributes.get(key); @@ -421,7 +421,7 @@ public class BRMSPush { dependency.setArtifactId(brmsGroupInfo.getArtifactId()); dependency.setGroupId(brmsGroupInfo.getGroupId()); dependency.setVersion(brmsGroupInfo.getVersion()); - ArrayList values = new ArrayList(); + ArrayList values = new ArrayList<>(); values.add(dependency); groupMap.put(brmsGroupInfo.getControllerName(), values); } @@ -756,7 +756,7 @@ public class BRMSPush { ControllerPOJO controllerPOJO = new ControllerPOJO(); controllerPOJO.setName(controllerName); controllerPOJO.setOperation(operation); - HashMap drools = new HashMap(); + HashMap drools = new HashMap<>(); drools.put("groupId", getGroupID(controllerName)); drools.put("artifactId", getArtifactID(controllerName)); drools.put("version", getVersion(controllerName)); @@ -776,7 +776,7 @@ public class BRMSPush { ControllerPOJO controllerPOJO = new ControllerPOJO(); controllerPOJO.setName(controllerName); controllerPOJO.setOperation("lock"); - List controllers = new ArrayList(); + List controllers = new ArrayList<>(); controllers.add(controllerPOJO); sendNotification(controllers); } @@ -841,7 +841,7 @@ public class BRMSPush { distributionManagement.setRepository(repository); model.setDistributionManagement(distributionManagement); // Dependency Management goes here. - List dependencyList= new ArrayList(); + List dependencyList= new ArrayList<>(); if(groupMap.get(name).size()>1){ @SuppressWarnings("unchecked") ArrayList dependencies = (ArrayList) groupMap.get(name).get(1); @@ -880,7 +880,7 @@ public class BRMSPush { if(dependencyInfo.getDependencies().containsKey(controllerName)){ controller = controllerName; } - List dependencyList = new ArrayList(); + List dependencyList = new ArrayList<>(); for(PEDependency dependency: dependencyInfo.getDependencies().get(controller)){ dependencyList.add(dependency.getDependency()); } @@ -897,7 +897,7 @@ public class BRMSPush { // Default Dependency Section. Can be changed as required. public List defaultDependencies(String controllerName) { - List dependencyList = new ArrayList(); + List dependencyList = new ArrayList<>(); String version= StringEscapeUtils.escapeJava(brmsdependencyversion); Dependency demoDependency = new Dependency(); @@ -977,7 +977,7 @@ public class BRMSPush { LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "groupNames property is missing or empty from the property file "); throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + "groupNames property is missing or empty from the property file "); } - groupMap = new HashMap>(); + groupMap = new HashMap<>(); for(int counter=0; counter < groupNames.length ;counter++){ String name = groupNames[counter]; String groupID = config.getProperty(name+".groupID"); @@ -999,7 +999,7 @@ public class BRMSPush { } private void addToGroup(String name, PEDependency dependency) { - ArrayList values = new ArrayList(); + ArrayList values = new ArrayList<>(); values.add(dependency); groupMap.put(name, values); EntityTransaction et = em.getTransaction(); diff --git a/BRMSGateway/src/main/resources/logback.xml b/BRMSGateway/src/main/resources/logback.xml index 2c67db9cb..2cae6c8f2 100644 --- a/BRMSGateway/src/main/resources/logback.xml +++ b/BRMSGateway/src/main/resources/logback.xml @@ -205,7 +205,7 @@ 9 - INFO + DEBUG -- cgit 1.2.3-korg