![]() |
The process of triggering a rule or set of rules is controlled by a set of strategy objects. Four strategies are used each time a rule is triggered:
TriggerPoint
object has its own set of strategies that can
be changed independent of any other TriggerPoint
object. There
is a set of default strategies that are used by the TriggerPoint
if
none are explicitly set.
For each of the four strategies you are allowed to set different strategies for classifier rules and for non-classifier rules. The strategies set for classifier rules are to be used when the BRBeans framework is triggering a classifier rule. The strategies for non-classifier rules are used in all other cases.
It is also possible to set three different sets of filtering strategies:
Strategy classes must implement one of the strategy interfaces provided
by BRBeans in the com.ibm.websphere.brb
package:
FindingStrategy
FilteringStrategy
FiringStrategy
CombiningStrategy
The user is also allowed to write his or her own strategy implementations to perform special functions not performed by the predefined implementations. This should be done with care since part of the functionality of the BRBeans framework is actually being replaced when you write a custom strategy. One simple example of writing a custom strategy is creating a new firing strategy that logs every rule that is fired.
The basic requirement for a strategy implementation is that it implements the appropriate strategy interface.
The filtering and combining strategies are particularly
simple. For these, a class should be created that implements either FilteringStrategy
or CombiningStrategy
and
implements either the filterRules
method (for FilteringStrategy
)
or the combineResults
method (for CombiningStrategy
)
to perform the required functions. At runtime, an instance of the new class
should be created and passed to the TriggerPoint
object using
the appropriate set method so that the new strategy is used when rules are
triggered using that TriggerPoint
.
The finding and firing strategies are somewhat more complicated to customize since they provide more function than the simple filtering and combining strategies. Default finding and firing strategy implementations are provided that define a general outline of the steps necessary to perform the function. We recommend subclassing these when customizing your own strategies, and then overriding the desired methods on the default implementation to provide the new behavior.
Refer to either the BRBeans
Javadoc or the source code for the default implementations in com.ibm.websphere.brb.strategy
for
more details.
Related concepts... | |
Using strategy objects to control triggers | |
Finding strategy | |
Filtering strategy | |
Firing strategy | |
Combining strategy | |
View PDF file... | |
To view a PDF file containing this article and related articles, click: | |
![]() | |