站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 4.0.0.11754MR2 API 英文版文档

WorkingMemory (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 API 英文版文档


org.drools
Interface WorkingMemory

All Superinterfaces:
Serializable
All Known Subinterfaces:
InternalWorkingMemory, InternalWorkingMemoryActions, StatefulSession
All Known Implementing Classes:
AbstractWorkingMemory, ReteooStatefulSession, ReteooWorkingMemory

public interface WorkingMemory
extends Serializable

A knowledge session for a RuleBase. While this object can be serialised out, it cannot be serialised in. This is because the RuleBase reference is transient. Please see the RuleBase interface for serializing in WorkingMemories from an InputStream.

Author:
bob mcwhirter

Method Summary
 void addEventListener(AgendaEventListener listener)
          Add an event listener.
 void addEventListener(WorkingMemoryEventListener listener)
          Add an event listener.
 FactHandle assertObject(Object object)
          Assert a fact.
 FactHandle assertObject(Object object, boolean dynamic)
          Assert a fact registering JavaBean PropertyChangeListeners on the Object to automatically trigger modifyObject calls if dynamic is true.
 void clearAgenda()
          Clear the Agenda
 void clearAgendaGroup(String group)
          Clear the Agenda Group
 void fireAllRules()
          Fire all items on the agenda until empty.
 void fireAllRules(AgendaFilter agendaFilter)
          Fire all items on the agenda until empty, using the given AgendaFiler
 Agenda getAgenda()
           
 List getAgendaEventListeners()
          Returns all event listeners.
 FactHandle getFactHandle(Object object)
          Retrieve the FactHandle associated with an Object.
 AgendaGroup getFocus()
           
 Object getGlobal(String name)
          Retrieve a specific piece of global data by name
 Map getGlobals()
          Retrieve all of the set application data in this memory
 Object getObject(FactHandle handle)
          Retrieve the object associated with a FactHandle.
 QueryResults getQueryResults(String query)
          Retrieve the QueryResults of the specified query.
 RuleBase getRuleBase()
          Retrieve the RuleBase of this working memory.
 List getWorkingMemoryEventListeners()
          Returns all event listeners.
 Iterator iterateFactHandles()
           
 Iterator iterateFactHandles(ObjectFilter filter)
           
 Iterator iterateObjects()
           
 Iterator iterateObjects(ObjectFilter filter)
           
 void modifyObject(FactHandle handle, Object object)
          Modify a fact.
 void removeEventListener(AgendaEventListener listener)
          Remove an event listener.
 void removeEventListener(WorkingMemoryEventListener listener)
          Remove an event listener.
 void retractObject(FactHandle handle)
          Retract a fact.
 void setAsyncExceptionHandler(AsyncExceptionHandler handler)
          Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules.
 void setFocus(AgendaGroup focus)
           
 void setFocus(String focus)
           
 void setGlobal(String name, Object value)
          Set a specific piece of global in this working memory.
 void setGlobalResolver(GlobalResolver globalResolver)
          Delegate used to resolve any global names not found in the global map.
 IProcessInstance startProcess(String processId)
          Starts a new process instance for the process with the given id.
 

Method Detail

addEventListener

void addEventListener(WorkingMemoryEventListener listener)
Add an event listener.

Parameters:
listener - The listener to add.

removeEventListener

void removeEventListener(WorkingMemoryEventListener listener)
Remove an event listener.

Parameters:
listener - The listener to remove.

getWorkingMemoryEventListeners

List getWorkingMemoryEventListeners()
Returns all event listeners.

Returns:
listeners The listeners.

addEventListener

void addEventListener(AgendaEventListener listener)
Add an event listener.

Parameters:
listener - The listener to add.

removeEventListener

void removeEventListener(AgendaEventListener listener)
Remove an event listener.

Parameters:
listener - The listener to remove.

getAgendaEventListeners

List getAgendaEventListeners()
Returns all event listeners.

Returns:
listeners The listeners.

getAgenda

Agenda getAgenda()

getGlobals

Map getGlobals()
Retrieve all of the set application data in this memory

Returns:
the application data as a Map

setGlobal

void setGlobal(String name,
               Object value)
Set a specific piece of global in this working memory. Null values will return doing nothign

Parameters:
name - the name under which to populate the data
value - the global value, cannot be null

getGlobal

Object getGlobal(String name)
Retrieve a specific piece of global data by name

Returns:
application data or null if nothing is set under this name

setGlobalResolver

void setGlobalResolver(GlobalResolver globalResolver)
Delegate used to resolve any global names not found in the global map.

Parameters:
globalResolver -

getRuleBase

RuleBase getRuleBase()
Retrieve the RuleBase of this working memory.

Returns:
The RuleBase.

fireAllRules

void fireAllRules()
                  throws FactException
Fire all items on the agenda until empty.

Throws:
FactException - If an error occurs.

fireAllRules

void fireAllRules(AgendaFilter agendaFilter)
                  throws FactException
Fire all items on the agenda until empty, using the given AgendaFiler

Throws:
FactException - If an error occurs.

getObject

Object getObject(FactHandle handle)
                 throws NoSuchFactObjectException
Retrieve the object associated with a FactHandle.

Parameters:
handle - The fact handle.
Returns:
The associated object.
Throws:
NoSuchFactObjectException - If no object is known to be associated with the specified handle.
See Also:
#containsObject

getFactHandle

FactHandle getFactHandle(Object object)
                         throws NoSuchFactHandleException
Retrieve the FactHandle associated with an Object.

Parameters:
object - The object.
Returns:
The associated fact handle.
Throws:
NoSuchFactHandleException - If no handle is known to be associated with the specified object.
See Also:
#containsObject

iterateObjects

Iterator iterateObjects()

iterateObjects

Iterator iterateObjects(ObjectFilter filter)

iterateFactHandles

Iterator iterateFactHandles()

iterateFactHandles

Iterator iterateFactHandles(ObjectFilter filter)

getFocus

AgendaGroup getFocus()

setFocus

void setFocus(String focus)

setFocus

void setFocus(AgendaGroup focus)

assertObject

FactHandle assertObject(Object object)
                        throws FactException
Assert a fact.

Parameters:
object - The fact object.
Returns:
The new fact-handle associated with the object.
Throws:
FactException - If an error occurs.

getQueryResults

QueryResults getQueryResults(String query)
Retrieve the QueryResults of the specified query.

Parameters:
query - The name of the query.
Returns:
The QueryResults of the specified query. If no results match the query it is empty.
Throws:
IllegalArgumentException - if no query named "query" is found in the rulebase

assertObject

FactHandle assertObject(Object object,
                        boolean dynamic)
                        throws FactException
Assert a fact registering JavaBean PropertyChangeListeners on the Object to automatically trigger modifyObject 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 an error occurs.

retractObject

void retractObject(FactHandle handle)
                   throws FactException
Retract a fact.

Parameters:
handle - The fact-handle associated with the fact to retract.
Throws:
FactException - If an error occurs.

modifyObject

void modifyObject(FactHandle handle,
                  Object object)
                  throws FactException
Modify a fact.

Parameters:
handle - The fact-handle associated with the fact to modify.
object - The new value of the fact.
Throws:
FactException - If an error occurs.

setAsyncExceptionHandler

void setAsyncExceptionHandler(AsyncExceptionHandler handler)
Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules.

Parameters:
handler -

clearAgenda

void clearAgenda()
Clear the Agenda


clearAgendaGroup

void clearAgendaGroup(String group)
Clear the Agenda Group


startProcess

IProcessInstance startProcess(String processId)
Starts a new process instance for the process with the given id.



Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.