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 classRuleUnitExecutorSession.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.KieRuntimeLoggeraddConsoleLogger()org.kie.api.logger.KieRuntimeLoggeraddFileLogger(String fileName)org.kie.api.logger.KieRuntimeLoggeraddFileLogger(String fileName, int maxEventsInMemory)org.kie.api.logger.KieRuntimeLoggeraddThreadedFileLogger(String fileName, int interval)RuleUnitExecutorbind(org.kie.api.KieBase kiebase)Bind this executor to aKieBasein order to execute the units defined in it.voidbindDataSource(InternalDataSource dataSource)RuleUnitExecutorbindVariable(String name, Object value)Binds a variable to this executor with a given name.voidcancelActivation(org.drools.core.spi.Activation activation)voiddispose()Releases all the current executor resources, setting up the session for garbage collection.RuleUnitgetCurrentRuleUnit()org.kie.api.runtime.KieSessiongetKieSession()Returns theKieSessioninternally used by this executor.RuleUnitFactorygetRuleUnitFactory()Collection<?>getSessionObjects()Collection<?>getSessionObjects(org.kie.api.runtime.ObjectFilter filter)voidguardRuleUnit(Class<? extends RuleUnit> ruleUnitClass, org.drools.core.spi.Activation activation)voidguardRuleUnit(RuleUnit ruleUnit, org.drools.core.spi.Activation activation)voidhalt()Requests the executor to stop running units.intinternalExecuteUnit(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.voidonResume()voidonSuspend()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.voidswitchToRuleUnit(Class<? extends RuleUnit> ruleUnitClass, org.drools.core.spi.Activation activation)voidswitchToRuleUnit(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:RuleUnitExecutorBind this executor to aKieBasein order to execute the units defined in it.- Specified by:
bindin interfaceRuleUnitExecutor
-
getKieSession
public org.kie.api.runtime.KieSession getKieSession()
Description copied from interface:RuleUnitExecutorReturns theKieSessioninternally used by this executor.- Specified by:
getKieSessionin interfaceRuleUnitExecutor
-
newDataSource
public <T> DataSource<T> newDataSource(String name, T... items)
Description copied from interface:RuleUnitExecutorCreates a DataSource, optionally containing some items, and bind it this executor with the given name.- Specified by:
newDataSourcein 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:
getSessionObjectsin interfaceInternalRuleUnitExecutor
-
getSessionObjects
public Collection<?> getSessionObjects(org.kie.api.runtime.ObjectFilter filter)
- Specified by:
getSessionObjectsin interfaceInternalRuleUnitExecutor
-
addConsoleLogger
public org.kie.api.logger.KieRuntimeLogger addConsoleLogger()
- Specified by:
addConsoleLoggerin interfaceInternalRuleUnitExecutor
-
addFileLogger
public org.kie.api.logger.KieRuntimeLogger addFileLogger(String fileName)
- Specified by:
addFileLoggerin interfaceInternalRuleUnitExecutor
-
addFileLogger
public org.kie.api.logger.KieRuntimeLogger addFileLogger(String fileName, int maxEventsInMemory)
- Specified by:
addFileLoggerin interfaceInternalRuleUnitExecutor
-
addThreadedFileLogger
public org.kie.api.logger.KieRuntimeLogger addThreadedFileLogger(String fileName, int interval)
- Specified by:
addThreadedFileLoggerin interfaceInternalRuleUnitExecutor
-
run
public int run(Class<? extends RuleUnit> ruleUnitClass)
Description copied from interface:RuleUnitExecutorRuns a RuleUnit of the given class.- Specified by:
runin interfaceRuleUnitExecutor
-
run
public int run(RuleUnit ruleUnit)
Description copied from interface:RuleUnitExecutorRuns a RuleUnit of the given class.- Specified by:
runin interfaceRuleUnitExecutor
-
internalExecuteUnit
public int internalExecuteUnit(RuleUnit ruleUnit)
-
runUntilHalt
public void runUntilHalt(Class<? extends RuleUnit> ruleUnitClass)
Description copied from interface:RuleUnitExecutorRuns until halt a RuleUnit of the given class.- Specified by:
runUntilHaltin interfaceRuleUnitExecutor
-
runUntilHalt
public void runUntilHalt(RuleUnit ruleUnit)
Description copied from interface:RuleUnitExecutorRuns until halt a RuleUnit of the given class.- Specified by:
runUntilHaltin interfaceRuleUnitExecutor
-
halt
public void halt()
Description copied from interface:RuleUnitExecutorRequests the executor to stop running units.- Specified by:
haltin interfaceRuleUnitExecutor
-
switchToRuleUnit
public void switchToRuleUnit(Class<? extends RuleUnit> ruleUnitClass, org.drools.core.spi.Activation activation)
- Specified by:
switchToRuleUnitin interfaceInternalRuleUnitExecutor
-
switchToRuleUnit
public void switchToRuleUnit(RuleUnit ruleUnit, org.drools.core.spi.Activation activation)
- Specified by:
switchToRuleUnitin interfaceInternalRuleUnitExecutor
-
guardRuleUnit
public void guardRuleUnit(Class<? extends RuleUnit> ruleUnitClass, org.drools.core.spi.Activation activation)
- Specified by:
guardRuleUnitin interfaceInternalRuleUnitExecutor
-
guardRuleUnit
public void guardRuleUnit(RuleUnit ruleUnit, org.drools.core.spi.Activation activation)
- Specified by:
guardRuleUnitin interfaceInternalRuleUnitExecutor
-
cancelActivation
public void cancelActivation(org.drools.core.spi.Activation activation)
- Specified by:
cancelActivationin interfaceInternalRuleUnitExecutor
-
getCurrentRuleUnit
public RuleUnit getCurrentRuleUnit()
- Specified by:
getCurrentRuleUnitin interfaceInternalRuleUnitExecutor
-
getRuleUnitFactory
public RuleUnitFactory getRuleUnitFactory()
-
bindVariable
public RuleUnitExecutor bindVariable(String name, Object value)
Description copied from interface:RuleUnitExecutorBinds 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.- Specified by:
bindVariablein 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:
bindDataSourcein interfaceInternalRuleUnitExecutor
-
onSuspend
public void onSuspend()
- Specified by:
onSuspendin interfaceInternalRuleUnitExecutor
-
onResume
public void onResume()
- Specified by:
onResumein interfaceInternalRuleUnitExecutor
-
dispose
public void dispose()
Description copied from interface:RuleUnitExecutorReleases 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:
disposein interfaceRuleUnitExecutor
-
-