[Enterprise Extensions only]
  Previous topic

Using strategy objects to control triggers

Strategy objects are used to alter TriggerPoint functions.

Recall that the two simple trigger methods, trigger() and triggerClassifier(), perform their function in the following sequence:

  1. find the rules
  2. filter out those rules which are not desired
  3. fire the remaining rules
  4. combine the results and return to the caller

And that the complex trigger method, triggerSituational() does this sequence of steps twice, the first step to find the classification to feed into the second step.

Default strategy objects are already defined for each of the four TriggerPoint steps, and they are used if none are specified explicitly. For each of these steps, there are at least two strategy objects used, one for triggering classifier rules, and one for triggering non-classifier rules. For the filtering step, there are actually three pairs of strategies which are used, based on the number of rules which the finding strategy returns (zero, one, or multiple).

While the sheer number of strategies which are available can be intimidating (twelve different strategy classes can be set), typically very few will need updating, and in reality most users will only modify the filtering strategies or the combining strategies.

A number of pre-defined strategy objects are provided that should be adequate for the majority of cases. The Java classes for these strategy object are defined in package com.ibm.websphere.brb.strategy. Static constants are also defined in the interfaces for the various strategies to allow easy access to instances of the strategy classes to set them on the TriggerPoint.

It is also possible to write your own strategy class if the supplied ones don't perform the function you need. See Writing Your Own Strategies for more details.

  Previous topic