|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.drools.jsr94.rules.AbstractRuleSessionImpl
org.drools.jsr94.rules.StatefulRuleSessionImpl
public class StatefulRuleSessionImpl
The Drools implementation of the StatefulRuleSession
interface
which is a representation of a stateful rules engine session. A stateful
rules engine session exposes a stateful rule execution API to an underlying
rules engine. The session allows arbitrary objects to be added and removed
to and from the rule session state. Additionally, objects currently part of
the rule session state may be updated.
RuleExecutionSet
as
well as the rule engine vendor's specific rule engine behavior.
Handle
instances are used by the rule engine vendor to track
Object
s added to the rule session state. This allows multiple
instances of equivalent Object
s to be added to the session state
and identified, even after serialization.
StatefulRuleSession
,
Serialized FormConstructor Summary | |
---|---|
StatefulRuleSessionImpl(String bindUri,
Map properties)
Gets the RuleExecutionSet for this URI and associates it
with a RuleBase. |
Method Summary | |
---|---|
Handle |
addObject(Object object)
Adds a given object to the rule session state of this rule session. |
List |
addObjects(List objList)
Adds a List of Object s to the rule session
state of this rule session. |
boolean |
containsObject(Handle objectHandle)
Returns true if the given object is contained
within rulesession state of this rule session. |
void |
executeRules()
Executes the rules in the bound rule execution set using the objects present in the rule session state. |
List |
getHandles()
Returns a List of the Handle s
being used for object identity. |
Object |
getObject(Handle handle)
|
List |
getObjects()
Returns a List of all objects in the rule session state of this rule session. |
List |
getObjects(ObjectFilter filter)
Returns a List over the objects in rule session state of
this rule session. |
void |
removeObject(Handle handleObject)
Removes a given object from the rule session state of this rule session. |
void |
updateObject(Handle objectHandle,
Object newObject)
Notifies the rules engine that a given object in the rule session state has changed. |
Methods inherited from class org.drools.jsr94.rules.AbstractRuleSessionImpl |
---|
applyFilter, checkRuleSessionValidity, getProperties, getRuleExecutionSet, getRuleExecutionSetMetadata, getType, getWorkingMemory, initWorkingMemory, newWorkingMemory, release, reset, setProperties, setRuleExecutionSet, setWorkingMemory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.rules.StatefulRuleSession |
---|
reset |
Methods inherited from interface javax.rules.RuleSession |
---|
getRuleExecutionSetMetadata, getType, release |
Constructor Detail |
---|
StatefulRuleSessionImpl(String bindUri, Map properties) throws RuleExecutionSetNotFoundException
RuleExecutionSet
for this URI and associates it
with a RuleBase.
bindUri
- the URI the RuleExecutionSet
has been bound
toproperties
- additional properties used to create the
RuleSession
implementation.
RuleExecutionSetNotFoundException
- if there is no rule set under
the given URIMethod Detail |
---|
public boolean containsObject(Handle objectHandle)
true
if the given object is contained
within rulesession state of this rule session.
containsObject
in interface StatefulRuleSession
objectHandle
- the handle to the target object.
true
if the given object is contained
within the rule session state of this rule session.public Handle addObject(Object object) throws InvalidRuleSessionException
RuleSession
is Serializable
and it contains
non-serializable fields a runtime exception will be thrown.
addObject
in interface StatefulRuleSession
object
- the object to be added.
InvalidRuleSessionException
- on illegal rule session state.public List addObjects(List objList) throws InvalidRuleSessionException
List
of Object
s to the rule session
state of this rule session.
addObjects
in interface StatefulRuleSession
objList
- the objects to be added.
List
of Handle
s, one for each added
Object
. The List
must be ordered in
the same order as the input objList
.
InvalidRuleSessionException
- on illegal rule session state.public void updateObject(Handle objectHandle, Object newObject) throws InvalidRuleSessionException, InvalidHandleException
removeObject
followed by addObject
. The
original Handle
is rebound to the new value for the
Object
however.
updateObject
in interface StatefulRuleSession
objectHandle
- the handle to the original object.newObject
- the new object to bind to the handle.
InvalidRuleSessionException
- on illegal rule session state.
InvalidHandleException
- if the input Handle
is no longer validpublic void removeObject(Handle handleObject) throws InvalidRuleSessionException, InvalidHandleException
removeObject
in interface StatefulRuleSession
handleObject
- the handle to the object to be removed
from the rule session state.
InvalidRuleSessionException
- on illegal rule session state.
InvalidHandleException
- if the input Handle
is no longer validpublic List getObjects() throws InvalidRuleSessionException
RuleExecutionSet
filter (if present).
This may not neccessarily include all objects added by calls to
addObject
, and may include Object
s created by
side-effects. The execution of a RuleExecutionSet
can add,
remove and update objects as part of the rule session state. Therefore
the rule session state is dependent on the rules that are part of the
executed RuleExecutionSet
as well as the rule vendor's
specific rule engine behavior.
getObjects
in interface StatefulRuleSession
List
of all objects part of the rule session state.
InvalidRuleSessionException
- on illegal rule session state.public List getObjects(ObjectFilter filter) throws InvalidRuleSessionException
List
over the objects in rule session state of
this rule session. The objects should pass the filter test on the
specified ObjectFilter
.
This may not neccessarily include all objects added by calls to
addObject
, and may include Object
s created by
side-effects. The execution of a RuleExecutionSet
can add,
remove and update objects as part of the rule session state. Therefore
the rule session state is dependent on the rules that are part of the
executed RuleExecutionSet
as well as the rule vendor's
specific rule engine behavior.
getObjects
in interface StatefulRuleSession
filter
- the object filter.
List
of all the objects in the rule session state
of this rule session based upon the given object filter.
InvalidRuleSessionException
- on illegal rule session state.public void executeRules() throws InvalidRuleSessionException
Object
s bound
to Handle
s.
executeRules
in interface StatefulRuleSession
InvalidRuleSessionException
- on illegal rule session state.public Object getObject(Handle handle) throws InvalidRuleSessionException, InvalidHandleException
getObject
in interface StatefulRuleSession
InvalidRuleSessionException
InvalidHandleException
StatefulRuleSessionImpl
public List getHandles()
List
of the Handle
s
being used for object identity.
getHandles
in interface StatefulRuleSession
List
of Handle
s present
in the currect state of the rule session.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |