[POLICY-52] pdp-d: PolicyEngine junits
[policy/drools-pdp.git] / policy-management / src / main / java / org / onap / policy / drools / features / PolicyEngineFeatureAPI.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * policy-engine
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.policy.drools.features;
22
23 import java.util.Properties;
24
25 import org.onap.policy.drools.system.PolicyEngine;
26 import org.onap.policy.drools.utils.OrderedService;
27 import org.onap.policy.drools.utils.OrderedServiceImpl;
28
29 /**
30  * Policy Engine Feature API.
31  * Provides Interception Points during the Policy Engine lifecycle.
32  */
33 public interface PolicyEngineFeatureAPI extends OrderedService {
34         
35           /**
36            * intercept before the Policy Engine is commanded to boot.
37            * 
38            * @return true if this feature intercepts and takes ownership
39            * of the operation preventing the invocation of 
40            * lower priority features.   False, otherwise.
41            */
42           public default boolean beforeBoot(PolicyEngine engine, String cliArgs[]) {return false;};
43           
44           /**
45            * intercept after the Policy Engine is booted.
46            * 
47            * @return true if this feature intercepts and takes ownership
48            * of the operation preventing the invocation of 
49            * lower priority features.   False, otherwise.
50            */
51           public default boolean afterBoot(PolicyEngine engine) {return false;};
52         
53           /**
54            * intercept before the Policy Engine is configured.
55            * 
56            * @return true if this feature intercepts and takes ownership
57            * of the operation preventing the invocation of 
58            * lower priority features.   False, otherwise.
59            */
60           public default boolean beforeConfigure(PolicyEngine engine, Properties properties) {return false;};
61           
62           /**
63            * intercept after the Policy Engine is configured.
64            * 
65            * @return true if this feature intercepts and takes ownership
66            * of the operation preventing the invocation of 
67            * lower priority features.   False, otherwise.
68            */
69           public default boolean afterConfigure(PolicyEngine engine) {return false;};
70           
71           /**
72            * intercept before the Policy Engine goes active.
73            * 
74            * @return true if this feature intercepts and takes ownership
75            * of the operation preventing the invocation of 
76            * lower priority features.   False, otherwise.
77            */
78           public default boolean beforeActivate(PolicyEngine engine) {return false;};
79           
80           /**
81            * intercept after the Policy Engine goes active.
82            * 
83            * @return true if this feature intercepts and takes ownership
84            * of the operation preventing the invocation of 
85            * lower priority features.   False, otherwise.
86            */
87           public default boolean afterActivate(PolicyEngine engine) {return false;};
88           
89           /**
90            * intercept before the Policy Engine goes standby.
91            * 
92            * @return true if this feature intercepts and takes ownership
93            * of the operation preventing the invocation of 
94            * lower priority features.   False, otherwise.
95            */
96           public default boolean beforeDeactivate(PolicyEngine engine) {return false;};
97           
98           /**
99            * intercept after the Policy Engine goes standby.
100            * 
101            * @return true if this feature intercepts and takes ownership
102            * of the operation preventing the invocation of 
103            * lower priority features.   False, otherwise.
104            */
105           public default boolean afterDeactivate(PolicyEngine engine) {return false;};
106           
107           /**
108            * intercept before the Policy Engine is started.
109            * 
110            * @return true if this feature intercepts and takes ownership
111            * of the operation preventing the invocation of 
112            * lower priority features.   False, otherwise.
113            */
114           public default boolean beforeStart(PolicyEngine engine) {return false;};
115           
116           /**
117            * intercept after the Policy Engine is started.
118            * 
119            * @return true if this feature intercepts and takes ownership
120            * of the operation preventing the invocation of 
121            * lower priority features.   False, otherwise.
122            */
123           public default boolean afterStart(PolicyEngine engine) {return false;};
124           
125           /**
126            * intercept before the Policy Engine is stopped.
127            * 
128            * @return true if this feature intercepts and takes ownership
129            * of the operation preventing the invocation of 
130            * lower priority features.   False, otherwise..
131            */
132           public default boolean beforeStop(PolicyEngine engine) {return false;};
133           
134           /**
135            * intercept after the Policy Engine is stopped
136            * 
137            * @return true if this feature intercepts and takes ownership
138            * of the operation preventing the invocation of 
139            * lower priority features.   False, otherwise.d.
140            */
141           public default boolean afterStop(PolicyEngine engine) {return false;};
142           
143           /**
144            * intercept before the Policy Engine is locked
145            * 
146            * @return true if this feature intercepts and takes ownership
147            * of the operation preventing the invocation of 
148            * lower priority features.   False, otherwise.
149            */
150           public default boolean beforeLock(PolicyEngine engine) {return false;};
151           
152           /**
153            * intercept after the Policy Engine is locked
154            * 
155            * @return true if this feature intercepts and takes ownership
156            * of the operation preventing the invocation of 
157            * lower priority features.   False, otherwise..
158            */
159           public default boolean afterLock(PolicyEngine engine) {return false;};
160           
161           /**
162            * intercept before the Policy Engine is locked
163            * 
164            * @return true if this feature intercepts and takes ownership
165            * of the operation preventing the invocation of 
166            * lower priority features.   False, otherwise.
167            */
168           public default boolean beforeUnlock(PolicyEngine engine) {return false;};
169           
170           /**
171            * intercept after the Policy Engine is locked
172            * 
173            * @return true if this feature intercepts and takes ownership
174            * of the operation preventing the invocation of 
175            * lower priority features.   False, otherwise.
176            */
177           public default boolean afterUnlock(PolicyEngine engine) {return false;};
178           
179           /**
180            * intercept the Policy Engine is shut down
181            * 
182            * @return true if this feature intercepts and takes ownership
183            * of the operation preventing the invocation of 
184            * lower priority features.   False, otherwise..
185            */
186           public default boolean beforeShutdown(PolicyEngine engine){return false;};
187           
188           /**
189            * called after the Policy Engine is shut down
190            * 
191            * @return true if this feature intercepts and takes ownership
192            * of the operation preventing the invocation of 
193            * lower priority features.   False, otherwise.
194            */
195           public default boolean afterShutdown(PolicyEngine engine) {return false;};
196           
197           /**
198            * Feature providers implementing this interface
199            */
200           public static final OrderedServiceImpl<PolicyEngineFeatureAPI> providers = 
201                                                                         new OrderedServiceImpl<>(PolicyEngineFeatureAPI.class);
202 }