[Enterprise Extensions only]

Trigger Point Framework - overview

A trigger point is simply the location in a method of an object at which externalized business rules are invoked. Proper placement of trigger points can add substantially to the flexibility and speed with which a business application adapts to new business practices.

Wherever a trigger point is placed in user-written code, the BRBeans trigger point framework needs to do the following:

  1. Assemble the parameter list to send to the rules.
  2. Find the potential rules that apply.
  3. Optionally, filter out any rules which do not apply.
  4. Fire the rules in the filtered rule set.
  5. Combine the results of the rule firings is some meaningful way

The application code that contains the trigger point needs to perform the following functions:

  1. Establish a value for the target object. Usually the target object is the object in which the trigger point is encountered. The target object is one of the parameters passed to the fire method of the RuleImplementor.
  2. Build the array of objects containing the runtime parameters needed to satisfy the trigger point's business purpose. This array is normally passed as one of the parameters of the fire method of the RuleImplementor. If firing parameters are specified on the rule itself, then those firing parameters are passed instead of the ones passed by the caller.
  3. Invoke the trigger(), triggerClassifier(), or triggerSituational() method of the TriggerPoint class.
  4. Catch and handle any exceptions that might occur as a result of firing the rules, else take action based upon the rule firing results.

The two simple trigger methods, trigger and triggerClassifier, perform their function in four steps:

  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

The complex trigger method, triggerSituational does this sequence of steps twice, the first step to find the classification which is fed into the second step. The second step triggers rules which have the classification equal to the value returned in the first step.

How each of these steps is performed can be modified through various methods on the TriggerPoint object. The implementation of each step is defined by a strategy object. For more information on strategies, see Using strategy objects to control triggers.