org.drools
Class TransactionalWorkingMemory

java.lang.Object
  |
  +--org.drools.WorkingMemory
        |
        +--org.drools.TransactionalWorkingMemory

public class TransactionalWorkingMemory
extends WorkingMemory

A transactional knowledge session for a RuleBase.

A WorkingMemory which caches all assertion, retractions and modifications, and only performs the fact propagation and rule action invokation upon commit().

Author:
bob mcwhirter, Tom Vasak
See Also:
WorkingMemory, RuleBase

Constructor Summary
TransactionalWorkingMemory(RuleBase ruleBase)
          Construct.
 
Method Summary
 void abort()
          Abort this TransactionalWorkingMemory, by tossing out all asserted objects, and reseting this TransactionalWorkingMemory to a clean state.
 void assertObject(java.lang.Object object)
          Assert a new fact object into this working memory.
 void commit()
          Commit all asserted objects into the logic engine, and reset this TransactionalWorkingMemory to a clean state.
 void modifyObject(java.lang.Object object)
          Modify a fact object in this working memory.
 void retractObject(java.lang.Object object)
          Retract a fact object from this working memory.
 
Methods inherited from class org.drools.WorkingMemory
getAgenda, getJoinMemory, getRuleBase, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransactionalWorkingMemory

public TransactionalWorkingMemory(RuleBase ruleBase)
Construct.

Parameters:
ruleBase - The RuleBase for this WorkingMemory.
Method Detail

abort

public void abort()
Abort this TransactionalWorkingMemory, by tossing out all asserted objects, and reseting this TransactionalWorkingMemory to a clean state.


commit

public void commit()
            throws DroolsException
Commit all asserted objects into the logic engine, and reset this TransactionalWorkingMemory to a clean state.

Throws:
DroolsException - If an

assertObject

public void assertObject(java.lang.Object object)
                  throws AssertionException
Assert a new fact object into this working memory.

Overrides:
assertObject in class WorkingMemory
Parameters:
object - The object to assert.
Throws:
AssertionException - if an error occurs during assertion.

modifyObject

public void modifyObject(java.lang.Object object)
                  throws FactException
Modify a fact object in this working memory. With the exception of time-based nodes, modification of a fact object is semantically equivelent to retracting and re-asserting it.

Overrides:
modifyObject in class WorkingMemory
Parameters:
object - The object to modify.
Throws:
FactException - if an error occurs during modification.

retractObject

public void retractObject(java.lang.Object object)
                   throws RetractionException
Retract a fact object from this working memory.

Overrides:
retractObject in class WorkingMemory
Parameters:
object - The object to retract.
Throws:
RetractionException - if an error occurs during retraction.


Copyright © 2001-2003 The Werken Company. All Rights Reserved.