diff options
Diffstat (limited to 'policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java')
-rw-r--r-- | policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java index 6352eaa2..c2b72fb5 100644 --- a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java +++ b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java @@ -232,6 +232,29 @@ public class PolicySession } } + /** + * This method will insert an object into the Drools memory associated + * with this 'PolicySession' instance. Features are given the opportunity + * to handle the insert, and a distributed host feature could use this to + * send the object to another host, and insert it in the corresponding + * Drools session. + * + * @param object the object to insert in Drools memory + */ + public void insertDrools(Object object) { + for (PolicySessionFeatureApi feature : + PolicySessionFeatureApiConstants.getImpl().getList()) { + if (feature.insertDrools(this, object)) { + // feature is performing the insert + return; + } + } + // no feature has intervened -- do the insert locally + if (kieSession != null) { + kieSession.insert(object); + } + } + /*=================================*/ /* 'AgendaEventListener' interface */ /*=================================*/ |