aboutsummaryrefslogtreecommitdiffstats
path: root/BRMSGateway/src/main/java
diff options
context:
space:
mode:
authorRavindra Bakkamanthala <rb7147@att.com>2017-05-23 14:56:12 -0400
committerRavindra Bakkamanthala <rb7147@att.com>2017-05-23 16:49:56 -0400
commit87c95be02a8a4d77e165dede90777e811b59dcae (patch)
tree4712199fc3520b530dda0c4d3b074c327df547f2 /BRMSGateway/src/main/java
parent7e547eaa55920dfbc9691eab33bb728395b50cf2 (diff)
Commit includes ControlLoopPolicy API and bugfixes
Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63 Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
Diffstat (limited to 'BRMSGateway/src/main/java')
-rw-r--r--BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java3
-rw-r--r--BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java34
2 files changed, 18 insertions, 19 deletions
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<PolicyConfig> 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<PolicyConfig> addedPolicies(PDPNotification notification) {
- ArrayList<PolicyConfig> result = new ArrayList<PolicyConfig>();
+ ArrayList<PolicyConfig> 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<String, String> modifiedGroups = new HashMap<String, String>();
+ private static Map<String, String> 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<ControllerPOJO> controllers;
- private HashMap<String, ArrayList<Object>> groupMap = new HashMap<String, ArrayList<Object>>();
- private Map<String, String> policyMap = new HashMap<String,String>();
+ private HashMap<String, ArrayList<Object>> groupMap = new HashMap<>();
+ private Map<String, String> 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<String>(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<String>(Arrays.asList(dmaapServers.split("\\s*,\\s*")));
+ dmaapList = new ArrayList<>(Arrays.asList(dmaapServers.split("\\s*,\\s*")));
} else {
- dmaapList = new ArrayList<String>();
+ 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<String, String>();
- controllers = new ArrayList<ControllerPOJO>();
+ 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<PEDependency> userDependencies = new ArrayList<PEDependency>();
+ ArrayList<PEDependency> 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<Object> values = new ArrayList<Object>();
+ ArrayList<Object> 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<String, String> drools = new HashMap<String, String>();
+ HashMap<String, String> 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<ControllerPOJO> controllers = new ArrayList<ControllerPOJO>();
+ List<ControllerPOJO> 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<Dependency> dependencyList= new ArrayList<Dependency>();
+ List<Dependency> dependencyList= new ArrayList<>();
if(groupMap.get(name).size()>1){
@SuppressWarnings("unchecked")
ArrayList<PEDependency> dependencies = (ArrayList<PEDependency>) groupMap.get(name).get(1);
@@ -880,7 +880,7 @@ public class BRMSPush {
if(dependencyInfo.getDependencies().containsKey(controllerName)){
controller = controllerName;
}
- List<Dependency> dependencyList = new ArrayList<Dependency>();
+ List<Dependency> 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<Dependency> defaultDependencies(String controllerName) {
- List<Dependency> dependencyList = new ArrayList<Dependency>();
+ List<Dependency> 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<String, ArrayList<Object>>();
+ 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<Object> values = new ArrayList<Object>();
+ ArrayList<Object> values = new ArrayList<>();
values.add(dependency);
groupMap.put(name, values);
EntityTransaction et = em.getTransaction();