2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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.onap.policy.drools.core;
23 import org.kie.api.runtime.KieSession;
24 import org.onap.policy.common.utils.services.OrderedService;
27 * This interface provides a way to invoke optional features at various
28 * points in the code. At appropriate points in the
29 * application, the code iterates through this list, invoking these optional
30 * methods. Most of the methods here are notification only -- these tend to
31 * return a 'void' value. In other cases, such as 'activatePolicySession',
34 public interface PolicySessionFeatureApi extends OrderedService {
37 * This method is called during initialization at a point right after
38 * 'PolicyContainer' initialization has completed.
40 * @param args standard 'main' arguments, which are currently ignored
41 * @param configDir the relative directory containing configuration files
43 public default void globalInit(String[] args, String configDir) {}
46 * This method is used to create a 'KieSession' as part of a
47 * 'PolicyContainer'. The caller of this method will iterate over the
48 * implementers of this interface until one returns a non-null value.
50 * @param policyContainer the 'PolicyContainer' instance containing this
52 * @param name the name of the KieSession (which is also the name of
53 * the associated PolicySession)
54 * @param kieBaseName the name of the 'KieBase' instance containing
56 * @return a new KieSession, if one was created, or 'null' if not
57 * (this depends on the capabilities and state of the object implementing
60 public default KieSession activatePolicySession(PolicyContainer policyContainer, String name, String kieBaseName) {
65 * This method is called after a new 'PolicySession' has been initialized,
66 * and linked to the 'PolicyContainer'.
68 * @param policySession the new 'PolicySession' instance
70 public default void newPolicySession(PolicySession policySession) {}
73 * This method is called to select the 'ThreadModel' instance associated
74 * with a 'PolicySession' instance.
76 public default PolicySession.ThreadModel selectThreadModel(PolicySession session) {
81 * This method is called after 'KieSession.dispose()' is called.
83 * @param policySession the 'PolicySession' object that wrapped the
86 public default void disposeKieSession(PolicySession policySession) {}
89 * This method is called after 'KieSession.destroy()' is called.
91 * @param policySession the 'PolicySession' object that wrapped the
94 public default void destroyKieSession(PolicySession policySession) {}