|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.drools.jsr94.rules.RuleSessionImpl
org.drools.jsr94.rules.StatelessRuleSessionImpl
The Drools implementation of the StatelessRuleSession
interface
which is a representation of a stateless rules engine session. A stateless
rules engine session exposes a stateless rule execution API to an underlying
rules engine.
StatelessRuleSession
Constructor Summary | |
(package private) |
StatelessRuleSessionImpl(String bindUri,
Map properties)
Gets the RuleExecutionSet for this URI and associates it
with a RuleBase. |
Method Summary | |
protected void |
applyFilter(List objects,
ObjectFilter objectFilter)
Applies the given ObjectFilter to the List of
Object s, removing all Object s from the given
List that do not pass the filter. |
protected void |
checkRuleSessionValidity()
Ensures this RuleSession is not
in an illegal rule session state. |
List |
executeRules(List objects)
Executes the rules in the bound rule execution set using the supplied list of objects. |
List |
executeRules(List objects,
ObjectFilter filter)
Executes the rules in the bound rule execution set using the supplied list of objects. |
protected Map |
getProperties()
Returns the additional properties used to create this RuleSession . |
protected RuleExecutionSetImpl |
getRuleExecutionSet()
Returns the Drools RuleExecutionSet associated
with this RuleSession . |
RuleExecutionSetMetadata |
getRuleExecutionSetMetadata()
Returns the meta data for the rule execution set bound to this rule session. |
int |
getType()
Returns the type identifier for this RuleSession . |
protected WorkingMemory |
getWorkingMemory()
Returns the Drools WorkingMemory associated
with this RuleSession . |
protected void |
initWorkingMemory()
Initialize this RuleSession
with a new WorkingMemory . |
protected WorkingMemory |
newWorkingMemory()
Creates a new WorkingMemory for this
RuleSession . |
void |
release()
Releases all resources used by this rule session. |
void |
reset()
Resets this rule session. |
protected void |
setProperties(Map properties)
Sets additional properties used to create this RuleSession . |
protected void |
setRuleExecutionSet(RuleExecutionSetImpl ruleSet)
Sets the Drools RuleExecutionSet associated
with this RuleSession . |
protected void |
setWorkingMemory(WorkingMemory workingMemory)
Sets the Drools WorkingMemory associated
with this RuleSession . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.rules.RuleSession |
getRuleExecutionSetMetadata, getType, release |
Constructor Detail |
StatelessRuleSessionImpl(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 List executeRules(List objects) throws InvalidRuleSessionException
List
is returned containing the objects
created by (or passed into the rule session) the executed rules that
pass the filter test of the default RuleExecutionSet
ObjectFilter
(if present).
The returned list may not neccessarily include all objects passed, and
may include Object
s created by side-effects. The execution
of a RuleExecutionSet
can add, remove and update objects.
Therefore the returned object list is dependent on the rules that are
part of the executed RuleExecutionSet
as well as Drools
specific rule engine behavior.
executeRules
in interface StatelessRuleSession
objects
- the objects used to execute rules.
List
containing the objects
as a result of executing the rules.
InvalidRuleSessionException
- on illegal rule session state.public List executeRules(List objects, ObjectFilter filter) throws InvalidRuleSessionException
List
is returned containing the objects
created by (or passed into the rule engine) the executed rules and
filtered with the supplied object filter.
The returned list may not neccessarily include all objects passed, and
may include Object
s created by side-effects. The execution
of a RuleExecutionSet
can add, remove and update objects.
Therefore the returned object list is dependent on the rules that are
part of the executed RuleExecutionSet
as well as Drools
specific rule engine behavior.
executeRules
in interface StatelessRuleSession
objects
- the objects used to execute rules.filter
- the object filter.
List
containing the objects as a result
of executing rules, after passing through the supplied
object filter.
InvalidRuleSessionException
- on illegal rule session state.protected void initWorkingMemory()
RuleSession
with a new WorkingMemory
.
RuleSessionImpl.newWorkingMemory()
protected WorkingMemory newWorkingMemory()
WorkingMemory
for this
RuleSession
. All properties set prior to calling this method
are added as application data to the new WorkingMemory
.
The created WorkingMemory
uses the default conflict
resolution strategy.
WorkingMemory
.RuleSessionImpl.setProperties(Map)
,
WorkingMemory.setApplicationData(String, Object)
,
DefaultConflictResolver
protected void setProperties(Map properties)
RuleSession
.
properties
- additional properties used to create the
RuleSession
implementation.protected Map getProperties()
RuleSession
.
RuleSession
.protected void setWorkingMemory(WorkingMemory workingMemory)
WorkingMemory
associated
with this RuleSession
.
workingMemory
- the WorkingMemory
to associate
with this RuleSession
.protected WorkingMemory getWorkingMemory()
WorkingMemory
associated
with this RuleSession
.
WorkingMemory
to associate
with this RuleSession
.protected void setRuleExecutionSet(RuleExecutionSetImpl ruleSet)
RuleExecutionSet
associated
with this RuleSession
.
ruleSet
- the Drools RuleExecutionSet
to associate
with this RuleSession
.protected RuleExecutionSetImpl getRuleExecutionSet()
RuleExecutionSet
associated
with this RuleSession
.
RuleExecutionSet
associated
with this RuleSession
.protected void checkRuleSessionValidity() throws InvalidRuleSessionException
RuleSession
is not
in an illegal rule session state.
InvalidRuleSessionException
- on illegal rule session state.protected void applyFilter(List objects, ObjectFilter objectFilter)
ObjectFilter
to the List
of
Object
s, removing all Object
s from the given
List
that do not pass the filter.
objects
- List
of Object
s to be filteredobjectFilter
- the ObjectFilter
to be appliedpublic RuleExecutionSetMetadata getRuleExecutionSetMetadata()
getRuleExecutionSetMetadata
in interface RuleSession
public int getType() throws InvalidRuleSessionException
RuleSession
. The
type identifiers are defined in the RuleRuntime
interface.
getType
in interface RuleSession
RuleSession
InvalidRuleSessionException
- on illegal rule session state.RuleRuntime.STATEFUL_SESSION_TYPE
,
RuleRuntime.STATELESS_SESSION_TYPE
public void release()
RuleRuntime
.
release
in interface RuleSession
public void reset()
RuleExecutionSet
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |