diff options
author | jhh <jorge.hernandez-herrero@att.com> | 2020-03-31 21:05:14 -0500 |
---|---|---|
committer | jhh <jorge.hernandez-herrero@att.com> | 2020-04-01 10:59:29 -0500 |
commit | ece155048af47ea83ff898c999aa5137dc99a988 (patch) | |
tree | 25af254f7cbbb42a99b9b98d5e6767c65aef563d /policy-management | |
parent | 565b43c67c8964fe9e046435307e479921881566 (diff) |
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 <jorge.hernandez-herrero@att.com>
Change-Id: I62bbc03411446849eaa55c9b1524220dc13c2cb0
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'policy-management')
2 files changed, 7 insertions, 4 deletions
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)); |