Package org.drools.ruleunit
Interface RuleUnitExecutor
-
- All Known Subinterfaces:
InternalRuleUnitExecutor
- All Known Implementing Classes:
RuleUnitExecutorSession
public interface RuleUnitExecutorRuleUnitExecutor allows to execute differentRuleUnits.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description RuleUnitExecutorbind(org.kie.api.KieBase kiebase)Bind this executor to aKieBasein order to execute the units defined in it.RuleUnitExecutorbindVariable(String name, Object value)Binds a variable to this executor with a given name.static RuleUnitExecutorcreate()Creates a brand new RuleUnitExecutorstatic RuleUnitExecutorcreate(org.kie.api.runtime.KieSession kieSession)Creates a brand new RuleUnitExecutorvoiddispose()Releases all the current executor resources, setting up the session for garbage collection.org.kie.api.runtime.KieSessiongetKieSession()Returns theKieSessioninternally used by this executor.voidhalt()Requests the executor to stop running units.<T> DataSource<T>newDataSource(String name, T... items)Creates a DataSource, optionally containing some items, and bind it this executor with the given name.static RuleUnitExecutornewRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer)static RuleUnitExecutornewRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer, String kSessionName)static RuleUnitExecutornewRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer, String kSessionName, org.kie.api.runtime.KieSessionConfiguration conf)static RuleUnitExecutornewRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer, org.kie.api.runtime.KieSessionConfiguration conf)intrun(Class<? extends RuleUnit> ruleUnitClass)Runs a RuleUnit of the given class.intrun(RuleUnit ruleUnit)Runs a RuleUnit of the given class.voidrunUntilHalt(Class<? extends RuleUnit> ruleUnitClass)Runs until halt a RuleUnit of the given class.voidrunUntilHalt(RuleUnit ruleUnit)Runs until halt a RuleUnit of the given class.
-
-
-
Method Detail
-
bind
RuleUnitExecutor bind(org.kie.api.KieBase kiebase)
Bind this executor to aKieBasein order to execute the units defined in it.
-
getKieSession
org.kie.api.runtime.KieSession getKieSession()
Returns theKieSessioninternally used by this executor.
-
run
int run(RuleUnit ruleUnit)
Runs a RuleUnit of the given class.
-
runUntilHalt
void runUntilHalt(Class<? extends RuleUnit> ruleUnitClass)
Runs until halt a RuleUnit of the given class.
-
runUntilHalt
void runUntilHalt(RuleUnit ruleUnit)
Runs until halt a RuleUnit of the given class.
-
halt
void halt()
Requests the executor to stop running units.
-
newDataSource
<T> DataSource<T> newDataSource(String name, T... items)
Creates a DataSource, optionally containing some items, and bind it this executor with the given name.- Parameters:
name- the name with which the newly created DataSource will be bound to this executor.items- the items contained in the DataSource.
-
bindVariable
RuleUnitExecutor bindVariable(String name, Object value)
Binds a variable to this executor with a given name. This named variable will be then injected intoRuleUnits executed on this executor using a naming convention.- Parameters:
name- the name with which the value will be bound to this executor.value- the value to bind.
-
dispose
void dispose()
Releases all the current executor resources, setting up the session for garbage collection. This method must always be called after finishing using the executor, or the engine will not free the memory used by the executor.
-
newRuleUnitExecutor
static RuleUnitExecutor newRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer)
-
newRuleUnitExecutor
static RuleUnitExecutor newRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer, org.kie.api.runtime.KieSessionConfiguration conf)
-
newRuleUnitExecutor
static RuleUnitExecutor newRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer, String kSessionName)
-
newRuleUnitExecutor
static RuleUnitExecutor newRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer, String kSessionName, org.kie.api.runtime.KieSessionConfiguration conf)
-
create
static RuleUnitExecutor create()
Creates a brand new RuleUnitExecutor
-
create
static RuleUnitExecutor create(org.kie.api.runtime.KieSession kieSession)
Creates a brand new RuleUnitExecutor
-
-