Customized rule implementors
To write your own rule implementor, create a new Java class that implements
the com.ibm.websphere.brb.RuleImplementor interface.
This class must implement the following methods:
- Default constructor
- The class must have a default, no-argument constructor so that it can
be instantiated when a rule using it is triggered.
- init
- The init method comes from the RuleImplementor interface
and is called when the rule implementor is first created. Its purpose is to
perform an initialization needed by the rule implementor instance before it
is actually fired. The following parameters are passed to the init method:
- The initialization parameters defined for the rule being triggered
- These can be any parameters needed to properly initialize the rule implementor
instance. Often the initialization parameters consist of constants required
by the algorithm. For example, when using a rule implementor that checks whether
a number is greater than a threshold value, the threshold value normally is
passed as an initialization parameter. This parameter is null if there are
no initialization parameters for the rule.
- An array of names of dependent rules for the rule being triggered
- Normally, the rule implementor stores these names to be used when the fire method is called. These dependent rules are intended
to be triggered as part of the algorithm performed by the rule implementor.
See Dependent
Rules for more information. This parameter is null if there are no
dependent rules defined for the rule.
- The user-defined data for the rule being triggered
- This data is completely defined by the user of the Business Rule Beans
(BRBeans). BRBeans does not interpret this data in any way. This parameter
is null if there is no user-defined data defined for the rule.
- A reference to the actual rule being triggered
- This can be used to extract attribute values from the rule, if needed.
- fire
- The fire method comes from the RuleImplementor interface.
This method is called to perform the algorithm of the rule implementor. Any
desired algorithm can be performed here. Normally, a value is returned by
the fire method that is ultimately returned as
the result of triggering the rule. The following parameters are passed to
the fire method:
- The TriggerPoint object that is being used to trigger the rule
- This parameter is needed if the rule has dependent rules that the fire
method needs to trigger.
- The target object for this particular trigger call
- This parameter can be any object that is thought of as the target of the
rule. However, the parameter can be null.
- A reference to the actual rule being triggered
- This parameter can be used to extract attribute values from the rule,
if needed.
- The firing parameters for this particular trigger call
- Normally, these parameters are the firing parameters passed by the code
invoking the trigger point. However, these can be overridden by specifying
firing parameters on the rule itself. Wherever they ultimately come from,
these are the parameters that the rule implementor needs at run time to perform
its function. Normally, these will be run-time variables that are to be processed
by the rule implementor. For example, when using a rule implementor that checks
whether a number is greater than a threshold value, the number to be checked
normally is passed as a firing parameter. This parameter is null if no firing
parameters are passed by the caller and none are defined on the rule itself.
- getDescription
- getDescription comes from the RuleImplementor interface.
The purpose of this method is to return a text string that describes the function
of the rule implementor. This information might be displayed on a user interface
to help a user select what implementor to use. This method, however, is currently
not used by the BRBeans framework. For additional imformation, see the RuleImplementor
interface
in the BRBeans Javadoc.

Dependent rules

Developing BRBeans
Searchable topic ID:
cbrb_rulman
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_rulman.html