From ece155048af47ea83ff898c999aa5137dc99a988 Mon Sep 17 00:00:00 2001 From: jhh Date: Tue, 31 Mar 2020 21:05:14 -0500 Subject: Sync controller capabilities as controllers bounce As native policies introduce temporality in policy types supported as they are removed and added, the associated policy types that can be honored at a a given time, may need to adjust. A significan portion of this review is dedicated to multi-policy junits and telemetry instrumentation. Issue-ID: POLICY-2459 Signed-off-by: jhh Change-Id: I62bbc03411446849eaa55c9b1524220dc13c2cb0 Signed-off-by: jhh --- .../onap/policy/drools/features/PolicyControllerFeatureApi.java | 7 +++++-- .../policy/drools/system/internal/AggregatedPolicyController.java | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'policy-management') diff --git a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyControllerFeatureApi.java b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyControllerFeatureApi.java index 49287786..d11863f0 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyControllerFeatureApi.java +++ b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyControllerFeatureApi.java @@ -108,7 +108,8 @@ public interface PolicyControllerFeatureApi extends OrderedService { * of the operation preventing the invocation of * lower priority features. False, otherwise. */ - default boolean beforePatch(PolicyController controller, DroolsConfiguration configuration) { + default boolean beforePatch( + PolicyController controller, DroolsConfiguration oldConfiguration, DroolsConfiguration newConfiguration) { return false; } @@ -119,7 +120,9 @@ public interface PolicyControllerFeatureApi extends OrderedService { * of the operation preventing the invocation of * lower priority features. False, otherwise. */ - default boolean afterPatch(PolicyController controller, boolean success) { + default boolean afterPatch( + PolicyController controller, DroolsConfiguration oldConfiguration, + DroolsConfiguration newConfiguration, boolean success) { return false; } 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 b80f4c86..0c12dbcb 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 @@ -227,7 +227,7 @@ public class AggregatedPolicyController implements PolicyController, TopicListen } if (FeatureApiUtils.apply(getProviders(), - feature -> feature.beforePatch(this, newDroolsConfiguration), + feature -> feature.beforePatch(this, oldDroolsConfiguration, newDroolsConfiguration), (feature, ex) -> logger.error("{}: feature {} before-patch failure because of {}", this, feature.getClass().getName(), ex.getMessage(), ex))) { return true; @@ -268,7 +268,7 @@ public class AggregatedPolicyController implements PolicyController, TopicListen boolean finalSuccess = success; FeatureApiUtils.apply(getProviders(), - feature -> feature.afterPatch(this, finalSuccess), + feature -> feature.afterPatch(this, oldDroolsConfiguration, newDroolsConfiguration, finalSuccess), (feature, ex) -> logger.error("{}: feature {} after-patch failure because of {}", this, feature.getClass().getName(), ex.getMessage(), ex)); -- cgit 1.2.3-korg