Customized strategy objects

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:

FindingStrategy
The FindingStrategy accesses the persistent data store to find the set of rules matching the search criteria passed to the trigger call. The search criteria are based on the rule ID information passed on the trigger call. The set of rules found is passed to the FilteringStrategy.
FilteringStrategy
The FilteringStrategy can change the set of rules that were found by the FindingStrategy. The set of rules returned is the set that are fired by the FiringStrategy.
FiringStrategy
The FiringStrategy fires the rules found by the FindingStrategy, which may be modified by the FilteringStrategy. It gathers the results of the individual rules and passes them to the CombiningStrategy.
CombiningStrategy
The CombiningStrategy takes the results from firing the rules and combines them to produce the final result of the trigger.

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:

This capability can be used to set up filtering strategies that throw exceptions if the expected number of rules is not found.

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.


Related concepts
FindingStrategy method
FilteringStrategy method
FiringStrategy method
CombiningStrategy method
Related tasks
Developing BRBeans



Searchable topic ID:   cbrb_ownstrt
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/brb/concepts/cbrb_ownstrt.html

Library | Support | Terms of Use | Feedback