Package org.drools.ruleunit.executor
Class RuleUnitExecutorSession
- java.lang.Object
-
- org.drools.ruleunit.executor.RuleUnitExecutorSession
-
- All Implemented Interfaces:
InternalRuleUnitExecutor
,RuleUnitExecutor
public class RuleUnitExecutorSession extends Object implements InternalRuleUnitExecutor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RuleUnitExecutorSession.RuleUnitGlobals
-
Constructor Summary
Constructors Constructor Description RuleUnitExecutorSession()
RuleUnitExecutorSession(long id, boolean initInitFactHandle, org.drools.core.SessionConfiguration config, org.kie.api.runtime.Environment environment)
RuleUnitExecutorSession(long id, org.drools.core.spi.FactHandleFactory handleFactory, long propagationContext, org.drools.core.SessionConfiguration config, org.drools.core.common.InternalAgenda agenda, org.kie.api.runtime.Environment environment)
RuleUnitExecutorSession(org.kie.api.KieBase kiebase)
RuleUnitExecutorSession(org.kie.api.runtime.KieSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.kie.api.logger.KieRuntimeLogger
addConsoleLogger()
org.kie.api.logger.KieRuntimeLogger
addFileLogger(String fileName)
org.kie.api.logger.KieRuntimeLogger
addFileLogger(String fileName, int maxEventsInMemory)
org.kie.api.logger.KieRuntimeLogger
addThreadedFileLogger(String fileName, int interval)
RuleUnitExecutor
bind(org.kie.api.KieBase kiebase)
Bind this executor to aKieBase
in order to execute the units defined in it.void
bindDataSource(InternalDataSource dataSource)
RuleUnitExecutor
bindVariable(String name, Object value)
Binds a variable to this executor with a given name.void
cancelActivation(org.drools.core.spi.Activation activation)
void
dispose()
Releases all the current executor resources, setting up the session for garbage collection.RuleUnit
getCurrentRuleUnit()
org.kie.api.runtime.KieSession
getKieSession()
Returns theKieSession
internally used by this executor.RuleUnitFactory
getRuleUnitFactory()
Collection<?>
getSessionObjects()
Collection<?>
getSessionObjects(org.kie.api.runtime.ObjectFilter filter)
void
guardRuleUnit(Class<? extends RuleUnit> ruleUnitClass, org.drools.core.spi.Activation activation)
void
guardRuleUnit(RuleUnit ruleUnit, org.drools.core.spi.Activation activation)
void
halt()
Requests the executor to stop running units.int
internalExecuteUnit(RuleUnit ruleUnit)
<T> DataSource<T>
newDataSource(String name, T... items)
Creates a DataSource, optionally containing some items, and bind it this executor with the given name.void
onResume()
void
onSuspend()
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.void
switchToRuleUnit(Class<? extends RuleUnit> ruleUnitClass, org.drools.core.spi.Activation activation)
void
switchToRuleUnit(RuleUnit ruleUnit, org.drools.core.spi.Activation activation)
-
-
-
Constructor Detail
-
RuleUnitExecutorSession
public RuleUnitExecutorSession()
-
RuleUnitExecutorSession
public RuleUnitExecutorSession(org.kie.api.KieBase kiebase)
-
RuleUnitExecutorSession
public RuleUnitExecutorSession(org.kie.api.runtime.KieSession session)
-
RuleUnitExecutorSession
public RuleUnitExecutorSession(long id, boolean initInitFactHandle, org.drools.core.SessionConfiguration config, org.kie.api.runtime.Environment environment)
-
RuleUnitExecutorSession
public RuleUnitExecutorSession(long id, org.drools.core.spi.FactHandleFactory handleFactory, long propagationContext, org.drools.core.SessionConfiguration config, org.drools.core.common.InternalAgenda agenda, org.kie.api.runtime.Environment environment)
-
-
Method Detail
-
bind
public RuleUnitExecutor bind(org.kie.api.KieBase kiebase)
Description copied from interface:RuleUnitExecutor
Bind this executor to aKieBase
in order to execute the units defined in it.- Specified by:
bind
in interfaceRuleUnitExecutor
-
getKieSession
public org.kie.api.runtime.KieSession getKieSession()
Description copied from interface:RuleUnitExecutor
Returns theKieSession
internally used by this executor.- Specified by:
getKieSession
in interfaceRuleUnitExecutor
-
newDataSource
public <T> DataSource<T> newDataSource(String name, T... items)
Description copied from interface:RuleUnitExecutor
Creates a DataSource, optionally containing some items, and bind it this executor with the given name.- Specified by:
newDataSource
in interfaceRuleUnitExecutor
- Parameters:
name
- the name with which the newly created DataSource will be bound to this executor.items
- the items contained in the DataSource.
-
getSessionObjects
public Collection<?> getSessionObjects()
- Specified by:
getSessionObjects
in interfaceInternalRuleUnitExecutor
-
getSessionObjects
public Collection<?> getSessionObjects(org.kie.api.runtime.ObjectFilter filter)
- Specified by:
getSessionObjects
in interfaceInternalRuleUnitExecutor
-
addConsoleLogger
public org.kie.api.logger.KieRuntimeLogger addConsoleLogger()
- Specified by:
addConsoleLogger
in interfaceInternalRuleUnitExecutor
-
addFileLogger
public org.kie.api.logger.KieRuntimeLogger addFileLogger(String fileName)
- Specified by:
addFileLogger
in interfaceInternalRuleUnitExecutor
-
addFileLogger
public org.kie.api.logger.KieRuntimeLogger addFileLogger(String fileName, int maxEventsInMemory)
- Specified by:
addFileLogger
in interfaceInternalRuleUnitExecutor
-
addThreadedFileLogger
public org.kie.api.logger.KieRuntimeLogger addThreadedFileLogger(String fileName, int interval)
- Specified by:
addThreadedFileLogger
in interfaceInternalRuleUnitExecutor
-
run
public int run(Class<? extends RuleUnit> ruleUnitClass)
Description copied from interface:RuleUnitExecutor
Runs a RuleUnit of the given class.- Specified by:
run
in interfaceRuleUnitExecutor
-
run
public int run(RuleUnit ruleUnit)
Description copied from interface:RuleUnitExecutor
Runs a RuleUnit of the given class.- Specified by:
run
in interfaceRuleUnitExecutor
-
internalExecuteUnit
public int internalExecuteUnit(RuleUnit ruleUnit)
-
runUntilHalt
public void runUntilHalt(Class<? extends RuleUnit> ruleUnitClass)
Description copied from interface:RuleUnitExecutor
Runs until halt a RuleUnit of the given class.- Specified by:
runUntilHalt
in interfaceRuleUnitExecutor
-
runUntilHalt
public void runUntilHalt(RuleUnit ruleUnit)
Description copied from interface:RuleUnitExecutor
Runs until halt a RuleUnit of the given class.- Specified by:
runUntilHalt
in interfaceRuleUnitExecutor
-
halt
public void halt()
Description copied from interface:RuleUnitExecutor
Requests the executor to stop running units.- Specified by:
halt
in interfaceRuleUnitExecutor
-
switchToRuleUnit
public void switchToRuleUnit(Class<? extends RuleUnit> ruleUnitClass, org.drools.core.spi.Activation activation)
- Specified by:
switchToRuleUnit
in interfaceInternalRuleUnitExecutor
-
switchToRuleUnit
public void switchToRuleUnit(RuleUnit ruleUnit, org.drools.core.spi.Activation activation)
- Specified by:
switchToRuleUnit
in interfaceInternalRuleUnitExecutor
-
guardRuleUnit
public void guardRuleUnit(Class<? extends RuleUnit> ruleUnitClass, org.drools.core.spi.Activation activation)
- Specified by:
guardRuleUnit
in interfaceInternalRuleUnitExecutor
-
guardRuleUnit
public void guardRuleUnit(RuleUnit ruleUnit, org.drools.core.spi.Activation activation)
- Specified by:
guardRuleUnit
in interfaceInternalRuleUnitExecutor
-
cancelActivation
public void cancelActivation(org.drools.core.spi.Activation activation)
- Specified by:
cancelActivation
in interfaceInternalRuleUnitExecutor
-
getCurrentRuleUnit
public RuleUnit getCurrentRuleUnit()
- Specified by:
getCurrentRuleUnit
in interfaceInternalRuleUnitExecutor
-
getRuleUnitFactory
public RuleUnitFactory getRuleUnitFactory()
-
bindVariable
public RuleUnitExecutor bindVariable(String name, Object value)
Description copied from interface:RuleUnitExecutor
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.- Specified by:
bindVariable
in interfaceRuleUnitExecutor
- Parameters:
name
- the name with which the value will be bound to this executor.value
- the value to bind.
-
bindDataSource
public void bindDataSource(InternalDataSource dataSource)
- Specified by:
bindDataSource
in interfaceInternalRuleUnitExecutor
-
onSuspend
public void onSuspend()
- Specified by:
onSuspend
in interfaceInternalRuleUnitExecutor
-
onResume
public void onResume()
- Specified by:
onResume
in interfaceInternalRuleUnitExecutor
-
dispose
public void dispose()
Description copied from interface:RuleUnitExecutor
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.- Specified by:
dispose
in interfaceRuleUnitExecutor
-
-