The process of triggering a rule or set of rules is controlled by a set of strategy objects. The following four strategies are used each time a rule is triggered:
Each 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 can set different strategies for classifier rules and for non-classifier rules. The strategies set for classifier rules are used when the Business Rule Beans (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:
Users can write their own strategy implementations to perform special functions not performed by the predefined implementations. Write these strategy implementations with care since part of the functionality of the BRBeans framework is 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.
For the filtering and combining strategies, create a class that implements either FilteringStrategy or CombiningStrategy and either the filterRules() method (for FilteringStrategy) or the combineResults() method (for CombiningStrategy) to perform the required functions. At run time, create an instance of the new class and pass it 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 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. It is suggested that you subclass these when you customize your own strategies and then override the desired methods on the default implementation to provide the new behavior.
The BRBeans Javadoc provides more information about the FindingStrategy , FilteringStrategy , FiringStrategy , and the CombiningStrategy interfaces.