Package org.drools.core.impl
Class StatefulKnowledgeSessionImpl
- java.lang.Object
-
- org.drools.core.impl.AbstractRuntime
-
- org.drools.core.impl.StatefulKnowledgeSessionImpl
-
- All Implemented Interfaces:
Externalizable
,Serializable
,EventSupport
,InternalKnowledgeRuntime
,InternalWorkingMemory
,InternalWorkingMemoryActions
,WorkingMemory
,WorkingMemoryEntryPoint
,WorkingMemoryEventManager
,org.kie.api.event.kiebase.KieBaseEventManager
,org.kie.api.event.KieRuntimeEventManager
,org.kie.api.event.process.ProcessEventManager
,org.kie.api.event.rule.RuleRuntimeEventManager
,org.kie.api.runtime.CommandExecutor
,org.kie.api.runtime.KieRuntime
,org.kie.api.runtime.KieSession
,org.kie.api.runtime.process.ProcessRuntime
,org.kie.api.runtime.process.StatefulProcessSession
,org.kie.api.runtime.rule.EntryPoint
,org.kie.api.runtime.rule.RuleRuntime
,org.kie.api.runtime.rule.StatefulRuleSession
,org.kie.internal.event.rule.RuleEventManager
,org.kie.internal.process.CorrelationAwareProcessRuntime
,org.kie.internal.runtime.StatefulKnowledgeSession
public class StatefulKnowledgeSessionImpl extends AbstractRuntime implements org.kie.internal.runtime.StatefulKnowledgeSession, WorkingMemoryEntryPoint, InternalKnowledgeRuntime, org.kie.api.runtime.KieSession, org.kie.api.event.KieRuntimeEventManager, InternalWorkingMemoryActions, EventSupport, org.kie.internal.event.rule.RuleEventManager, org.kie.api.event.process.ProcessEventManager, org.kie.internal.process.CorrelationAwareProcessRuntime, Externalizable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StatefulKnowledgeSessionImpl.AbstractImmutableCollection
static class
StatefulKnowledgeSessionImpl.DummyInternalProcessRuntime
static class
StatefulKnowledgeSessionImpl.GlobalsAdapter
static class
StatefulKnowledgeSessionImpl.ObjectStoreWrapper
static class
StatefulKnowledgeSessionImpl.PartitionAwareWorkingMemoryReteExpireAction
static class
StatefulKnowledgeSessionImpl.WorkingMemoryReteAssertAction
static class
StatefulKnowledgeSessionImpl.WorkingMemoryReteExpireAction
-
Field Summary
Fields Modifier and Type Field Description protected InternalAgenda
agenda
Rule-firing agenda.protected AgendaEventSupport
agendaEventSupport
byte[]
bytes
protected org.kie.api.runtime.Calendars
calendars
protected SessionConfiguration
config
static String
DEFAULT_RULE_UNIT
protected InternalWorkingMemoryEntryPoint
defaultEntryPoint
static StatefulKnowledgeSessionImpl.DummyInternalProcessRuntime
DUMMY_PROCESS_RUNTIME
protected Map<String,WorkingMemoryEntryPoint>
entryPoints
static String
ERRORMSG
protected GlobalResolver
globalResolver
Global values which are associated with this memory.protected FactHandleFactory
handleFactory
protected Long
id
protected InternalFactHandle
initialFactHandle
protected InternalKnowledgeBase
kBase
TheRuleBase
with which this memory is associated.protected List<org.kie.api.event.kiebase.KieBaseEventListener>
kieBaseEventListeners
protected ReentrantLock
lock
protected NodeMemories
nodeMemories
The actual memory for theJoinNode
s.protected AtomicLong
propagationIdCounter
This must be thread safe as it is incremented and read via different EntryPointsprotected RuleEventListenerSupport
ruleEventListenerSupport
protected RuleRuntimeEventSupport
ruleRuntimeEventSupport
The eventSupport-
Fields inherited from class org.drools.core.impl.AbstractRuntime
logger
-
-
Constructor Summary
Constructors Constructor Description StatefulKnowledgeSessionImpl()
StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase)
StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase, boolean initInitFactHandle, SessionConfiguration config, org.kie.api.runtime.Environment environment)
StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase, FactHandleFactory handleFactory, long propagationContext, SessionConfiguration config, InternalAgenda agenda, org.kie.api.runtime.Environment environment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abortProcessInstance(long id)
void
activate()
void
activationFired()
This method is called by the agenda right after an activation was fired to allow the working memory to resume any activities blocked during activation firing.void
addEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
void
addEventListener(org.kie.api.event.process.ProcessEventListener listener)
void
addEventListener(org.kie.api.event.rule.AgendaEventListener listener)
Add an event listener.void
addEventListener(org.kie.api.event.rule.RuleRuntimeEventListener listener)
Add an event listener.void
addEventListener(org.kie.internal.event.rule.RuleEventListener listener)
void
addPropagation(PropagationEntry propagationEntry)
void
bindRuleBase(InternalWorkingMemory workingMemory, InternalKnowledgeBase kBase, InternalAgenda agenda, boolean initInitFactHandle)
void
cancelActivation(Activation activation, boolean declarativeAgenda)
protected void
checkAlive()
void
clearActivationGroup(String group)
Clears the Activation Group, cancellings all its Activationsvoid
clearAgenda()
Clear the Agenda.void
clearAgendaGroup(String group)
Clear the Agenda Group, cancelling all its Activations.void
clearNodeMemory(MemoryFactory node)
void
clearRuleFlowGroup(String group)
Clears the RuleFlow group, cancelling all its Activationsvoid
closeLiveQuery(InternalFactHandle factHandle)
org.kie.api.runtime.process.ProcessInstance
createProcessInstance(String processId, Map<String,Object> parameters)
org.kie.api.runtime.process.ProcessInstance
createProcessInstance(String processId, org.kie.internal.process.CorrelationKey correlationKey, Map<String,Object> parameters)
<T> T
createRuntimeService(Class<T> cls)
protected TimerService
createTimerService()
void
deactivate()
void
delete(org.kie.api.runtime.rule.FactHandle handle)
void
delete(org.kie.api.runtime.rule.FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode)
void
delete(org.kie.api.runtime.rule.FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode, org.kie.api.runtime.rule.FactHandle.State fhState)
void
delete(org.kie.api.runtime.rule.FactHandle handle, org.kie.api.runtime.rule.FactHandle.State fhState)
void
destroy()
void
dispose()
Internal method called by the engine when the session is being disposed, so that the entry point can proceed with the necessary clean ups.<T,K>
Tdon(Activation activation, K core, Class<T> trait, boolean b, org.kie.api.internal.runtime.beliefs.Mode[] modes)
<T,K>
Tdon(Activation activation, K core, Collection<Class<? extends Thing>> traits, boolean b, org.kie.api.internal.runtime.beliefs.Mode[] modes)
void
endBatchExecution()
void
endOperation()
This method must be called after finishing any work in the engine, like inserting a new fact or firing a new rule.protected QueryTerminalNode[]
evalQuery(String queryName, DroolsQuery queryObject, InternalFactHandle handle, PropagationContext pCtx, boolean isCalledFromRHS)
<T> T
execute(org.kie.api.command.Command<T> command)
void
executeQueuedActions()
int
fireAllRules()
Fire all items on the agenda until empty.int
fireAllRules(int fireLimit)
Fire all items on the agenda until empty or at most 'fireLimit' rules have firedint
fireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
Fire all items on the agenda until empty, using the given AgendaFilerint
fireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter, int fireLimit)
Fire all items on the agenda using the given AgendaFiler until empty or at most 'fireLimit' rules have firedvoid
fireUntilHalt()
Keeps firing activations until a halt is called.void
fireUntilHalt(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
Keeps firing activations until a halt is called.void
flushPropagations()
Iterator<? extends PropagationEntry>
getActionsIterator()
Map.Entry[]
getActivationParameters(long activationId)
Map
getActivationParameters(Activation activation)
InternalAgenda
getAgenda()
Returns the Agenda for this WorkingMemory.Collection<org.kie.api.event.rule.AgendaEventListener>
getAgendaEventListeners()
Returns all event listeners.AgendaEventSupport
getAgendaEventSupport()
org.kie.api.runtime.Calendars
getCalendars()
Map<String,org.kie.api.runtime.Channel>
getChannels()
Returns a map of channel Id->Channel of all channels in this working memoryEntryPointId
getEntryPoint()
WorkingMemoryEntryPoint
getEntryPoint(String name)
String
getEntryPointId()
Map<String,WorkingMemoryEntryPoint>
getEntryPointMap()
EntryPointNode
getEntryPointNode()
Collection<? extends org.kie.api.runtime.rule.EntryPoint>
getEntryPoints()
org.kie.api.runtime.Environment
getEnvironment()
long
getFactCount()
org.kie.api.runtime.rule.FactHandle
getFactHandle(Object object)
Retrieve theFactHandle
associated with an Object.org.kie.api.runtime.rule.FactHandle
getFactHandleByIdentity(Object object)
Looks for the fact handle associated to the given object by looking up the object IDENTITY (==), even if rule base is configured to AssertBehavior.EQUALITY.FactHandleFactory
getFactHandleFactory()
<T extends org.kie.api.runtime.rule.FactHandle>
Collection<T>getFactHandles()
<T extends org.kie.api.runtime.rule.FactHandle>
Collection<T>getFactHandles(org.kie.api.runtime.ObjectFilter filter)
Object
getGlobal(String identifier)
Retrieve a specific instance of global data by identifierGlobalResolver
getGlobalResolver()
Returns the current GlobalResolverorg.kie.api.runtime.Globals
getGlobals()
FactHandleFactory
getHandleFactory()
int
getId()
long
getIdentifier()
long
getIdleTime()
Returns the number of time units (usually ms) that the engine is idle according to the session clock or -1 if it is not idle.InternalFactHandle
getInitialFactHandle()
InternalWorkingMemory
getInternalWorkingMemory()
org.kie.api.KieBase
getKieBase()
Collection<org.kie.api.event.kiebase.KieBaseEventListener>
getKieBaseEventListeners()
<T> T
getKieRuntime(Class<T> cls)
InternalKnowledgeBase
getKnowledgeBase()
Retrieve theRuleBase
for this working memory.InternalKnowledgeRuntime
getKnowledgeRuntime()
long
getLastIdleTimestamp()
Lock
getLock()
long
getNextPropagationIdCounter()
NodeMemories
getNodeMemories()
<T extends Memory>
TgetNodeMemory(MemoryFactory<T> node)
Retrieve theJoinMemory
for a particularJoinNode
.Object
getObject(org.kie.api.runtime.rule.FactHandle handle)
Returns the fact Object for the givenFactHandle
.Collection<?>
getObjects()
Collection<?>
getObjects(org.kie.api.runtime.ObjectFilter filter)
ObjectStore
getObjectStore()
ObjectTypeConfigurationRegistry
getObjectTypeConfigurationRegistry()
Collection<org.kie.api.event.process.ProcessEventListener>
getProcessEventListeners()
org.kie.api.runtime.process.ProcessInstance
getProcessInstance(long processInstanceId)
Returns the process instance with the given id.org.kie.api.runtime.process.ProcessInstance
getProcessInstance(long processInstanceId, boolean readOnly)
org.kie.api.runtime.process.ProcessInstance
getProcessInstance(Object processInstanceId)
org.kie.api.runtime.process.ProcessInstance
getProcessInstance(org.kie.internal.process.CorrelationKey correlationKey)
Collection<org.kie.api.runtime.process.ProcessInstance>
getProcessInstances()
Returns the list of process instances of this working memory.InternalProcessRuntime
getProcessRuntime()
long
getPropagationIdCounter()
PropagationList
getPropagationList()
QueryResultsImpl
getQueryResults(String queryName, Object... arguments)
Retrieve the QueryResults of the specified query and argumentsQueryResultsImpl
getQueryResultsFromRHS(String queryName, Object... arguments)
(This shall NOT be exposed on public API)RuleEventListenerSupport
getRuleEventSupport()
Collection<org.kie.api.event.rule.RuleRuntimeEventListener>
getRuleRuntimeEventListeners()
Returns all event listeners.RuleRuntimeEventSupport
getRuleRuntimeEventSupport()
org.kie.api.time.SessionClock
getSessionClock()
Returns the session clock instance associated with this sessionSessionConfiguration
getSessionConfiguration()
TimerService
getTimerService()
Returns the TimerService instance (session clock) for this session.long
getTimeToNextJob()
Returns the number of time units (usually ms) to the next scheduled joblong
getTotalFactCount()
Returns the total number of facts in the working memory, i.e., counting all facts from all entry points.TruthMaintenanceSystem
getTruthMaintenanceSystem()
WorkingMemoryEntryPoint
getWorkingMemoryEntryPoint(String name)
Returns the interface instance for a given entry point, so that the application can manage entry-point-scoped facts.Map<String,WorkingMemoryEntryPoint>
getWorkingMemoryEntryPoints()
org.kie.api.runtime.process.WorkItemManager
getWorkItemManager()
void
halt()
Stops rule firing after the current rule finishes executingvoid
init(SessionConfiguration config, org.kie.api.runtime.Environment environment)
protected void
initDefaultEntryPoint()
InternalFactHandle
initInitialFact(InternalKnowledgeBase kBase, InternalWorkingMemoryEntryPoint entryPoint, EntryPointId epId, MarshallerReaderContext context)
InternalFactHandle
initInitialFact(InternalKnowledgeBase kBase, MarshallerReaderContext context)
void
initMBeans(String containerId, String kbaseName, String ksessionName)
org.kie.api.runtime.rule.FactHandle
insert(Object object)
org.kie.api.runtime.rule.FactHandle
insert(Object object, boolean dynamic)
Insert a fact registering JavaBeanPropertyChangeListeners
on the Object to automatically triggerupdate
calls ifdynamic
istrue
.org.kie.api.runtime.rule.FactHandle
insert(Object object, boolean dynamic, RuleImpl rule, TerminalNode terminalNode)
org.kie.api.runtime.rule.FactHandle
insertAsync(Object object)
InternalProcessRuntime
internalGetProcessRuntime()
protected QueryResultsImpl
internalGetQueryResult(boolean calledFromRHS, String queryName, Object... arguments)
boolean
isAlive()
boolean
isSequential()
Iterator<InternalFactHandle>
iterateFactHandles()
This class is not thread safe, changes to the working memory during iteration may give unexpected resultsIterator<InternalFactHandle>
iterateFactHandles(org.kie.api.runtime.ObjectFilter filter)
This class is not thread safe, changes to the working memory during iteration may give unexpected resultsList
iterateNonDefaultEntryPointObjectsToList()
Iterator
iterateObjects()
This class is not thread safe, changes to the working memory during iteration may give unexpected resultsIterator
iterateObjects(org.kie.api.runtime.ObjectFilter filter)
This class is not thread safe, changes to the working memory during iteration may give unexpected resultsList
iterateObjectsToList()
void
notifyWaitOnRest()
org.kie.api.runtime.rule.LiveQuery
openLiveQuery(String query, Object[] arguments, org.kie.api.runtime.rule.ViewChangedEventListener listener)
void
prepareToFireActivation()
This method is called by the agenda before firing a new activation to ensure the working memory is in a safe state to fire the activation.void
queueWorkingMemoryAction(WorkingMemoryAction action)
void
readExternal(ObjectInput in)
void
registerChannel(String name, org.kie.api.runtime.Channel channel)
void
removeEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
void
removeEventListener(org.kie.api.event.process.ProcessEventListener listener)
void
removeEventListener(org.kie.api.event.rule.AgendaEventListener listener)
Remove an event listener.void
removeEventListener(org.kie.api.event.rule.RuleRuntimeEventListener listener)
Remove an event listener.void
removeEventListener(org.kie.internal.event.rule.RuleEventListener listener)
void
removeGlobal(String identifier)
void
reset()
void
reset(long handleId, long handleCounter, long propagationCounter)
void
retract(org.kie.api.runtime.rule.FactHandle handle)
void
setAgendaEventSupport(AgendaEventSupport agendaEventSupport)
void
setAsyncExceptionHandler(AsyncExceptionHandler handler)
Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules.void
setEndOperationListener(EndOperationListener listener)
void
setFocus(String focus)
Set the focus to the specified AgendaGroupvoid
setGlobal(String identifier, Object value)
Set a specific instance as a global in this working memory.void
setGlobalResolver(GlobalResolver globalResolver)
Sets the GlobalResolver instance to be used when resolving globals, replaces the current GlobalResolver.void
setHandleFactory(FactHandleFactory handleFactory)
void
setIdentifier(long id)
void
setInitialFactHandle(InternalFactHandle initialFactHandle)
void
setRuleEventListenerSupport(RuleEventListenerSupport ruleEventListenerSupport)
void
setRuleRuntimeEventSupport(RuleRuntimeEventSupport ruleRuntimeEventSupport)
StatefulKnowledgeSessionImpl
setStateless(boolean stateless)
<T,K,X extends TraitableBean>
Thing<K>shed(Activation activation, TraitableBean<K,X> core, Class<T> trait)
void
signalEvent(String type, Object event)
void
signalEvent(String type, Object event, long processInstanceId)
void
startBatchExecution()
void
startOperation()
This method must be called before starting any new work in the engine, like inserting a new fact or firing a new rule.org.kie.api.runtime.process.ProcessInstance
startProcess(String processId)
Starts a new process instance for the process with the given id.org.kie.api.runtime.process.ProcessInstance
startProcess(String processId, Map<String,Object> parameters)
Starts a new process instance for the process with the given id.org.kie.api.runtime.process.ProcessInstance
startProcess(String processId, Map<String,Object> parameters, org.kie.api.runtime.rule.AgendaFilter agendaFilter)
org.kie.api.runtime.process.ProcessInstance
startProcess(String processId, org.kie.api.runtime.rule.AgendaFilter agendaFilter)
org.kie.api.runtime.process.ProcessInstance
startProcess(String processId, org.kie.internal.process.CorrelationKey correlationKey, Map<String,Object> parameters)
org.kie.api.runtime.process.ProcessInstance
startProcessFromNodeIds(String processId, Map<String,Object> params, String... nodeInstancesIds)
org.kie.api.runtime.process.ProcessInstance
startProcessFromNodeIds(String processId, org.kie.internal.process.CorrelationKey key, Map<String,Object> params, String... nodeIds)
org.kie.api.runtime.process.ProcessInstance
startProcessInstance(long processInstanceId)
void
submit(org.kie.api.runtime.KieSession.AtomicAction action)
String
toString()
boolean
tryDeactivate()
void
unregisterChannel(String name)
void
update(org.kie.api.runtime.rule.FactHandle factHandle)
void
update(org.kie.api.runtime.rule.FactHandle handle, Object object)
void
update(org.kie.api.runtime.rule.FactHandle handle, Object object, String... modifiedProperties)
void
update(org.kie.api.runtime.rule.FactHandle factHandle, Object object, BitMask mask, Class<?> modifiedClass, Activation activation)
modify is implemented as half way retract / assert due to the truth maintenance issues.void
updateEntryPointsCache()
void
updateTraits(InternalFactHandle h, BitMask mask, Class<?> modifiedClass, Activation activation)
void
writeExternal(ObjectOutput out)
-
Methods inherited from class org.drools.core.impl.AbstractRuntime
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drools.core.common.InternalWorkingMemory
createKnowledgeHelper, createKnowledgeHelper, getStoreForClass, onResume, onSuspend
-
Methods inherited from interface org.drools.core.WorkingMemoryEntryPoint
getRuleUnit, setRuleUnit
-
-
-
-
Field Detail
-
ERRORMSG
public static final String ERRORMSG
- See Also:
- Constant Field Values
-
DEFAULT_RULE_UNIT
public static final String DEFAULT_RULE_UNIT
- See Also:
- Constant Field Values
-
bytes
public byte[] bytes
-
id
protected Long id
-
nodeMemories
protected NodeMemories nodeMemories
The actual memory for theJoinNode
s.
-
defaultEntryPoint
protected InternalWorkingMemoryEntryPoint defaultEntryPoint
-
globalResolver
protected GlobalResolver globalResolver
Global values which are associated with this memory.
-
calendars
protected org.kie.api.runtime.Calendars calendars
-
ruleRuntimeEventSupport
protected RuleRuntimeEventSupport ruleRuntimeEventSupport
The eventSupport
-
ruleEventListenerSupport
protected RuleEventListenerSupport ruleEventListenerSupport
-
agendaEventSupport
protected AgendaEventSupport agendaEventSupport
-
kieBaseEventListeners
protected List<org.kie.api.event.kiebase.KieBaseEventListener> kieBaseEventListeners
-
kBase
protected transient InternalKnowledgeBase kBase
TheRuleBase
with which this memory is associated.
-
handleFactory
protected FactHandleFactory handleFactory
-
agenda
protected InternalAgenda agenda
Rule-firing agenda.
-
lock
protected ReentrantLock lock
-
propagationIdCounter
protected AtomicLong propagationIdCounter
This must be thread safe as it is incremented and read via different EntryPoints
-
entryPoints
protected Map<String,WorkingMemoryEntryPoint> entryPoints
-
initialFactHandle
protected InternalFactHandle initialFactHandle
-
config
protected SessionConfiguration config
-
DUMMY_PROCESS_RUNTIME
public static final StatefulKnowledgeSessionImpl.DummyInternalProcessRuntime DUMMY_PROCESS_RUNTIME
-
-
Constructor Detail
-
StatefulKnowledgeSessionImpl
public StatefulKnowledgeSessionImpl()
-
StatefulKnowledgeSessionImpl
public StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase)
-
StatefulKnowledgeSessionImpl
public StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase, boolean initInitFactHandle, SessionConfiguration config, org.kie.api.runtime.Environment environment)
-
StatefulKnowledgeSessionImpl
public StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase, FactHandleFactory handleFactory, long propagationContext, SessionConfiguration config, InternalAgenda agenda, org.kie.api.runtime.Environment environment)
-
-
Method Detail
-
setStateless
public StatefulKnowledgeSessionImpl setStateless(boolean stateless)
-
init
public void init(SessionConfiguration config, org.kie.api.runtime.Environment environment)
-
createTimerService
protected TimerService createTimerService()
-
bindRuleBase
public void bindRuleBase(InternalWorkingMemory workingMemory, InternalKnowledgeBase kBase, InternalAgenda agenda, boolean initInitFactHandle)
-
getTruthMaintenanceSystem
public TruthMaintenanceSystem getTruthMaintenanceSystem()
- Specified by:
getTruthMaintenanceSystem
in interfaceWorkingMemoryEntryPoint
-
getHandleFactory
public FactHandleFactory getHandleFactory()
- Specified by:
getHandleFactory
in interfaceWorkingMemoryEntryPoint
-
setHandleFactory
public void setHandleFactory(FactHandleFactory handleFactory)
-
getKieRuntime
public <T> T getKieRuntime(Class<T> cls)
- Specified by:
getKieRuntime
in interfaceorg.kie.api.runtime.KieSession
-
createRuntimeService
public <T> T createRuntimeService(Class<T> cls)
-
getEntryPoint
public WorkingMemoryEntryPoint getEntryPoint(String name)
- Specified by:
getEntryPoint
in interfaceInternalWorkingMemory
- Specified by:
getEntryPoint
in interfaceorg.kie.api.runtime.rule.RuleRuntime
-
getEntryPoints
public Collection<? extends org.kie.api.runtime.rule.EntryPoint> getEntryPoints()
- Specified by:
getEntryPoints
in interfaceInternalWorkingMemory
- Specified by:
getEntryPoints
in interfaceorg.kie.api.runtime.rule.RuleRuntime
-
getEntryPointMap
public Map<String,WorkingMemoryEntryPoint> getEntryPointMap()
-
getRuleRuntimeEventListeners
public Collection<org.kie.api.event.rule.RuleRuntimeEventListener> getRuleRuntimeEventListeners()
Description copied from interface:WorkingMemoryEventManager
Returns all event listeners.- Specified by:
getRuleRuntimeEventListeners
in interfaceEventSupport
- Specified by:
getRuleRuntimeEventListeners
in interfaceorg.kie.api.event.rule.RuleRuntimeEventManager
- Specified by:
getRuleRuntimeEventListeners
in interfaceWorkingMemoryEventManager
- Returns:
- listeners The listeners.
-
getAgendaEventListeners
public Collection<org.kie.api.event.rule.AgendaEventListener> getAgendaEventListeners()
Description copied from interface:WorkingMemoryEventManager
Returns all event listeners.- Specified by:
getAgendaEventListeners
in interfaceEventSupport
- Specified by:
getAgendaEventListeners
in interfaceorg.kie.api.event.rule.RuleRuntimeEventManager
- Specified by:
getAgendaEventListeners
in interfaceWorkingMemoryEventManager
- Returns:
- listeners The listeners.
-
getProcessRuntime
public InternalProcessRuntime getProcessRuntime()
- Specified by:
getProcessRuntime
in interfaceInternalKnowledgeRuntime
- Specified by:
getProcessRuntime
in interfaceInternalWorkingMemory
-
internalGetProcessRuntime
public InternalProcessRuntime internalGetProcessRuntime()
- Specified by:
internalGetProcessRuntime
in interfaceInternalWorkingMemory
-
addEventListener
public void addEventListener(org.kie.api.event.process.ProcessEventListener listener)
- Specified by:
addEventListener
in interfaceorg.kie.api.event.process.ProcessEventManager
-
getProcessEventListeners
public Collection<org.kie.api.event.process.ProcessEventListener> getProcessEventListeners()
- Specified by:
getProcessEventListeners
in interfaceorg.kie.api.event.process.ProcessEventManager
-
removeEventListener
public void removeEventListener(org.kie.api.event.process.ProcessEventListener listener)
- Specified by:
removeEventListener
in interfaceorg.kie.api.event.process.ProcessEventManager
-
getKieBase
public org.kie.api.KieBase getKieBase()
- Specified by:
getKieBase
in interfaceorg.kie.api.runtime.KieRuntime
- Specified by:
getKieBase
in interfaceorg.kie.internal.runtime.StatefulKnowledgeSession
-
dispose
public void dispose()
Description copied from interface:WorkingMemoryEntryPoint
Internal method called by the engine when the session is being disposed, so that the entry point can proceed with the necessary clean ups.- Specified by:
dispose
in interfaceorg.kie.api.runtime.KieSession
- Specified by:
dispose
in interfaceWorkingMemoryEntryPoint
-
isAlive
public boolean isAlive()
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceorg.kie.api.runtime.KieSession
-
update
public void update(org.kie.api.runtime.rule.FactHandle factHandle)
-
abortProcessInstance
public void abortProcessInstance(long id)
- Specified by:
abortProcessInstance
in interfaceorg.kie.api.runtime.process.ProcessRuntime
-
signalEvent
public void signalEvent(String type, Object event)
- Specified by:
signalEvent
in interfaceorg.kie.api.runtime.process.ProcessRuntime
-
signalEvent
public void signalEvent(String type, Object event, long processInstanceId)
- Specified by:
signalEvent
in interfaceorg.kie.api.runtime.process.ProcessRuntime
-
getGlobals
public org.kie.api.runtime.Globals getGlobals()
- Specified by:
getGlobals
in interfaceorg.kie.api.runtime.KieRuntime
-
getFactHandles
public <T extends org.kie.api.runtime.rule.FactHandle> Collection<T> getFactHandles()
- Specified by:
getFactHandles
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
getFactHandles
public <T extends org.kie.api.runtime.rule.FactHandle> Collection<T> getFactHandles(org.kie.api.runtime.ObjectFilter filter)
- Specified by:
getFactHandles
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
getObjects
public Collection<?> getObjects()
- Specified by:
getObjects
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
getObjects
public Collection<?> getObjects(org.kie.api.runtime.ObjectFilter filter)
- Specified by:
getObjects
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
execute
public <T> T execute(org.kie.api.command.Command<T> command)
- Specified by:
execute
in interfaceorg.kie.api.runtime.CommandExecutor
-
initInitialFact
public InternalFactHandle initInitialFact(InternalKnowledgeBase kBase, MarshallerReaderContext context)
-
initInitialFact
public InternalFactHandle initInitialFact(InternalKnowledgeBase kBase, InternalWorkingMemoryEntryPoint entryPoint, EntryPointId epId, MarshallerReaderContext context)
-
getEntryPointId
public String getEntryPointId()
- Specified by:
getEntryPointId
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
getQueryResultsFromRHS
public QueryResultsImpl getQueryResultsFromRHS(String queryName, Object... arguments)
(This shall NOT be exposed on public API)
-
getQueryResults
public QueryResultsImpl getQueryResults(String queryName, Object... arguments)
Description copied from interface:WorkingMemory
Retrieve the QueryResults of the specified query and arguments- Specified by:
getQueryResults
in interfaceorg.kie.api.runtime.rule.RuleRuntime
- Specified by:
getQueryResults
in interfaceWorkingMemory
- Parameters:
queryName
- The name of the query.arguments
- The arguments used for the query- Returns:
- The QueryResults of the specified query. If no results match the query it is empty.
-
internalGetQueryResult
protected QueryResultsImpl internalGetQueryResult(boolean calledFromRHS, String queryName, Object... arguments)
-
openLiveQuery
public org.kie.api.runtime.rule.LiveQuery openLiveQuery(String query, Object[] arguments, org.kie.api.runtime.rule.ViewChangedEventListener listener)
- Specified by:
openLiveQuery
in interfaceorg.kie.api.runtime.rule.RuleRuntime
-
evalQuery
protected QueryTerminalNode[] evalQuery(String queryName, DroolsQuery queryObject, InternalFactHandle handle, PropagationContext pCtx, boolean isCalledFromRHS)
-
closeLiveQuery
public void closeLiveQuery(InternalFactHandle factHandle)
- Specified by:
closeLiveQuery
in interfaceInternalWorkingMemory
-
getEntryPoint
public EntryPointId getEntryPoint()
- Specified by:
getEntryPoint
in interfaceInternalWorkingMemory
- Specified by:
getEntryPoint
in interfaceWorkingMemoryEntryPoint
-
getInternalWorkingMemory
public InternalWorkingMemory getInternalWorkingMemory()
- Specified by:
getInternalWorkingMemory
in interfaceWorkingMemoryEntryPoint
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
updateEntryPointsCache
public void updateEntryPointsCache()
- Specified by:
updateEntryPointsCache
in interfaceInternalWorkingMemory
-
initDefaultEntryPoint
protected void initDefaultEntryPoint()
-
getSessionConfiguration
public SessionConfiguration getSessionConfiguration()
- Specified by:
getSessionConfiguration
in interfaceInternalWorkingMemory
- Specified by:
getSessionConfiguration
in interfaceorg.kie.api.runtime.KieRuntime
-
reset
public void reset()
- Specified by:
reset
in interfaceWorkingMemoryEntryPoint
-
reset
public void reset(long handleId, long handleCounter, long propagationCounter)
-
setRuleRuntimeEventSupport
public void setRuleRuntimeEventSupport(RuleRuntimeEventSupport ruleRuntimeEventSupport)
- Specified by:
setRuleRuntimeEventSupport
in interfaceInternalWorkingMemory
-
setAgendaEventSupport
public void setAgendaEventSupport(AgendaEventSupport agendaEventSupport)
- Specified by:
setAgendaEventSupport
in interfaceInternalWorkingMemory
-
isSequential
public boolean isSequential()
- Specified by:
isSequential
in interfaceInternalWorkingMemory
-
addEventListener
public void addEventListener(org.kie.api.event.rule.RuleRuntimeEventListener listener)
Description copied from interface:WorkingMemoryEventManager
Add an event listener.- Specified by:
addEventListener
in interfaceorg.kie.api.event.rule.RuleRuntimeEventManager
- Specified by:
addEventListener
in interfaceWorkingMemoryEventManager
- Parameters:
listener
- The listener to add.
-
removeEventListener
public void removeEventListener(org.kie.api.event.rule.RuleRuntimeEventListener listener)
Description copied from interface:WorkingMemoryEventManager
Remove an event listener.- Specified by:
removeEventListener
in interfaceorg.kie.api.event.rule.RuleRuntimeEventManager
- Specified by:
removeEventListener
in interfaceWorkingMemoryEventManager
- Parameters:
listener
- The listener to remove.
-
addEventListener
public void addEventListener(org.kie.api.event.rule.AgendaEventListener listener)
Description copied from interface:WorkingMemoryEventManager
Add an event listener.- Specified by:
addEventListener
in interfaceorg.kie.api.event.rule.RuleRuntimeEventManager
- Specified by:
addEventListener
in interfaceWorkingMemoryEventManager
- Parameters:
listener
- The listener to add.
-
removeEventListener
public void removeEventListener(org.kie.api.event.rule.AgendaEventListener listener)
Description copied from interface:WorkingMemoryEventManager
Remove an event listener.- Specified by:
removeEventListener
in interfaceorg.kie.api.event.rule.RuleRuntimeEventManager
- Specified by:
removeEventListener
in interfaceWorkingMemoryEventManager
- Parameters:
listener
- The listener to remove.
-
addEventListener
public void addEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
- Specified by:
addEventListener
in interfaceorg.kie.api.event.kiebase.KieBaseEventManager
-
getKieBaseEventListeners
public Collection<org.kie.api.event.kiebase.KieBaseEventListener> getKieBaseEventListeners()
- Specified by:
getKieBaseEventListeners
in interfaceorg.kie.api.event.kiebase.KieBaseEventManager
-
removeEventListener
public void removeEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
- Specified by:
removeEventListener
in interfaceorg.kie.api.event.kiebase.KieBaseEventManager
-
getRuleEventSupport
public RuleEventListenerSupport getRuleEventSupport()
- Specified by:
getRuleEventSupport
in interfaceEventSupport
-
setRuleEventListenerSupport
public void setRuleEventListenerSupport(RuleEventListenerSupport ruleEventListenerSupport)
-
addEventListener
public void addEventListener(org.kie.internal.event.rule.RuleEventListener listener)
- Specified by:
addEventListener
in interfaceorg.kie.internal.event.rule.RuleEventManager
-
removeEventListener
public void removeEventListener(org.kie.internal.event.rule.RuleEventListener listener)
- Specified by:
removeEventListener
in interfaceorg.kie.internal.event.rule.RuleEventManager
-
getFactHandleFactory
public FactHandleFactory getFactHandleFactory()
- Specified by:
getFactHandleFactory
in interfaceInternalWorkingMemory
-
setGlobal
public void setGlobal(String identifier, Object value)
Description copied from interface:WorkingMemory
Set a specific instance as a global in this working memory. Null values will return doing nothing. The global identifier and its type must be declared in the drl.- Specified by:
setGlobal
in interfaceorg.kie.api.runtime.KieRuntime
- Specified by:
setGlobal
in interfaceWorkingMemory
- Parameters:
identifier
- the identifier under which to populate the datavalue
- the global value, cannot be null
-
removeGlobal
public void removeGlobal(String identifier)
- Specified by:
removeGlobal
in interfaceInternalWorkingMemory
-
setGlobalResolver
public void setGlobalResolver(GlobalResolver globalResolver)
Description copied from interface:WorkingMemory
Sets the GlobalResolver instance to be used when resolving globals, replaces the current GlobalResolver. Typcicaly a delegating GlobalResolver is created that first gets a reference to the current GlobalResolver, for delegating- Specified by:
setGlobalResolver
in interfaceWorkingMemory
-
getGlobalResolver
public GlobalResolver getGlobalResolver()
Description copied from interface:WorkingMemory
Returns the current GlobalResolver- Specified by:
getGlobalResolver
in interfaceWorkingMemory
- Returns:
-
getCalendars
public org.kie.api.runtime.Calendars getCalendars()
- Specified by:
getCalendars
in interfaceInternalWorkingMemory
- Specified by:
getCalendars
in interfaceorg.kie.api.runtime.KieRuntime
-
getId
public int getId()
- Specified by:
getId
in interfaceorg.kie.api.runtime.KieSession
-
getIdentifier
public long getIdentifier()
- Specified by:
getIdentifier
in interfaceInternalWorkingMemory
- Specified by:
getIdentifier
in interfaceorg.kie.api.runtime.KieSession
-
setIdentifier
public void setIdentifier(long id)
- Specified by:
setIdentifier
in interfaceInternalKnowledgeRuntime
- Specified by:
setIdentifier
in interfaceInternalWorkingMemory
-
checkAlive
protected void checkAlive()
-
getGlobal
public Object getGlobal(String identifier)
Description copied from interface:WorkingMemory
Retrieve a specific instance of global data by identifier- Specified by:
getGlobal
in interfaceorg.kie.api.runtime.KieRuntime
- Specified by:
getGlobal
in interfaceWorkingMemory
- Returns:
- application data or null if nothing is set under this identifier
-
getEnvironment
public org.kie.api.runtime.Environment getEnvironment()
- Specified by:
getEnvironment
in interfaceorg.kie.api.runtime.KieRuntime
- Specified by:
getEnvironment
in interfaceWorkingMemory
-
getAgenda
public InternalAgenda getAgenda()
Description copied from interface:WorkingMemory
Returns the Agenda for this WorkingMemory. While the WorkingMemory interface is considered public, the Agenda interface is more subject to change.- Specified by:
getAgenda
in interfaceInternalWorkingMemory
- Specified by:
getAgenda
in interfaceorg.kie.api.runtime.rule.RuleRuntime
- Specified by:
getAgenda
in interfaceWorkingMemory
- Returns:
- the Agenda
-
clearAgenda
public void clearAgenda()
Description copied from interface:WorkingMemory
Clear the Agenda. Iterates over each AgendaGroup cancalling all Activations.- Specified by:
clearAgenda
in interfaceWorkingMemory
-
clearAgendaGroup
public void clearAgendaGroup(String group)
Description copied from interface:WorkingMemory
Clear the Agenda Group, cancelling all its Activations.- Specified by:
clearAgendaGroup
in interfaceWorkingMemory
-
clearActivationGroup
public void clearActivationGroup(String group)
Description copied from interface:WorkingMemory
Clears the Activation Group, cancellings all its Activations- Specified by:
clearActivationGroup
in interfaceWorkingMemory
-
clearRuleFlowGroup
public void clearRuleFlowGroup(String group)
Description copied from interface:WorkingMemory
Clears the RuleFlow group, cancelling all its Activations- Specified by:
clearRuleFlowGroup
in interfaceWorkingMemory
-
getKnowledgeBase
public InternalKnowledgeBase getKnowledgeBase()
Description copied from interface:WorkingMemory
Retrieve theRuleBase
for this working memory.- Specified by:
getKnowledgeBase
in interfaceWorkingMemory
- Specified by:
getKnowledgeBase
in interfaceWorkingMemoryEntryPoint
- Returns:
- The
RuleBase
.
-
halt
public void halt()
Description copied from interface:WorkingMemory
Stops rule firing after the current rule finishes executing- Specified by:
halt
in interfaceorg.kie.api.runtime.rule.RuleRuntime
- Specified by:
halt
in interfaceWorkingMemory
-
fireAllRules
public int fireAllRules()
Description copied from interface:WorkingMemory
Fire all items on the agenda until empty.- Specified by:
fireAllRules
in interfaceorg.kie.api.runtime.rule.StatefulRuleSession
- Specified by:
fireAllRules
in interfaceWorkingMemory
-
fireAllRules
public int fireAllRules(int fireLimit)
Description copied from interface:WorkingMemory
Fire all items on the agenda until empty or at most 'fireLimit' rules have fired- Specified by:
fireAllRules
in interfaceorg.kie.api.runtime.rule.StatefulRuleSession
- Specified by:
fireAllRules
in interfaceWorkingMemory
-
fireAllRules
public int fireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
Description copied from interface:WorkingMemory
Fire all items on the agenda until empty, using the given AgendaFiler- Specified by:
fireAllRules
in interfaceorg.kie.api.runtime.rule.StatefulRuleSession
- Specified by:
fireAllRules
in interfaceWorkingMemory
-
fireAllRules
public int fireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter, int fireLimit)
Description copied from interface:WorkingMemory
Fire all items on the agenda using the given AgendaFiler until empty or at most 'fireLimit' rules have fired- Specified by:
fireAllRules
in interfaceorg.kie.api.runtime.rule.StatefulRuleSession
- Specified by:
fireAllRules
in interfaceWorkingMemory
-
fireUntilHalt
public void fireUntilHalt()
Keeps firing activations until a halt is called. If in a given moment, there is no activation to fire, it will wait for an activation to be added to an active agenda group or rule flow group.- Specified by:
fireUntilHalt
in interfaceorg.kie.api.runtime.rule.StatefulRuleSession
- Throws:
IllegalStateException
- if this method is called when running in sequential mode
-
fireUntilHalt
public void fireUntilHalt(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
Keeps firing activations until a halt is called. If in a given moment, there is no activation to fire, it will wait for an activation to be added to an active agenda group or rule flow group.- Specified by:
fireUntilHalt
in interfaceorg.kie.api.runtime.rule.StatefulRuleSession
- Parameters:
agendaFilter
- filters the activations that may fire- Throws:
IllegalStateException
- if this method is called when running in sequential mode
-
getObject
public Object getObject(org.kie.api.runtime.rule.FactHandle handle)
Returns the fact Object for the givenFactHandle
. It actually attempts to return the value from the handle, before retrieving it from objects map.- Specified by:
getObject
in interfaceorg.kie.api.runtime.rule.EntryPoint
- Specified by:
getObject
in interfaceWorkingMemory
- Parameters:
handle
- TheFactHandle
reference for theObject
lookup- Returns:
- The associated object.
- See Also:
WorkingMemory
-
getObjectStore
public ObjectStore getObjectStore()
- Specified by:
getObjectStore
in interfaceInternalWorkingMemory
- Specified by:
getObjectStore
in interfaceWorkingMemoryEntryPoint
-
getFactHandle
public org.kie.api.runtime.rule.FactHandle getFactHandle(Object object)
Description copied from interface:WorkingMemory
Retrieve theFactHandle
associated with an Object.- Specified by:
getFactHandle
in interfaceorg.kie.api.runtime.rule.EntryPoint
- Specified by:
getFactHandle
in interfaceWorkingMemory
- Parameters:
object
- The object.- Returns:
- The associated fact handle.
- See Also:
WorkingMemory
-
getFactHandleByIdentity
public org.kie.api.runtime.rule.FactHandle getFactHandleByIdentity(Object object)
Description copied from interface:InternalWorkingMemory
Looks for the fact handle associated to the given object by looking up the object IDENTITY (==), even if rule base is configured to AssertBehavior.EQUALITY.- Specified by:
getFactHandleByIdentity
in interfaceInternalWorkingMemory
- Specified by:
getFactHandleByIdentity
in interfaceWorkingMemory
- Specified by:
getFactHandleByIdentity
in interfaceWorkingMemoryEntryPoint
- Returns:
- null if fact handle not found
- See Also:
WorkingMemory
-
iterateObjects
public Iterator iterateObjects()
This class is not thread safe, changes to the working memory during iteration may give unexpected results- Specified by:
iterateObjects
in interfaceWorkingMemory
- Returns:
- the Iterator
-
iterateObjects
public Iterator iterateObjects(org.kie.api.runtime.ObjectFilter filter)
This class is not thread safe, changes to the working memory during iteration may give unexpected results- Specified by:
iterateObjects
in interfaceWorkingMemory
- Returns:
- the Iterator
-
iterateFactHandles
public Iterator<InternalFactHandle> iterateFactHandles()
This class is not thread safe, changes to the working memory during iteration may give unexpected results- Specified by:
iterateFactHandles
in interfaceWorkingMemory
- Returns:
- the Iterator
-
iterateFactHandles
public Iterator<InternalFactHandle> iterateFactHandles(org.kie.api.runtime.ObjectFilter filter)
This class is not thread safe, changes to the working memory during iteration may give unexpected results- Specified by:
iterateFactHandles
in interfaceWorkingMemory
- Returns:
- the Iterator
-
setFocus
public void setFocus(String focus)
Description copied from interface:WorkingMemory
Set the focus to the specified AgendaGroup- Specified by:
setFocus
in interfaceWorkingMemory
-
insertAsync
public org.kie.api.runtime.rule.FactHandle insertAsync(Object object)
- Specified by:
insertAsync
in interfaceInternalWorkingMemoryActions
-
insert
public org.kie.api.runtime.rule.FactHandle insert(Object object)
- Specified by:
insert
in interfaceorg.kie.api.runtime.rule.EntryPoint
- See Also:
WorkingMemory
-
insert
public org.kie.api.runtime.rule.FactHandle insert(Object object, boolean dynamic)
Description copied from interface:WorkingMemoryEntryPoint
Insert a fact registering JavaBeanPropertyChangeListeners
on the Object to automatically triggerupdate
calls ifdynamic
istrue
.- Specified by:
insert
in interfaceWorkingMemoryEntryPoint
- Parameters:
object
- The fact object.dynamic
- true if Drools should add JavaBeanPropertyChangeListeners
to the object.- Returns:
- The new fact-handle associated with the object.
-
submit
public void submit(org.kie.api.runtime.KieSession.AtomicAction action)
- Specified by:
submit
in interfaceorg.kie.api.runtime.KieSession
-
updateTraits
public void updateTraits(InternalFactHandle h, BitMask mask, Class<?> modifiedClass, Activation activation)
- Specified by:
updateTraits
in interfaceInternalWorkingMemoryActions
-
shed
public <T,K,X extends TraitableBean> Thing<K> shed(Activation activation, TraitableBean<K,X> core, Class<T> trait)
- Specified by:
shed
in interfaceInternalWorkingMemoryActions
-
don
public <T,K> T don(Activation activation, K core, Collection<Class<? extends Thing>> traits, boolean b, org.kie.api.internal.runtime.beliefs.Mode[] modes)
- Specified by:
don
in interfaceInternalWorkingMemoryActions
-
don
public <T,K> T don(Activation activation, K core, Class<T> trait, boolean b, org.kie.api.internal.runtime.beliefs.Mode[] modes)
- Specified by:
don
in interfaceInternalWorkingMemoryActions
-
insert
public org.kie.api.runtime.rule.FactHandle insert(Object object, boolean dynamic, RuleImpl rule, TerminalNode terminalNode)
- Specified by:
insert
in interfaceInternalWorkingMemoryActions
-
retract
public void retract(org.kie.api.runtime.rule.FactHandle handle)
- Specified by:
retract
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
delete
public void delete(org.kie.api.runtime.rule.FactHandle handle)
- Specified by:
delete
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
delete
public void delete(org.kie.api.runtime.rule.FactHandle handle, org.kie.api.runtime.rule.FactHandle.State fhState)
- Specified by:
delete
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
delete
public void delete(org.kie.api.runtime.rule.FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode)
- Specified by:
delete
in interfaceWorkingMemoryEntryPoint
-
delete
public void delete(org.kie.api.runtime.rule.FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode, org.kie.api.runtime.rule.FactHandle.State fhState)
- Specified by:
delete
in interfaceWorkingMemoryEntryPoint
-
getEntryPointNode
public EntryPointNode getEntryPointNode()
- Specified by:
getEntryPointNode
in interfaceInternalWorkingMemory
- Specified by:
getEntryPointNode
in interfaceWorkingMemoryEntryPoint
-
update
public void update(org.kie.api.runtime.rule.FactHandle handle, Object object)
- Specified by:
update
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
update
public void update(org.kie.api.runtime.rule.FactHandle handle, Object object, String... modifiedProperties)
- Specified by:
update
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
update
public void update(org.kie.api.runtime.rule.FactHandle factHandle, Object object, BitMask mask, Class<?> modifiedClass, Activation activation)
modify is implemented as half way retract / assert due to the truth maintenance issues.- Specified by:
update
in interfaceInternalWorkingMemoryActions
- Specified by:
update
in interfaceWorkingMemoryEntryPoint
- See Also:
WorkingMemory
-
executeQueuedActions
public void executeQueuedActions()
- Specified by:
executeQueuedActions
in interfaceInternalKnowledgeRuntime
-
queueWorkingMemoryAction
public void queueWorkingMemoryAction(WorkingMemoryAction action)
- Specified by:
queueWorkingMemoryAction
in interfaceInternalKnowledgeRuntime
- Specified by:
queueWorkingMemoryAction
in interfaceInternalWorkingMemory
-
getNodeMemory
public <T extends Memory> T getNodeMemory(MemoryFactory<T> node)
Retrieve theJoinMemory
for a particularJoinNode
.- Specified by:
getNodeMemory
in interfaceInternalWorkingMemory
- Parameters:
node
- TheJoinNode
key.- Returns:
- The node's memory.
-
clearNodeMemory
public void clearNodeMemory(MemoryFactory node)
- Specified by:
clearNodeMemory
in interfaceInternalWorkingMemory
-
getNodeMemories
public NodeMemories getNodeMemories()
- Specified by:
getNodeMemories
in interfaceInternalWorkingMemory
-
getRuleRuntimeEventSupport
public RuleRuntimeEventSupport getRuleRuntimeEventSupport()
- Specified by:
getRuleRuntimeEventSupport
in interfaceEventSupport
-
getAgendaEventSupport
public AgendaEventSupport getAgendaEventSupport()
- Specified by:
getAgendaEventSupport
in interfaceEventSupport
-
setAsyncExceptionHandler
public void setAsyncExceptionHandler(AsyncExceptionHandler handler)
Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules.- Specified by:
setAsyncExceptionHandler
in interfaceWorkingMemory
-
getNextPropagationIdCounter
public long getNextPropagationIdCounter()
- Specified by:
getNextPropagationIdCounter
in interfaceInternalWorkingMemory
-
getPropagationIdCounter
public long getPropagationIdCounter()
-
getLock
public Lock getLock()
- Specified by:
getLock
in interfaceInternalWorkingMemory
-
startProcess
public org.kie.api.runtime.process.ProcessInstance startProcess(String processId)
Description copied from interface:WorkingMemory
Starts a new process instance for the process with the given id.- Specified by:
startProcess
in interfaceorg.kie.api.runtime.process.ProcessRuntime
- Specified by:
startProcess
in interfaceWorkingMemory
-
startProcess
public org.kie.api.runtime.process.ProcessInstance startProcess(String processId, Map<String,Object> parameters)
Description copied from interface:WorkingMemory
Starts a new process instance for the process with the given id.- Specified by:
startProcess
in interfaceorg.kie.api.runtime.process.ProcessRuntime
- Specified by:
startProcess
in interfaceWorkingMemory
-
startProcess
public org.kie.api.runtime.process.ProcessInstance startProcess(String processId, org.kie.api.runtime.rule.AgendaFilter agendaFilter)
- Specified by:
startProcess
in interfaceorg.kie.api.runtime.process.ProcessRuntime
-
startProcess
public org.kie.api.runtime.process.ProcessInstance startProcess(String processId, Map<String,Object> parameters, org.kie.api.runtime.rule.AgendaFilter agendaFilter)
- Specified by:
startProcess
in interfaceorg.kie.api.runtime.process.ProcessRuntime
-
createProcessInstance
public org.kie.api.runtime.process.ProcessInstance createProcessInstance(String processId, Map<String,Object> parameters)
- Specified by:
createProcessInstance
in interfaceorg.kie.api.runtime.process.ProcessRuntime
-
startProcessInstance
public org.kie.api.runtime.process.ProcessInstance startProcessInstance(long processInstanceId)
- Specified by:
startProcessInstance
in interfaceorg.kie.api.runtime.process.ProcessRuntime
-
getProcessInstances
public Collection<org.kie.api.runtime.process.ProcessInstance> getProcessInstances()
Description copied from interface:WorkingMemory
Returns the list of process instances of this working memory. This list is unmodifiable.- Specified by:
getProcessInstances
in interfaceorg.kie.api.runtime.process.ProcessRuntime
- Specified by:
getProcessInstances
in interfaceWorkingMemory
- Returns:
- the list of process instances
-
getProcessInstance
public org.kie.api.runtime.process.ProcessInstance getProcessInstance(Object processInstanceId)
-
getProcessInstance
public org.kie.api.runtime.process.ProcessInstance getProcessInstance(long processInstanceId)
Description copied from interface:WorkingMemory
Returns the process instance with the given id.- Specified by:
getProcessInstance
in interfaceorg.kie.api.runtime.process.ProcessRuntime
- Specified by:
getProcessInstance
in interfaceWorkingMemory
- Returns:
- the process instance with the given id
-
startProcess
public org.kie.api.runtime.process.ProcessInstance startProcess(String processId, org.kie.internal.process.CorrelationKey correlationKey, Map<String,Object> parameters)
- Specified by:
startProcess
in interfaceorg.kie.internal.process.CorrelationAwareProcessRuntime
-
createProcessInstance
public org.kie.api.runtime.process.ProcessInstance createProcessInstance(String processId, org.kie.internal.process.CorrelationKey correlationKey, Map<String,Object> parameters)
- Specified by:
createProcessInstance
in interfaceorg.kie.internal.process.CorrelationAwareProcessRuntime
-
getProcessInstance
public org.kie.api.runtime.process.ProcessInstance getProcessInstance(org.kie.internal.process.CorrelationKey correlationKey)
- Specified by:
getProcessInstance
in interfaceorg.kie.internal.process.CorrelationAwareProcessRuntime
-
getProcessInstance
public org.kie.api.runtime.process.ProcessInstance getProcessInstance(long processInstanceId, boolean readOnly)
- Specified by:
getProcessInstance
in interfaceorg.kie.api.runtime.process.ProcessRuntime
- Specified by:
getProcessInstance
in interfaceWorkingMemory
-
getWorkItemManager
public org.kie.api.runtime.process.WorkItemManager getWorkItemManager()
- Specified by:
getWorkItemManager
in interfaceorg.kie.api.runtime.process.ProcessRuntime
- Specified by:
getWorkItemManager
in interfaceWorkingMemory
-
getWorkingMemoryEntryPoint
public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String name)
Description copied from interface:WorkingMemory
Returns the interface instance for a given entry point, so that the application can manage entry-point-scoped facts.- Specified by:
getWorkingMemoryEntryPoint
in interfaceWorkingMemory
- Specified by:
getWorkingMemoryEntryPoint
in interfaceWorkingMemoryEntryPoint
- Parameters:
name
- the id of the entry point, as defined in the rules file
-
getWorkingMemoryEntryPoints
public Map<String,WorkingMemoryEntryPoint> getWorkingMemoryEntryPoints()
-
getObjectTypeConfigurationRegistry
public ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry()
- Specified by:
getObjectTypeConfigurationRegistry
in interfaceInternalWorkingMemory
- Specified by:
getObjectTypeConfigurationRegistry
in interfaceWorkingMemoryEntryPoint
-
getInitialFactHandle
public InternalFactHandle getInitialFactHandle()
- Specified by:
getInitialFactHandle
in interfaceInternalWorkingMemory
-
setInitialFactHandle
public void setInitialFactHandle(InternalFactHandle initialFactHandle)
-
getTimerService
public TimerService getTimerService()
Description copied from interface:InternalWorkingMemory
Returns the TimerService instance (session clock) for this session.- Specified by:
getTimerService
in interfaceInternalKnowledgeRuntime
- Specified by:
getTimerService
in interfaceInternalWorkingMemory
- Returns:
-
getSessionClock
public org.kie.api.time.SessionClock getSessionClock()
Description copied from interface:WorkingMemory
Returns the session clock instance associated with this session- Specified by:
getSessionClock
in interfaceorg.kie.api.runtime.KieRuntime
- Specified by:
getSessionClock
in interfaceWorkingMemory
- Returns:
-
startBatchExecution
public void startBatchExecution()
- Specified by:
startBatchExecution
in interfaceInternalWorkingMemory
-
endBatchExecution
public void endBatchExecution()
- Specified by:
endBatchExecution
in interfaceInternalWorkingMemory
-
getKnowledgeRuntime
public InternalKnowledgeRuntime getKnowledgeRuntime()
- Specified by:
getKnowledgeRuntime
in interfaceInternalWorkingMemory
-
registerChannel
public void registerChannel(String name, org.kie.api.runtime.Channel channel)
- Specified by:
registerChannel
in interfaceorg.kie.api.runtime.KieRuntime
-
unregisterChannel
public void unregisterChannel(String name)
- Specified by:
unregisterChannel
in interfaceorg.kie.api.runtime.KieRuntime
-
getChannels
public Map<String,org.kie.api.runtime.Channel> getChannels()
Description copied from interface:InternalWorkingMemory
Returns a map of channel Id->Channel of all channels in this working memory- Specified by:
getChannels
in interfaceInternalWorkingMemory
- Specified by:
getChannels
in interfaceorg.kie.api.runtime.KieRuntime
- Returns:
-
getFactCount
public long getFactCount()
- Specified by:
getFactCount
in interfaceorg.kie.api.runtime.rule.EntryPoint
-
getTotalFactCount
public long getTotalFactCount()
Description copied from interface:InternalWorkingMemory
Returns the total number of facts in the working memory, i.e., counting all facts from all entry points. This is an approximate value and may not be accurate due to the concurrent nature of the entry points.- Specified by:
getTotalFactCount
in interfaceInternalWorkingMemory
- Returns:
-
startOperation
public void startOperation()
This method must be called before starting any new work in the engine, like inserting a new fact or firing a new rule. It will reset the engine idle time counter. This method must be extremely light to avoid contentions when called by multiple threads/entry-points- Specified by:
startOperation
in interfaceInternalKnowledgeRuntime
- Specified by:
startOperation
in interfaceInternalWorkingMemory
-
setEndOperationListener
public void setEndOperationListener(EndOperationListener listener)
- Specified by:
setEndOperationListener
in interfaceInternalKnowledgeRuntime
-
endOperation
public void endOperation()
This method must be called after finishing any work in the engine, like inserting a new fact or firing a new rule. It will reset the engine idle time counter. This method must be extremely light to avoid contentions when called by multiple threads/entry-points- Specified by:
endOperation
in interfaceInternalKnowledgeRuntime
- Specified by:
endOperation
in interfaceInternalWorkingMemory
-
getIdleTime
public long getIdleTime()
Returns the number of time units (usually ms) that the engine is idle according to the session clock or -1 if it is not idle. This method is not synchronised and might return an approximate value.- Specified by:
getIdleTime
in interfaceInternalWorkingMemory
- Returns:
-
getLastIdleTimestamp
public long getLastIdleTimestamp()
- Specified by:
getLastIdleTimestamp
in interfaceInternalKnowledgeRuntime
-
prepareToFireActivation
public void prepareToFireActivation()
Description copied from interface:InternalWorkingMemory
This method is called by the agenda before firing a new activation to ensure the working memory is in a safe state to fire the activation.- Specified by:
prepareToFireActivation
in interfaceInternalWorkingMemory
-
activationFired
public void activationFired()
Description copied from interface:InternalWorkingMemory
This method is called by the agenda right after an activation was fired to allow the working memory to resume any activities blocked during activation firing.- Specified by:
activationFired
in interfaceInternalWorkingMemory
-
getTimeToNextJob
public long getTimeToNextJob()
Returns the number of time units (usually ms) to the next scheduled job- Specified by:
getTimeToNextJob
in interfaceInternalWorkingMemory
- Returns:
- the number of time units until the next scheduled job or -1 if there is no job scheduled
-
addPropagation
public void addPropagation(PropagationEntry propagationEntry)
- Specified by:
addPropagation
in interfaceInternalWorkingMemory
-
flushPropagations
public void flushPropagations()
- Specified by:
flushPropagations
in interfaceInternalWorkingMemory
-
notifyWaitOnRest
public void notifyWaitOnRest()
- Specified by:
notifyWaitOnRest
in interfaceInternalWorkingMemory
-
getActionsIterator
public Iterator<? extends PropagationEntry> getActionsIterator()
- Specified by:
getActionsIterator
in interfaceInternalWorkingMemory
-
activate
public void activate()
- Specified by:
activate
in interfaceInternalWorkingMemory
-
deactivate
public void deactivate()
- Specified by:
deactivate
in interfaceInternalWorkingMemory
-
tryDeactivate
public boolean tryDeactivate()
- Specified by:
tryDeactivate
in interfaceInternalWorkingMemory
-
cancelActivation
public void cancelActivation(Activation activation, boolean declarativeAgenda)
- Specified by:
cancelActivation
in interfaceInternalWorkingMemory
-
getPropagationList
public PropagationList getPropagationList()
- Specified by:
getPropagationList
in interfaceInternalWorkingMemory
-
iterateObjectsToList
public List iterateObjectsToList()
-
iterateNonDefaultEntryPointObjectsToList
public List iterateNonDefaultEntryPointObjectsToList()
-
getActivationParameters
public Map.Entry[] getActivationParameters(long activationId)
-
getActivationParameters
public Map getActivationParameters(Activation activation)
-
startProcessFromNodeIds
public org.kie.api.runtime.process.ProcessInstance startProcessFromNodeIds(String processId, Map<String,Object> params, String... nodeInstancesIds)
- Specified by:
startProcessFromNodeIds
in interfaceorg.kie.api.runtime.process.ProcessRuntime
-
startProcessFromNodeIds
public org.kie.api.runtime.process.ProcessInstance startProcessFromNodeIds(String processId, org.kie.internal.process.CorrelationKey key, Map<String,Object> params, String... nodeIds)
- Specified by:
startProcessFromNodeIds
in interfaceorg.kie.internal.process.CorrelationAwareProcessRuntime
-
-