summaryrefslogtreecommitdiffstats
path: root/policy-management/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'policy-management/src/main')
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java1
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java14
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java10
3 files changed, 16 insertions, 9 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java
index a4c546f8..e5128bb5 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java
@@ -95,7 +95,6 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory {
}
List<TopicCoderFilterConfiguration> topics2DecodedClasses2Filters = codersAndFilters(properties, eventSources);
-
List<TopicCoderFilterConfiguration> topics2EncodedClasses2Filters = codersAndFilters(properties, eventSinks);
return this.build(groupId, artifactId, version, topics2DecodedClasses2Filters, topics2EncodedClasses2Filters);
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java
index 0d7806c6..528f1e0d 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -122,7 +122,7 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory {
* {@inheritDoc}.
*/
@Override
- public void patch(PolicyController controller, DroolsConfiguration droolsConfig) {
+ public synchronized void patch(PolicyController controller, DroolsConfiguration droolsConfig) {
if (controller == null) {
throw new IllegalArgumentException("Not a valid controller: null");
@@ -132,20 +132,22 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory {
throw new IllegalArgumentException("Invalid Drools Configuration");
}
+ if (controller.getDrools().isBrained()) {
+ this.coordinates2Controller.remove(
+ toKey(controller.getDrools().getGroupId(), controller.getDrools().getArtifactId()));
+ }
+
if (!controller.updateDrools(droolsConfig)) {
logger.warn("Cannot update drools configuration: {} on {}", droolsConfig, this);
throw new IllegalArgumentException("Cannot update drools configuration Drools Configuration");
}
logger.info("UPDATED drools configuration: {} on {}", droolsConfig, this);
-
- String coordinates = toKey(controller.getDrools().getGroupId(),
- controller.getDrools().getArtifactId());
+ String coordinates = toKey(controller.getDrools().getGroupId(), controller.getDrools().getArtifactId());
if (controller.getDrools().isBrained()) {
this.coordinates2Controller.put(coordinates, controller);
}
-
}
/**
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java
index aa57abaf..1fd42546 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java
@@ -1,8 +1,8 @@
/*
* ============LICENSE_START=======================================================
- * policy-management
+ * ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -226,6 +226,12 @@ public class AggregatedPolicyController implements PolicyController, TopicListen
return true;
}
+ if (droolsController.isBrained()
+ && (newDroolsConfiguration.getArtifactId() == null
+ || DroolsControllerConstants.NO_ARTIFACT_ID.equals(newDroolsConfiguration.getArtifactId()))) {
+ DroolsControllerConstants.getFactory().destroy(this.droolsController);
+ }
+
try {
/* Drools Controller created, update initialization properties for restarts */