diff options
author | Daniel Cruz <dc443y@att.com> | 2019-02-22 11:31:17 -0600 |
---|---|---|
committer | Daniel Cruz <dc443y@att.com> | 2019-03-01 18:44:07 -0600 |
commit | 62e4281c0b76ecfde85d094533edd6693c2c1c5b (patch) | |
tree | 2baa4f571756c90cbbf806afa53d7ff17865935a /policy-management/src/main/java/org/onap/policy/drools/features | |
parent | 5ac447f758d9b7a7baaf0e24a0e8621a15b8c5ff (diff) |
Add Controller Logging Feature
This features provides a mechanism to extend the logback.xml
properties to add controller specific loggers. The controller's
logger will log messages from topics that the controller listens
to in a controller specific network log. The original network
log is preserved and still logs every message from every controller.
Note that the way a logger is associated with a controller is by
having the logger name match the controller's name. Any configuration
file that has "logback-include-" prepended and a ".xml" extension
will be added to the logback.xml and logback-eelf.xml files as
extensions to the base configuration.
Issue-ID: POLICY-1427
Change-Id: Iaeb823421eadb7ee413b6b03ae3dfe862f230612
Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'policy-management/src/main/java/org/onap/policy/drools/features')
2 files changed, 90 insertions, 44 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 135e1c58..d8663f10 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,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 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. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,6 +20,7 @@ package org.onap.policy.drools.features; +import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.utils.OrderedService; import org.onap.policy.drools.utils.OrderedServiceImpl; @@ -53,6 +54,28 @@ public interface DroolsControllerFeatureAPI extends OrderedService { } /** + * Intercept before the Drools Controller delivers (posts) an event. + * + * @return True if this feature intercepts and takes ownership + * of the operation preventing the invocation of + * lower priority features. False, otherwise + */ + default boolean beforeDeliver(DroolsController controller, TopicSink sink, Object fact) { + return false; + } + + /** + * Called after the Drools Controller delivers (posts) an event. + * + * @return True if this feature intercepts and takes ownership of the operation + * preventing the invocation of lower priority features. False, otherwise + */ + default boolean afterDeliver(DroolsController controller, TopicSink sink, Object fact, String json, + boolean success) { + return false; + } + + /** * Feature providers implementing this interface. */ public static final OrderedServiceImpl<DroolsControllerFeatureAPI> providers = diff --git a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureAPI.java b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureAPI.java index c86f6e0d..a8772117 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureAPI.java +++ b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureAPI.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * policy-engine * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,7 +21,8 @@ package org.onap.policy.drools.features; import java.util.Properties; - +import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.drools.protocol.configuration.PdpdConfiguration; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.drools.utils.OrderedService; import org.onap.policy.drools.utils.OrderedServiceImpl; @@ -34,14 +35,14 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * Feature providers implementing this interface. */ - public static final OrderedServiceImpl<PolicyEngineFeatureAPI> providers = + public static final OrderedServiceImpl<PolicyEngineFeatureAPI> providers = new OrderedServiceImpl<>(PolicyEngineFeatureAPI.class); /** * intercept before the Policy Engine is commanded to boot. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean beforeBoot(PolicyEngine engine, String[] cliArgs) { @@ -50,9 +51,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept after the Policy Engine is booted. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean afterBoot(PolicyEngine engine) { @@ -61,9 +62,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept before the Policy Engine is configured. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean beforeConfigure(PolicyEngine engine, Properties properties) { @@ -72,9 +73,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept after the Policy Engine is configured. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean afterConfigure(PolicyEngine engine) { @@ -83,9 +84,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept before the Policy Engine goes active. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean beforeActivate(PolicyEngine engine) { @@ -94,9 +95,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept after the Policy Engine goes active. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean afterActivate(PolicyEngine engine) { @@ -105,9 +106,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept before the Policy Engine goes standby. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean beforeDeactivate(PolicyEngine engine) { @@ -116,9 +117,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept after the Policy Engine goes standby. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean afterDeactivate(PolicyEngine engine) { @@ -127,9 +128,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept before the Policy Engine is started. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean beforeStart(PolicyEngine engine) { @@ -138,9 +139,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept after the Policy Engine is started. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean afterStart(PolicyEngine engine) { @@ -149,9 +150,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept before the Policy Engine is stopped. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise.. */ public default boolean beforeStop(PolicyEngine engine) { @@ -160,9 +161,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept after the Policy Engine is stopped. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise.d. */ public default boolean afterStop(PolicyEngine engine) { @@ -171,9 +172,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept before the Policy Engine is locked. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean beforeLock(PolicyEngine engine) { @@ -182,9 +183,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept after the Policy Engine is locked. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise.. */ public default boolean afterLock(PolicyEngine engine) { @@ -193,9 +194,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept before the Policy Engine is locked. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean beforeUnlock(PolicyEngine engine) { @@ -204,9 +205,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept after the Policy Engine is locked. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean afterUnlock(PolicyEngine engine) { @@ -215,9 +216,9 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * intercept the Policy Engine is shut down. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise.. */ public default boolean beforeShutdown(PolicyEngine engine) { @@ -226,12 +227,34 @@ public interface PolicyEngineFeatureAPI extends OrderedService { /** * called after the Policy Engine is shut down. - * + * * @return true if this feature intercepts and takes ownership - * of the operation preventing the invocation of + * of the operation preventing the invocation of * lower priority features. False, otherwise. */ public default boolean afterShutdown(PolicyEngine engine) { return false; } + + /** + * Intercept an event from UEB/DMaaP before the PolicyEngine processes it. + * + * @return True if this feature intercepts and takes ownership of the operation + * preventing the invocation of lower priority features. False, otherwise. + */ + public default boolean beforeOnTopicEvent(PolicyEngine engine, CommInfrastructure commType, String topic, + String event) { + return false; + } + + /** + * Called after the PolicyEngine processes the events. + * + * @return True if this feature intercepts and takes ownership of the operation + * preventing the invocation of lower priority features. False, otherwise + */ + public default boolean afterOnTopicEvent(PolicyEngine engine, PdpdConfiguration configuration, + CommInfrastructure commType, String topic, String event) { + return false; + } } |