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

SynchronizedWorkingMemory - JBoss RULES 3.0.6 API 英文版文档


org.drools
Class SynchronizedWorkingMemory

java.lang.Object
  extended by org.drools.SynchronizedWorkingMemory
All Implemented Interfaces:
java.io.Serializable, WorkingMemory

public class SynchronizedWorkingMemory
extends java.lang.Object
implements WorkingMemory

Each implemented method of the WorkingMemory interface is synchronised. This class simply delegates each method call to the underlying unsynchronized WorkingMemoryImpl. WorkingMemory workingMemory = new SynchronizedWorkingMemory( ruleBase.newWorkingMemory( ) );

See Also:
Serialized Form

Constructor Summary
SynchronizedWorkingMemory(WorkingMemory workingMemory)
           
 
Method Summary
 void addEventListener(AgendaEventListener listener)
          Add an event listener.
 void addEventListener(WorkingMemoryEventListener listener)
          Add an event listener.
 FactHandle assertObject(java.lang.Object object)
          Assert a fact.
 FactHandle assertObject(java.lang.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(java.lang.String group)
          Clear the Agenda Group
 void dispose()
          Forces the workingMemory to be derefenced from
 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()
           
 java.util.List getAgendaEventListeners()
          Returns all event listeners.
 FactHandle getFactHandle(java.lang.Object object)
          Retrieve the FactHandle associated with an Object.
 java.util.List getFactHandles()
          Retrieve all known Fact Handles.
 AgendaGroup getFocus()
           
 java.lang.Object getGlobal(java.lang.String name)
          Retrieve a specific piece of global data by name
 java.util.Map getGlobals()
          Retrieve all of the set application data in this memory
 java.lang.Object getObject(FactHandle handle)
          Retrieve the object associated with a FactHandle.
 java.util.List getObjects()
          Retrieve all known objects.
 java.util.List getObjects(java.lang.Class objectClass)
          Retrieve all known objects of the specified class.
 QueryResults getQueryResults(java.lang.String query)
          Retrieve the QueryResults of the specified query.
 RuleBase getRuleBase()
          Retrieve the RuleBase of this working memory.
 java.util.List getWorkingMemoryEventListeners()
          Returns all event listeners.
 void modifyObject(FactHandle handle, java.lang.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(java.lang.String focus)
           
 void setGlobal(java.lang.String name, java.lang.Object value)
          Set a specific piece of global in this working memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedWorkingMemory

public SynchronizedWorkingMemory(WorkingMemory workingMemory)
Method Detail

addEventListener

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

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

assertObject

public FactHandle assertObject(java.lang.Object object,
                               boolean dynamic)
                        throws FactException
Description copied from interface: WorkingMemory
Assert a fact registering JavaBean PropertyChangeListeners on the Object to automatically trigger modifyObject calls if dynamic is true.

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

assertObject

public FactHandle assertObject(java.lang.Object object)
                        throws FactException
Description copied from interface: WorkingMemory
Assert a fact.

Specified by:
assertObject in interface WorkingMemory
Parameters:
object - The fact object.
Returns:
The new fact-handle associated with the object.
Throws:
FactException - If an error occurs.

clearAgenda

public void clearAgenda()
Description copied from interface: WorkingMemory
Clear the Agenda

Specified by:
clearAgenda in interface WorkingMemory

clearAgendaGroup

public void clearAgendaGroup(java.lang.String group)
Description copied from interface: WorkingMemory
Clear the Agenda Group

Specified by:
clearAgendaGroup in interface WorkingMemory

fireAllRules

public void 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 an error occurs.

fireAllRules

public void 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 an error occurs.

getFactHandle

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

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

getFactHandles

public java.util.List getFactHandles()
Description copied from interface: WorkingMemory
Retrieve all known Fact Handles.

Specified by:
getFactHandles in interface WorkingMemory
Returns:
The list of all known fact handles.

getObject

public java.lang.Object getObject(FactHandle handle)
                           throws NoSuchFactObjectException
Description copied from interface: WorkingMemory
Retrieve the object associated with a FactHandle.

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

getObjects

public java.util.List getObjects()
Description copied from interface: WorkingMemory
Retrieve all known objects.

Specified by:
getObjects in interface WorkingMemory
Returns:
The list of all known objects.

getObjects

public java.util.List getObjects(java.lang.Class objectClass)
Description copied from interface: WorkingMemory
Retrieve all known objects of the specified class.

Specified by:
getObjects in interface WorkingMemory
Parameters:
objectClass - The class of object to return.
Returns:
The list of all known objects of the specified class.

getRuleBase

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

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

modifyObject

public void modifyObject(FactHandle handle,
                         java.lang.Object object)
                  throws FactException
Description copied from interface: WorkingMemory
Modify a fact.

Specified by:
modifyObject in interface WorkingMemory
Parameters:
handle - The fact-handle associated with the fact to modify.
object - The new value of the fact.
Throws:
FactException - If an error occurs.

removeEventListener

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

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

retractObject

public void retractObject(FactHandle handle)
                   throws FactException
Description copied from interface: WorkingMemory
Retract a fact.

Specified by:
retractObject in interface WorkingMemory
Parameters:
handle - The fact-handle associated with the fact to retract.
Throws:
FactException - If an error occurs.

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

addEventListener

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

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

dispose

public void dispose()
Description copied from interface: WorkingMemory
Forces the workingMemory to be derefenced from

Specified by:
dispose in interface WorkingMemory

getAgenda

public Agenda getAgenda()
Specified by:
getAgenda in interface WorkingMemory

getAgendaEventListeners

public java.util.List getAgendaEventListeners()
Description copied from interface: WorkingMemory
Returns all event listeners.

Specified by:
getAgendaEventListeners in interface WorkingMemory
Returns:
listeners The listeners.

getFocus

public AgendaGroup getFocus()
Specified by:
getFocus in interface WorkingMemory

getGlobal

public java.lang.Object getGlobal(java.lang.String name)
Description copied from interface: WorkingMemory
Retrieve a specific piece of global data by name

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

getGlobals

public java.util.Map getGlobals()
Description copied from interface: WorkingMemory
Retrieve all of the set application data in this memory

Specified by:
getGlobals in interface WorkingMemory
Returns:
the application data as a Map

getQueryResults

public QueryResults getQueryResults(java.lang.String query)
Description copied from interface: WorkingMemory
Retrieve the QueryResults of the specified query.

Specified by:
getQueryResults in interface WorkingMemory
Parameters:
query - The name of the query.
Returns:
The QueryResults of the specified query. If no results match the query it is empty.

getWorkingMemoryEventListeners

public java.util.List getWorkingMemoryEventListeners()
Description copied from interface: WorkingMemory
Returns all event listeners.

Specified by:
getWorkingMemoryEventListeners in interface WorkingMemory
Returns:
listeners The listeners.

removeEventListener

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

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

setFocus

public void setFocus(java.lang.String focus)
Specified by:
setFocus in interface WorkingMemory

setFocus

public void setFocus(AgendaGroup focus)
Specified by:
setFocus in interface WorkingMemory

setGlobal

public void setGlobal(java.lang.String name,
                      java.lang.Object value)
Description copied from interface: WorkingMemory
Set a specific piece of global in this working memory.

Specified by:
setGlobal in interface WorkingMemory
Parameters:
name - the name under which to populate the data
value - the application data