2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.openecomp.policy.drools.features;
 
  23 import java.util.Properties;
 
  25 import org.openecomp.policy.drools.event.comm.Topic.CommInfrastructure;
 
  26 import org.openecomp.policy.drools.system.PolicyController;
 
  27 import org.openecomp.policy.drools.utils.OrderedService;
 
  28 import org.openecomp.policy.drools.utils.OrderedServiceImpl;
 
  30 public interface PolicyControllerFeatureAPI extends OrderedService {
 
  33            * called before creating a controller with name 'name' and 
 
  34            * properties 'properties'
 
  36            * @param name name of the the controller
 
  37            * @param properties configuration properties
 
  39            * @return a policy controller.   A take over of the creation operation
 
  40            * is performed by returning a non-null policy controller.   
 
  41            * 'null' indicates that no take over has taken place, and processing should
 
  42            * continue to the next feature provider.
 
  44           public default PolicyController beforeCreate(String name, Properties properties) {return null;}
 
  47            * called after creating a controller with name 'name'
 
  49            * @param controller controller
 
  51            * @return true if this feature intercepts and takes ownership
 
  52            * of the operation preventing the invocation of 
 
  53            * lower priority features.   False, otherwise.
 
  55           public default boolean afterCreate(PolicyController controller) {return false;}
 
  58            * intercept before the Policy Controller is started.
 
  60            * @return true if this feature intercepts and takes ownership
 
  61            * of the operation preventing the invocation of 
 
  62            * lower priority features.   False, otherwise.
 
  64           public default boolean beforeStart(PolicyController controller) {return false;}
 
  67            * intercept after the Policy Controller is started.
 
  69            * @return true if this feature intercepts and takes ownership
 
  70            * of the operation preventing the invocation of 
 
  71            * lower priority features.   False, otherwise.
 
  73           public default boolean afterStart(PolicyController controller) {return false;}
 
  76            * intercept before the Policy Controller is stopped.
 
  78            * @return true if this feature intercepts and takes ownership
 
  79            * of the operation preventing the invocation of 
 
  80            * lower priority features.   False, otherwise..
 
  82           public default boolean beforeStop(PolicyController controller) {return false;}
 
  85            * intercept after the Policy Controller is stopped
 
  87            * @return true if this feature intercepts and takes ownership
 
  88            * of the operation preventing the invocation of 
 
  89            * lower priority features.   False, otherwise.d.
 
  91           public default boolean afterStop(PolicyController controller) {return false;}
 
  94            * intercept before the Policy Controller is locked
 
  96            * @return true if this feature intercepts and takes ownership
 
  97            * of the operation preventing the invocation of 
 
  98            * lower priority features.   False, otherwise.
 
 100           public default boolean beforeLock(PolicyController controller) {return false;}
 
 103            * intercept after the Policy Controller is locked
 
 105            * @return true if this feature intercepts and takes ownership
 
 106            * of the operation preventing the invocation of 
 
 107            * lower priority features.   False, otherwise..
 
 109           public default boolean afterLock(PolicyController controller) {return false;}
 
 112            * intercept before the Policy Controller is locked
 
 114            * @return true if this feature intercepts and takes ownership
 
 115            * of the operation preventing the invocation of 
 
 116            * lower priority features.   False, otherwise.
 
 118           public default boolean beforeUnlock(PolicyController controller) {return false;}
 
 121            * intercept after the Policy Controller is locked
 
 123            * @return true if this feature intercepts and takes ownership
 
 124            * of the operation preventing the invocation of 
 
 125            * lower priority features.   False, otherwise.
 
 127           public default boolean afterUnlock(PolicyController controller) {return false;}
 
 130            * intercept before the Policy Controller is shut down
 
 132            * @return true if this feature intercepts and takes ownership
 
 133            * of the operation preventing the invocation of 
 
 134            * lower priority features.   False, otherwise..
 
 136           public default boolean beforeShutdown(PolicyController controller) {return false;}
 
 139            * called after the Policy Controller is shut down
 
 141            * @return true if this feature intercepts and takes ownership
 
 142            * of the operation preventing the invocation of 
 
 143            * lower priority features.   False, otherwise.
 
 145           public default boolean afterShutdown(PolicyController controller) {return false;}
 
 148            * intercept before the Policy Controller is halted
 
 150            * @return true if this feature intercepts and takes ownership
 
 151            * of the operation preventing the invocation of 
 
 152            * lower priority features.   False, otherwise..
 
 154           public default boolean beforeHalt(PolicyController controller) {return false;}
 
 157            * called after the Policy Controller is halted
 
 159            * @return true if this feature intercepts and takes ownership
 
 160            * of the operation preventing the invocation of 
 
 161            * lower priority features.   False, otherwise.
 
 163           public default boolean afterHalt(PolicyController controller) {return false;}
 
 167            * intercept before the Policy Controller is offered an event
 
 169            * @return true if this feature intercepts and takes ownership
 
 170            * of the operation preventing the invocation of 
 
 171            * lower priority features.   False, otherwise.
 
 173           public default boolean beforeOffer(PolicyController controller,
 
 174                                                      CommInfrastructure protocol,
 
 176                                                      String event) {return false;}
 
 179            * called after the Policy Controller processes an event offer
 
 181            * @return true if this feature intercepts and takes ownership
 
 182            * of the operation preventing the invocation of 
 
 183            * lower priority features.   False, otherwise.
 
 185           public default boolean afterOffer(PolicyController controller,
 
 186                                         CommInfrastructure protocol,
 
 189                                         boolean success) {return false;}
 
 192            * intercept before the Policy Controller delivers (posts) an event
 
 194            * @return true if this feature intercepts and takes ownership
 
 195            * of the operation preventing the invocation of 
 
 196            * lower priority features.   False, otherwise.
 
 198           public default boolean beforeDeliver(PolicyController controller,
 
 199                                                                        CommInfrastructure protocol,
 
 201                                                                        Object event) {return false;}
 
 204            * called after the Policy Controller delivers (posts) an event
 
 206            * @return true if this feature intercepts and takes ownership
 
 207            * of the operation preventing the invocation of 
 
 208            * lower priority features.   False, otherwise.
 
 210           public default boolean afterDeliver(PolicyController controller,
 
 211                                                                       CommInfrastructure protocol,
 
 214                                                                       boolean success) {return false;}
 
 218            * Feature providers implementing this interface
 
 220           public static final OrderedServiceImpl<PolicyControllerFeatureAPI> providers = 
 
 221                                                                         new OrderedServiceImpl<PolicyControllerFeatureAPI>(PolicyControllerFeatureAPI.class);