org.drools.reteoo
Class DisposedReteooWorkingMemory

java.lang.Object
  extended by org.drools.reteoo.DisposedReteooWorkingMemory
All Implemented Interfaces:
EventSupport, InternalWorkingMemory, InternalWorkingMemoryActions, InternalWorkingMemoryEntryPoint, org.drools.event.process.ProcessEventManager, ReteooWorkingMemoryInterface, RuleBaseEventManager, org.drools.runtime.rule.WorkingMemoryEntryPoint, WorkingMemory, WorkingMemoryEventManager

public class DisposedReteooWorkingMemory
extends Object
implements ReteooWorkingMemoryInterface


Field Summary
static DisposedReteooWorkingMemory INSTANCE
           
 
Method Summary
 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(AgendaEventListener listener)
          Add an event listener.
 void addEventListener(org.drools.event.process.ProcessEventListener listener)
           
 void addEventListener(RuleBaseEventListener listener)
          Add an event listener.
 void addEventListener(WorkingMemoryEventListener listener)
          Add an event listener.
 void addLIANodePropagation(LIANodePropagation liaNodePropagation)
           
 void clearActivationGroup(String group)
          Clears the Activation Group, cancellings all its Activations
 void clearAgenda()
          Clear the Agenda.
 void clearAgendaGroup(String group)
          Clear the Agenda Group, cancelling all its Activations.
 void clearNodeMemory(NodeMemory node)
           
 void clearRuleFlowGroup(String group)
          Clears the RuleFlow group, cancelling all its Activations
 org.drools.runtime.process.ProcessInstance createProcessInstance(String processId, Map<String,Object> parameters)
           
 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.
 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.
 void executeQueuedActions()
           
 int fireAllRules()
          Fire all items on the agenda until empty.
 int fireAllRules(AgendaFilter agendaFilter)
          Fire all items on the agenda until empty, using the given AgendaFiler
 int fireAllRules(AgendaFilter agendaFilter, int fireLimit)
          Fire all items on the agenda using the given AgendaFiler until empty or at most 'fireLimit' rules have fired
 int fireAllRules(int fireLimit)
          Fire all items on the agenda until empty or at most 'fireLimit' rules have fired
 void fireUntilHalt()
           
 void fireUntilHalt(AgendaFilter agendaFilterWrapper)
           
 Queue<WorkingMemoryAction> getActionQueue()
           
 Agenda getAgenda()
          Returns the Agenda for this WorkingMemory.
 List getAgendaEventListeners()
          Returns all event listeners.
 AgendaEventSupport getAgendaEventSupport()
           
 org.drools.runtime.Calendars getCalendars()
           
 Map<String,org.drools.runtime.Channel> getChannels()
          Returns a map of channel Id->Channel of all channels in this working memory
 DateFormats getDateFormats()
           
 EntryPoint getEntryPoint()
           
 String getEntryPointId()
           
 EntryPointNode getEntryPointNode()
           
 Map<String,? extends org.drools.runtime.rule.WorkingMemoryEntryPoint> getEntryPoints()
           
 org.drools.runtime.Environment getEnvironment()
           
 ExecutionResultImpl getExecutionResult()
           
 Map<String,org.drools.runtime.ExitPoint> getExitPoints()
           
 long getFactCount()
           
 FactHandle getFactHandle(Object object)
          Retrieve the FactHandle associated with an Object.
 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.drools.runtime.rule.FactHandle>
Collection<T>
getFactHandles()
           
<T extends org.drools.runtime.rule.FactHandle>
Collection<T>
getFactHandles(org.drools.runtime.ObjectFilter filter)
           
 Object getGlobal(String identifier)
          Retrieve a specific instance of global data by identifier
 GlobalResolver getGlobalResolver()
          Returns the current GlobalResolver
 int getId()
           
 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()
           
 InternalKnowledgeRuntime getKnowledgeRuntime()
           
 long getLastIdleTimestamp()
           
 Lock getLock()
           
 long getNextPropagationIdCounter()
           
 NodeMemories getNodeMemories()
           
 Memory getNodeMemory(NodeMemory node)
           
 Object getObject(org.drools.runtime.rule.FactHandle handle)
          Retrieve the object associated with a FactHandle.
 Collection<Object> getObjects()
           
 Collection<Object> getObjects(org.drools.runtime.ObjectFilter filter)
           
 ObjectStore getObjectStore()
           
 ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry()
           
 PartitionTaskManager getPartitionTaskManager(RuleBasePartitionId partitionId)
          Returns the PartitionTaskManager for the given partition ID in case the rulebase has partitions enabled
 Collection<org.drools.event.process.ProcessEventListener> getProcessEventListeners()
           
 org.drools.runtime.process.ProcessInstance getProcessInstance(long id)
          Returns the process instance with the given id.
 Collection<org.drools.runtime.process.ProcessInstance> getProcessInstances()
          Returns the list of process instances of this working memory.
 InternalProcessRuntime getProcessRuntime()
           
 QueryResults getQueryResults(String query, Object... arguments)
          Retrieve the QueryResults of the specified query and arguments
 RuleBase getRuleBase()
          Retrieve the RuleBase for this working memory.
 List<RuleBaseEventListener> getRuleBaseEventListeners()
          Returns all event listeners.
 org.drools.time.SessionClock getSessionClock()
          Returns the session clock instance associated with this session
 SessionConfiguration 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 job
 long 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 id)
          Returns the interface instance for a given entry point, so that the application can manage entry-point-scoped facts.
 Collection<? extends org.drools.runtime.rule.WorkingMemoryEntryPoint> getWorkingMemoryEntryPoints()
           
 List getWorkingMemoryEventListeners()
          Returns all event listeners.
 WorkingMemoryEventSupport getWorkingMemoryEventSupport()
           
 org.drools.runtime.process.WorkItemManager getWorkItemManager()
           
 void halt()
          Stops rule firing after the current rule finishes executing
 void insert(InternalFactHandle handle, Object object, Rule rule, Activation activation, ObjectTypeConf typeConf)
           
 FactHandle insert(Object object)
          Assert a fact.
 FactHandle insert(Object object, boolean dynamic)
          Insert a fact registering JavaBean PropertyChangeListeners on the Object to automatically trigger update calls if dynamic is true.
 FactHandle insert(Object object, boolean dynamic, boolean logical, Rule rule, Activation activation)
           
 FactHandle insertLogical(Object object, boolean dynamic)
           
 boolean isSequential()
           
 Iterator<?> iterateFactHandles()
          Returns an Iterator for the FactHandles in the Working Memory.
 Iterator<?> iterateFactHandles(org.drools.runtime.ObjectFilter filter)
          Returns an Iterator for the Objects in the Working Memory.
 Iterator<?> iterateObjects()
          Returns an Iterator for the Objects in the Working Memory.
 Iterator<?> iterateObjects(org.drools.runtime.ObjectFilter filter)
          Returns an Iterator for the Objects in the Working Memory.
 org.drools.runtime.rule.LiveQuery openLiveQuery(String query, Object[] arguments, org.drools.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 registerChannel(String name, org.drools.runtime.Channel channel)
           
 void registerExitPoint(String name, org.drools.runtime.ExitPoint exitPoint)
           
 void removeEventListener(AgendaEventListener listener)
          Remove an event listener.
 void removeEventListener(org.drools.event.process.ProcessEventListener listener)
           
 void removeEventListener(RuleBaseEventListener listener)
          Remove an event listener.
 void removeEventListener(WorkingMemoryEventListener listener)
          Remove an event listener.
 void reset()
           
 void retract(org.drools.runtime.rule.FactHandle handle)
          Retract a fact.
 void retract(FactHandle handle, boolean removeLogical, boolean updateEqualsMap, Rule rule, Activation activation)
           
 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 AgendaGroup
 void 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 setId(int id)
           
 void setKnowledgeRuntime(InternalKnowledgeRuntime kruntime)
           
 void setWorkingMemoryEventSupport(WorkingMemoryEventSupport workingMemoryEventSupport)
           
 void startBatchExecution(ExecutionResultImpl results)
           
 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.drools.runtime.process.ProcessInstance startProcess(String processId)
          Starts a new process instance for the process with the given id.
 org.drools.runtime.process.ProcessInstance startProcess(String processId, Map<String,Object> parameters)
          Starts a new process instance for the process with the given id.
 org.drools.runtime.process.ProcessInstance startProcessInstance(long processInstanceId)
           
 void unregisterChannel(String name)
           
 void unregisterExitPoint(String name)
           
 void update(org.drools.runtime.rule.FactHandle handle, Object object)
          Inform the WorkingMemory that a Fact has been modified and that it should now update the network.
 void update(FactHandle handle, Object object, long mask, Activation activation)
           
 void update(org.drools.runtime.rule.FactHandle handle, Object object, long mask, Activation activation)
           
 void update(FactHandle handle, Object object, Rule rule, Activation activation)
           
 void update(org.drools.runtime.rule.FactHandle handle, Object object, Rule rule, Activation activation)
           
 void updateEntryPointsCache()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final DisposedReteooWorkingMemory INSTANCE
Method Detail

update

public void update(FactHandle handle,
                   Object object,
                   long mask,
                   Activation activation)
            throws FactException
Throws:
FactException

retract

public void retract(FactHandle handle,
                    boolean removeLogical,
                    boolean updateEqualsMap,
                    Rule rule,
                    Activation activation)
             throws FactException
Specified by:
retract in interface InternalWorkingMemory
Specified by:
retract in interface InternalWorkingMemoryActions
Specified by:
retract in interface InternalWorkingMemoryEntryPoint
Throws:
FactException

insert

public FactHandle insert(Object object,
                         boolean dynamic,
                         boolean logical,
                         Rule rule,
                         Activation activation)
                  throws FactException
Specified by:
insert in interface InternalWorkingMemoryActions
Throws:
FactException

insertLogical

public FactHandle insertLogical(Object object,
                                boolean dynamic)
                         throws FactException
Specified by:
insertLogical in interface InternalWorkingMemoryActions
Throws:
FactException

getId

public int getId()
Specified by:
getId in interface InternalWorkingMemory

setId

public void setId(int id)
Specified by:
setId in interface InternalWorkingMemory

setWorkingMemoryEventSupport

public void setWorkingMemoryEventSupport(WorkingMemoryEventSupport workingMemoryEventSupport)
Specified by:
setWorkingMemoryEventSupport in interface InternalWorkingMemory

setAgendaEventSupport

public void setAgendaEventSupport(AgendaEventSupport agendaEventSupport)
Specified by:
setAgendaEventSupport in interface InternalWorkingMemory

getNodeMemory

public Memory getNodeMemory(NodeMemory node)
Specified by:
getNodeMemory in interface InternalWorkingMemory

clearNodeMemory

public void clearNodeMemory(NodeMemory node)
Specified by:
clearNodeMemory in interface InternalWorkingMemory

getNodeMemories

public NodeMemories getNodeMemories()
Specified by:
getNodeMemories in interface InternalWorkingMemory

getNextPropagationIdCounter

public long getNextPropagationIdCounter()
Specified by:
getNextPropagationIdCounter in interface InternalWorkingMemory

getObjectStore

public ObjectStore getObjectStore()
Specified by:
getObjectStore in interface InternalWorkingMemory
Specified by:
getObjectStore in interface InternalWorkingMemoryEntryPoint

getTruthMaintenanceSystem

public TruthMaintenanceSystem getTruthMaintenanceSystem()
Specified by:
getTruthMaintenanceSystem in interface InternalWorkingMemory

executeQueuedActions

public void executeQueuedActions()
Specified by:
executeQueuedActions in interface InternalWorkingMemory

queueWorkingMemoryAction

public void queueWorkingMemoryAction(WorkingMemoryAction action)
Specified by:
queueWorkingMemoryAction in interface InternalWorkingMemory

getFactHandleFactory

public FactHandleFactory getFactHandleFactory()
Specified by:
getFactHandleFactory in interface InternalWorkingMemory

getEntryPoint

public EntryPoint getEntryPoint()
Specified by:
getEntryPoint in interface InternalWorkingMemory
Specified by:
getEntryPoint in interface InternalWorkingMemoryEntryPoint

getEntryPointNode

public EntryPointNode getEntryPointNode()
Specified by:
getEntryPointNode in interface InternalWorkingMemory
Specified by:
getEntryPointNode in interface InternalWorkingMemoryEntryPoint

insert

public void insert(InternalFactHandle handle,
                   Object object,
                   Rule rule,
                   Activation activation,
                   ObjectTypeConf typeConf)
Specified by:
insert in interface InternalWorkingMemory

getFactHandleByIdentity

public 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 interface InternalWorkingMemory
Specified by:
getFactHandleByIdentity in interface InternalWorkingMemoryEntryPoint
Specified by:
getFactHandleByIdentity in interface WorkingMemory
Returns:
null if fact handle not found

getLock

public Lock getLock()
Specified by:
getLock in interface InternalWorkingMemory

isSequential

public boolean isSequential()
Specified by:
isSequential in interface InternalWorkingMemory

addLIANodePropagation

public void addLIANodePropagation(LIANodePropagation liaNodePropagation)
Specified by:
addLIANodePropagation in interface InternalWorkingMemory

getObjectTypeConfigurationRegistry

public ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry()
Specified by:
getObjectTypeConfigurationRegistry in interface InternalWorkingMemory
Specified by:
getObjectTypeConfigurationRegistry in interface InternalWorkingMemoryEntryPoint

getInitialFactHandle

public InternalFactHandle getInitialFactHandle()
Specified by:
getInitialFactHandle in interface InternalWorkingMemory

getCalendars

public org.drools.runtime.Calendars getCalendars()
Specified by:
getCalendars in interface InternalWorkingMemory

getTimerService

public TimerService getTimerService()
Description copied from interface: InternalWorkingMemory
Returns the TimerService instance (session clock) for this session.

Specified by:
getTimerService in interface InternalWorkingMemory
Returns:

getPartitionTaskManager

public PartitionTaskManager getPartitionTaskManager(RuleBasePartitionId partitionId)
Description copied from interface: InternalWorkingMemory
Returns the PartitionTaskManager for the given partition ID in case the rulebase has partitions enabled

Specified by:
getPartitionTaskManager in interface InternalWorkingMemory
Parameters:
partitionId - the ID of the partition for which the task manager is assigned
Returns:
the PartitionTaskManager

setKnowledgeRuntime

public void setKnowledgeRuntime(InternalKnowledgeRuntime kruntime)
Specified by:
setKnowledgeRuntime in interface InternalWorkingMemory

getKnowledgeRuntime

public InternalKnowledgeRuntime getKnowledgeRuntime()
Specified by:
getKnowledgeRuntime in interface InternalWorkingMemory

getExitPoints

public Map<String,org.drools.runtime.ExitPoint> getExitPoints()
Specified by:
getExitPoints in interface InternalWorkingMemory

getChannels

public Map<String,org.drools.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 interface InternalWorkingMemory
Returns:

getEntryPoints

public Map<String,? extends org.drools.runtime.rule.WorkingMemoryEntryPoint> getEntryPoints()
Specified by:
getEntryPoints in interface InternalWorkingMemory

getSessionConfiguration

public SessionConfiguration getSessionConfiguration()
Specified by:
getSessionConfiguration in interface InternalWorkingMemory

startBatchExecution

public void startBatchExecution(ExecutionResultImpl results)
Specified by:
startBatchExecution in interface InternalWorkingMemory

getExecutionResult

public ExecutionResultImpl getExecutionResult()
Specified by:
getExecutionResult in interface InternalWorkingMemory

endBatchExecution

public void endBatchExecution()
Specified by:
endBatchExecution in interface InternalWorkingMemory

startOperation

public void startOperation()
Description copied from interface: InternalWorkingMemory
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 interface InternalWorkingMemory

endOperation

public void endOperation()
Description copied from interface: InternalWorkingMemory
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 interface InternalWorkingMemory

getIdleTime

public long getIdleTime()
Description copied from interface: InternalWorkingMemory
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 interface InternalWorkingMemory
Returns:

getTimeToNextJob

public long getTimeToNextJob()
Description copied from interface: InternalWorkingMemory
Returns the number of time units (usually ms) to the next scheduled job

Specified by:
getTimeToNextJob in interface InternalWorkingMemory
Returns:
the number of time units until the next scheduled job or -1 if there is no job scheduled

updateEntryPointsCache

public void updateEntryPointsCache()
Specified by:
updateEntryPointsCache in interface InternalWorkingMemory

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 interface InternalWorkingMemory

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 interface InternalWorkingMemory

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 interface InternalWorkingMemory
Returns:

getDateFormats

public DateFormats getDateFormats()
Specified by:
getDateFormats in interface InternalWorkingMemory

getProcessRuntime

public InternalProcessRuntime getProcessRuntime()
Specified by:
getProcessRuntime in interface InternalWorkingMemory

getAgenda

public Agenda 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 interface WorkingMemory
Returns:
the Agenda

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 interface WorkingMemory
Parameters:
identifier - the identifier under which to populate the data
value - the global value, cannot be null

getGlobal

public Object getGlobal(String identifier)
Description copied from interface: WorkingMemory
Retrieve a specific instance of global data by identifier

Specified by:
getGlobal in interface WorkingMemory
Returns:
application data or null if nothing is set under this identifier

getEnvironment

public org.drools.runtime.Environment getEnvironment()
Specified by:
getEnvironment in interface WorkingMemory

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 interface WorkingMemory

getGlobalResolver

public GlobalResolver getGlobalResolver()
Description copied from interface: WorkingMemory
Returns the current GlobalResolver

Specified by:
getGlobalResolver in interface WorkingMemory
Returns:

getRuleBase

public RuleBase getRuleBase()
Description copied from interface: WorkingMemory
Retrieve the RuleBase for this working memory.

Specified by:
getRuleBase in interface InternalWorkingMemoryEntryPoint
Specified by:
getRuleBase in interface WorkingMemory
Returns:
The RuleBase.

fireAllRules

public int fireAllRules()
                 throws FactException
Description copied from interface: WorkingMemory
Fire all items on the agenda until empty.

Specified by:
fireAllRules in interface WorkingMemory
Throws:
FactException - If a RuntimeException error occurs.

fireAllRules

public int fireAllRules(AgendaFilter agendaFilter)
                 throws FactException
Description copied from interface: WorkingMemory
Fire all items on the agenda until empty, using the given AgendaFiler

Specified by:
fireAllRules in interface WorkingMemory
Throws:
FactException - If a RuntimeException error occurs.

fireAllRules

public int fireAllRules(int fireLimit)
                 throws FactException
Description copied from interface: WorkingMemory
Fire all items on the agenda until empty or at most 'fireLimit' rules have fired

Specified by:
fireAllRules in interface WorkingMemory
Throws:
FactException - If a RuntimeException error occurs.

fireAllRules

public int fireAllRules(AgendaFilter agendaFilter,
                        int fireLimit)
                 throws FactException
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 interface WorkingMemory
Throws:
FactException - If a RuntimeException error occurs.

getObject

public Object getObject(org.drools.runtime.rule.FactHandle handle)
Description copied from interface: WorkingMemory
Retrieve the object associated with a FactHandle.

Specified by:
getObject in interface org.drools.runtime.rule.WorkingMemoryEntryPoint
Specified by:
getObject in interface WorkingMemory
Parameters:
handle - The fact handle.
Returns:
The associated object.

getFactHandle

public FactHandle getFactHandle(Object object)
Description copied from interface: WorkingMemory
Retrieve the FactHandle associated with an Object.

Specified by:
getFactHandle in interface org.drools.runtime.rule.WorkingMemoryEntryPoint
Specified by:
getFactHandle in interface WorkingMemory
Parameters:
object - The object.
Returns:
The associated fact handle.

iterateObjects

public Iterator<?> iterateObjects()
Description copied from interface: WorkingMemory
Returns an Iterator for the Objects in the Working Memory. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.

Specified by:
iterateObjects in interface WorkingMemory
Returns:
the Iterator

iterateObjects

public Iterator<?> iterateObjects(org.drools.runtime.ObjectFilter filter)
Description copied from interface: WorkingMemory
Returns an Iterator for the Objects in the Working Memory. This Iterator will filter out any objects that the ObjectFilter does not accept. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.

Specified by:
iterateObjects in interface WorkingMemory
Returns:
the Iterator

iterateFactHandles

public Iterator<?> iterateFactHandles()
Description copied from interface: WorkingMemory
Returns an Iterator for the FactHandles in the Working Memory. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.

Specified by:
iterateFactHandles in interface WorkingMemory
Returns:
the Iterator

iterateFactHandles

public Iterator<?> iterateFactHandles(org.drools.runtime.ObjectFilter filter)
Description copied from interface: WorkingMemory
Returns an Iterator for the Objects in the Working Memory. This Iterator will filter out any objects that the ObjectFilter does not accept. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.

Specified by:
iterateFactHandles in interface WorkingMemory
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 interface WorkingMemory

getQueryResults

public QueryResults getQueryResults(String query,
                                    Object... arguments)
Description copied from interface: WorkingMemory
Retrieve the QueryResults of the specified query and arguments

Specified by:
getQueryResults in interface WorkingMemory
Parameters:
query - 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.

setAsyncExceptionHandler

public void setAsyncExceptionHandler(AsyncExceptionHandler handler)
Description copied from interface: WorkingMemory
Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules.

Specified by:
setAsyncExceptionHandler in interface WorkingMemory

clearAgenda

public void clearAgenda()
Description copied from interface: WorkingMemory
Clear the Agenda. Iterates over each AgendaGroup cancalling all Activations.

Specified by:
clearAgenda in interface WorkingMemory

clearAgendaGroup

public void clearAgendaGroup(String group)
Description copied from interface: WorkingMemory
Clear the Agenda Group, cancelling all its Activations.

Specified by:
clearAgendaGroup in interface WorkingMemory

clearActivationGroup

public void clearActivationGroup(String group)
Description copied from interface: WorkingMemory
Clears the Activation Group, cancellings all its Activations

Specified by:
clearActivationGroup in interface WorkingMemory

clearRuleFlowGroup

public void clearRuleFlowGroup(String group)
Description copied from interface: WorkingMemory
Clears the RuleFlow group, cancelling all its Activations

Specified by:
clearRuleFlowGroup in interface WorkingMemory

startProcess

public org.drools.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 interface WorkingMemory

startProcess

public org.drools.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 interface WorkingMemory

getProcessInstances

public Collection<org.drools.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 interface WorkingMemory
Returns:
the list of process instances

getProcessInstance

public org.drools.runtime.process.ProcessInstance getProcessInstance(long id)
Description copied from interface: WorkingMemory
Returns the process instance with the given id.

Specified by:
getProcessInstance in interface WorkingMemory
Returns:
the process instance with the given id

getWorkItemManager

public org.drools.runtime.process.WorkItemManager getWorkItemManager()
Specified by:
getWorkItemManager in interface WorkingMemory

halt

public void halt()
Description copied from interface: WorkingMemory
Stops rule firing after the current rule finishes executing

Specified by:
halt in interface WorkingMemory

getWorkingMemoryEntryPoint

public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String id)
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 interface WorkingMemory
Parameters:
id - the id of the entry point, as defined in the rules file

getSessionClock

public org.drools.time.SessionClock getSessionClock()
Description copied from interface: WorkingMemory
Returns the session clock instance associated with this session

Specified by:
getSessionClock in interface WorkingMemory
Returns:

addEventListener

public void addEventListener(WorkingMemoryEventListener listener)
Description copied from interface: WorkingMemoryEventManager
Add an event listener.

Specified by:
addEventListener in interface WorkingMemoryEventManager
Parameters:
listener - The listener to add.

removeEventListener

public void removeEventListener(WorkingMemoryEventListener listener)
Description copied from interface: WorkingMemoryEventManager
Remove an event listener.

Specified by:
removeEventListener in interface WorkingMemoryEventManager
Parameters:
listener - The listener to remove.

getWorkingMemoryEventListeners

public List getWorkingMemoryEventListeners()
Description copied from interface: WorkingMemoryEventManager
Returns all event listeners.

Specified by:
getWorkingMemoryEventListeners in interface EventSupport
Specified by:
getWorkingMemoryEventListeners in interface WorkingMemoryEventManager
Returns:
listeners The listeners.

addEventListener

public void addEventListener(AgendaEventListener listener)
Description copied from interface: WorkingMemoryEventManager
Add an event listener.

Specified by:
addEventListener in interface WorkingMemoryEventManager
Parameters:
listener - The listener to add.

removeEventListener

public void removeEventListener(AgendaEventListener listener)
Description copied from interface: WorkingMemoryEventManager
Remove an event listener.

Specified by:
removeEventListener in interface WorkingMemoryEventManager
Parameters:
listener - The listener to remove.

getAgendaEventListeners

public List getAgendaEventListeners()
Description copied from interface: WorkingMemoryEventManager
Returns all event listeners.

Specified by:
getAgendaEventListeners in interface EventSupport
Specified by:
getAgendaEventListeners in interface WorkingMemoryEventManager
Returns:
listeners The listeners.

addEventListener

public void addEventListener(RuleBaseEventListener listener)
Description copied from interface: RuleBaseEventManager
Add an event listener.

Specified by:
addEventListener in interface RuleBaseEventManager
Parameters:
listener - The listener to add.

removeEventListener

public void removeEventListener(RuleBaseEventListener listener)
Description copied from interface: RuleBaseEventManager
Remove an event listener.

Specified by:
removeEventListener in interface RuleBaseEventManager
Parameters:
listener - The listener to remove.

getRuleBaseEventListeners

public List<RuleBaseEventListener> getRuleBaseEventListeners()
Description copied from interface: RuleBaseEventManager
Returns all event listeners.

Specified by:
getRuleBaseEventListeners in interface RuleBaseEventManager
Returns:
listeners The listeners.

insert

public FactHandle insert(Object object)
                  throws FactException
Description copied from interface: WorkingMemoryEntryPoint
Assert a fact.

Specified by:
insert in interface org.drools.runtime.rule.WorkingMemoryEntryPoint
Parameters:
object - The fact object.
Returns:
The new fact-handle associated with the object.
Throws:
FactException - If a RuntimeException error occurs.

insert

public FactHandle insert(Object object,
                         boolean dynamic)
                  throws FactException
Description copied from interface: WorkingMemoryEntryPoint
Insert a fact registering JavaBean PropertyChangeListeners on the Object to automatically trigger update calls if dynamic is true.

Parameters:
object - The fact object.
dynamic - true if Drools should add JavaBean PropertyChangeListeners to the object.
Returns:
The new fact-handle associated with the object.
Throws:
FactException - If a RuntimeException error occurs.

retract

public void retract(org.drools.runtime.rule.FactHandle handle)
             throws FactException
Description copied from interface: WorkingMemoryEntryPoint
Retract a fact.

Specified by:
retract in interface org.drools.runtime.rule.WorkingMemoryEntryPoint
Parameters:
handle - The fact-handle associated with the fact to retract.
Throws:
FactException - If a RuntimeException error occurs.

update

public void update(org.drools.runtime.rule.FactHandle handle,
                   Object object)
            throws FactException
Description copied from interface: WorkingMemoryEntryPoint
Inform the WorkingMemory that a Fact has been modified and that it should now update the network.

Specified by:
update in interface org.drools.runtime.rule.WorkingMemoryEntryPoint
Parameters:
handle - The fact-handle associated with the fact to modify.
object - The new value of the fact.
Throws:
FactException - If a RuntimeException error occurs.

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.


getEntryPointId

public String getEntryPointId()
Specified by:
getEntryPointId in interface org.drools.runtime.rule.WorkingMemoryEntryPoint

getObjects

public Collection<Object> getObjects()
Specified by:
getObjects in interface org.drools.runtime.rule.WorkingMemoryEntryPoint

getObjects

public Collection<Object> getObjects(org.drools.runtime.ObjectFilter filter)
Specified by:
getObjects in interface org.drools.runtime.rule.WorkingMemoryEntryPoint

getFactHandles

public <T extends org.drools.runtime.rule.FactHandle> Collection<T> getFactHandles()
Specified by:
getFactHandles in interface org.drools.runtime.rule.WorkingMemoryEntryPoint

getFactHandles

public <T extends org.drools.runtime.rule.FactHandle> Collection<T> getFactHandles(org.drools.runtime.ObjectFilter filter)
Specified by:
getFactHandles in interface org.drools.runtime.rule.WorkingMemoryEntryPoint

getFactCount

public long getFactCount()
Specified by:
getFactCount in interface org.drools.runtime.rule.WorkingMemoryEntryPoint

update

public void update(org.drools.runtime.rule.FactHandle handle,
                   Object object,
                   long mask,
                   Activation activation)
            throws FactException
Throws:
FactException

getInternalWorkingMemory

public InternalWorkingMemory getInternalWorkingMemory()
Specified by:
getInternalWorkingMemory in interface InternalWorkingMemoryEntryPoint

reset

public void reset()
Specified by:
reset in interface InternalWorkingMemoryEntryPoint

getAgendaEventSupport

public AgendaEventSupport getAgendaEventSupport()
Specified by:
getAgendaEventSupport in interface EventSupport

getWorkingMemoryEventSupport

public WorkingMemoryEventSupport getWorkingMemoryEventSupport()
Specified by:
getWorkingMemoryEventSupport in interface EventSupport

addEventListener

public void addEventListener(org.drools.event.process.ProcessEventListener listener)
Specified by:
addEventListener in interface org.drools.event.process.ProcessEventManager

removeEventListener

public void removeEventListener(org.drools.event.process.ProcessEventListener listener)
Specified by:
removeEventListener in interface org.drools.event.process.ProcessEventManager

getProcessEventListeners

public Collection<org.drools.event.process.ProcessEventListener> getProcessEventListeners()
Specified by:
getProcessEventListeners in interface org.drools.event.process.ProcessEventManager

getWorkingMemoryEntryPoints

public Collection<? extends org.drools.runtime.rule.WorkingMemoryEntryPoint> getWorkingMemoryEntryPoints()
Specified by:
getWorkingMemoryEntryPoints in interface ReteooWorkingMemoryInterface

fireUntilHalt

public void fireUntilHalt()
Specified by:
fireUntilHalt in interface ReteooWorkingMemoryInterface

fireUntilHalt

public void fireUntilHalt(AgendaFilter agendaFilterWrapper)
Specified by:
fireUntilHalt in interface ReteooWorkingMemoryInterface

createProcessInstance

public org.drools.runtime.process.ProcessInstance createProcessInstance(String processId,
                                                                        Map<String,Object> parameters)
Specified by:
createProcessInstance in interface ReteooWorkingMemoryInterface

startProcessInstance

public org.drools.runtime.process.ProcessInstance startProcessInstance(long processInstanceId)
Specified by:
startProcessInstance in interface ReteooWorkingMemoryInterface

registerExitPoint

public void registerExitPoint(String name,
                              org.drools.runtime.ExitPoint exitPoint)
Specified by:
registerExitPoint in interface ReteooWorkingMemoryInterface

unregisterExitPoint

public void unregisterExitPoint(String name)
Specified by:
unregisterExitPoint in interface ReteooWorkingMemoryInterface

registerChannel

public void registerChannel(String name,
                            org.drools.runtime.Channel channel)
Specified by:
registerChannel in interface ReteooWorkingMemoryInterface

unregisterChannel

public void unregisterChannel(String name)
Specified by:
unregisterChannel in interface ReteooWorkingMemoryInterface

getActionQueue

public Queue<WorkingMemoryAction> getActionQueue()
Specified by:
getActionQueue in interface ReteooWorkingMemoryInterface

openLiveQuery

public org.drools.runtime.rule.LiveQuery openLiveQuery(String query,
                                                       Object[] arguments,
                                                       org.drools.runtime.rule.ViewChangedEventListener listener)
Specified by:
openLiveQuery in interface ReteooWorkingMemoryInterface

setEndOperationListener

public void setEndOperationListener(EndOperationListener listener)
Specified by:
setEndOperationListener in interface ReteooWorkingMemoryInterface

getLastIdleTimestamp

public long getLastIdleTimestamp()
Specified by:
getLastIdleTimestamp in interface ReteooWorkingMemoryInterface

update

public void update(FactHandle handle,
                   Object object,
                   Rule rule,
                   Activation activation)
            throws FactException
Specified by:
update in interface InternalWorkingMemoryActions
Throws:
FactException

update

public void update(org.drools.runtime.rule.FactHandle handle,
                   Object object,
                   Rule rule,
                   Activation activation)
            throws FactException
Specified by:
update in interface InternalWorkingMemoryEntryPoint
Throws:
FactException


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.