Package org.drools.ruleunit
Interface RuleUnitExecutor
-
- All Known Subinterfaces:
InternalRuleUnitExecutor
- All Known Implementing Classes:
RuleUnitExecutorSession
public interface RuleUnitExecutor
RuleUnitExecutor allows to execute differentRuleUnit
s.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description RuleUnitExecutor
bind(org.kie.api.KieBase kiebase)
Bind this executor to aKieBase
in order to execute the units defined in it.RuleUnitExecutor
bindVariable(String name, Object value)
Binds a variable to this executor with a given name.static RuleUnitExecutor
create()
Creates a brand new RuleUnitExecutorstatic RuleUnitExecutor
create(org.kie.api.runtime.KieSession kieSession)
Creates a brand new RuleUnitExecutorvoid
dispose()
Releases all the current executor resources, setting up the session for garbage collection.org.kie.api.runtime.KieSession
getKieSession()
Returns theKieSession
internally used by this executor.void
halt()
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 RuleUnitExecutor
newRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer)
static RuleUnitExecutor
newRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer, String kSessionName)
static RuleUnitExecutor
newRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer, String kSessionName, org.kie.api.runtime.KieSessionConfiguration conf)
static RuleUnitExecutor
newRuleUnitExecutor(org.kie.api.runtime.KieContainer kieContainer, org.kie.api.runtime.KieSessionConfiguration conf)
int
run(Class<? extends RuleUnit> ruleUnitClass)
Runs a RuleUnit of the given class.int
run(RuleUnit ruleUnit)
Runs a RuleUnit of the given class.void
runUntilHalt(Class<? extends RuleUnit> ruleUnitClass)
Runs until halt a RuleUnit of the given class.void
runUntilHalt(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 aKieBase
in order to execute the units defined in it.
-
getKieSession
org.kie.api.runtime.KieSession getKieSession()
Returns theKieSession
internally 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 intoRuleUnit
s 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
-
-