diff options
author | Straubs, Ralph (rs8887) <rs8887@att.com> | 2020-07-13 10:26:50 -0400 |
---|---|---|
committer | jhh <jorge.hernandez-herrero@att.com> | 2020-07-21 08:42:21 -0500 |
commit | 8382101e6c43578b6c78dfc10bacbd165e413c69 (patch) | |
tree | 3907554ceb32fd3fbf157e33d0c5698810aa61e8 /policy-management/src/main/java/org/onap/policy/drools/features | |
parent | e7f57317f694c7a2a673e37dbfdd6275adcd74c0 (diff) |
Support multiple Policy/Controller types using 'controller.type' property
It provides a feature base to allow for custom Policy
and Drools Controllers.
Issue-ID: POLICY-2415
Change-Id: Ibe3f11e3ecd925537ffd03d2420bb3b8214029c9
Signed-off-by: Straubs, Ralph (rs8887) <rs8887@att.com>
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'policy-management/src/main/java/org/onap/policy/drools/features')
2 files changed, 62 insertions, 1 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/features/DroolsControllerFeatureApi.java b/policy-management/src/main/java/org/onap/policy/drools/features/DroolsControllerFeatureApi.java index abf524e4..bb11bb64 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/features/DroolsControllerFeatureApi.java +++ b/policy-management/src/main/java/org/onap/policy/drools/features/DroolsControllerFeatureApi.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-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. @@ -20,9 +20,12 @@ package org.onap.policy.drools.features; +import java.util.List; +import java.util.Properties; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.utils.services.OrderedService; import org.onap.policy.drools.controller.DroolsController; +import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration; /** * Drools Controller Feature API. Hooks into the Drools Controller operations. @@ -30,6 +33,38 @@ import org.onap.policy.drools.controller.DroolsController; public interface DroolsControllerFeatureApi extends OrderedService { /** + * intercepts the instantiation of a DroolsController. + * + * @param properties controller properties + * @param groupId group id coordinate + * @param artifactId artifact id coordinate + * @param version version coordinate + * @param decoderConfigurations decoder configurations + * @param encoderConfigurations encoder configurations + * + * @return a Drools Controller or 'null' for no intercept + */ + default DroolsController beforeInstance(Properties properties, + String groupId, String artifactId, String version, + List<TopicCoderFilterConfiguration> decoderConfigurations, + List<TopicCoderFilterConfiguration> encoderConfigurations) { + return null; + } + + /** + * called after a DroolsController is instantiated. + * + * @param droolsController drools controller + * @param properties controller properties + * + * @return True if this feature intercepts and takes ownership of the operation + * preventing the invocation of lower priority features. False, otherwise + */ + default boolean afterInstance(DroolsController droolsController, Properties properties) { + return false; + } + + /** * intercepts before the Drools Controller gives the Policy Container a fact to * insert into its Policy Sessions. * 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 d11863f0..f022bf1d 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 @@ -58,6 +58,32 @@ public interface PolicyControllerFeatureApi extends OrderedService { } /** + * called before the actual instantiation of a Policy Controller. + * + * @param name name of the controller + * @param properties configuration parameters in the form of properties + * + * @return a Policy Controller or 'null for no intercept. + */ + default PolicyController beforeInstance(String name, Properties properties) { + return null; + } + + /** + * called after the Policy Controller is instantiated. + * + * @param controller policy controller + * @param properties configuration parameters in the form of properties + * + * @return true if this feature intercepts and takes ownership + * of the operation preventing the invocation of + * lower priority features. False, otherwise. + */ + default boolean afterInstance(PolicyController controller, Properties properties) { + return false; + } + + /** * intercept before the Policy Controller is started. * * @return true if this feature intercepts and takes ownership |