|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.websphere.brb.strategy.DefaultClassifierFindingStrategy
The default FindingStrategy which is used to find classifier rules. No other types of rules are
found by this FindingStrategy. Clients wishing to write their own finding strategies can use it
as the basis for implementing various kinds of finding strategies. The client programmer should
subclass DefaultClassifierFindingStrategy to implement a custom strategy. Normally new behavior
should be implemented by overriding one or more of the following methods: parseRuleIdInfo
,
findRulesInCache
, findRulesInDatabase
, and addRulesToCache
.
The default findRules
method should usually be adequate. Note that, since the
finding strategy is stored as part of the TriggerPoint and the TriggerPoint may be passed on
a remote method call to the rule when it is fired, any FindingStrategy implementation must
implement the Serializable interface.
Field Summary |
---|
Fields inherited from interface com.ibm.websphere.brb.FindingStrategy |
---|
DEFAULT_CLASSIFIER, DEFAULT_NONCLASSIFIER |
Constructor Summary | |
---|---|
DefaultClassifierFindingStrategy()
|
Method Summary | |
---|---|
void |
addRulesToCache(IRule[] rulesToAdd,
java.lang.String folderName,
java.lang.String ruleName,
TriggerPoint tp,
java.util.Date asOfDate)
Add the specified rules to the cache. |
IRule[] |
findRules(TriggerPoint tp,
java.lang.Object ruleIdInfo,
java.lang.Object classificationInfo,
java.util.Date asOfDate)
This implementation of the findRules method searches for classifier rules matching
the specified criteria. |
IRule[] |
findRulesInCache(java.lang.String folderName,
java.lang.String ruleName,
TriggerPoint tp,
java.util.Date asOfDate)
Look in the cache for classifier rules with the specified name in the specified folder that are in effect on the specified date. |
IRule[] |
findRulesInDatabase(java.lang.String folderName,
java.lang.String ruleName,
TriggerPoint tp,
java.util.Date date)
Look in the database for classifier rules with the specified name in the specified folder that are in effect on the specified date. |
java.lang.String[] |
parseRuleIdInfo(java.lang.Object ruleIdInfo,
java.lang.String baseFolderName)
Uses the rule ID information object passed into the finding strategy to determine the fully-qualified names of the rules to be found. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultClassifierFindingStrategy()
Method Detail |
public void addRulesToCache(IRule[] rulesToAdd, java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.util.Date asOfDate) throws BusinessRuleBeansException
Add the specified rules to the cache. The rules will be associated with the specified folder
name, rule name, and asOfDate. This implementation simply calls a helper method to add the
rules to the BRBeans-supplied cache. Users may add to or otherwise change this behavior by
overriding this method. If this method is overridden, the findRulesInCache
method
may also need to be overridden.
rulesToAdd
- Array of rules to add to cache.folderName
- The rules will be associated with this folder name in the cache.ruleName
- The rules will be associated with this rule name in the cache.tp
- The TriggerPoint used to make this call.asOfDate
- The rules will be associated with this asOfDate in the cache. If null, then
the current date and time is used.
BusinessRuleBeansException
- If any errors occur.public IRule[] findRules(TriggerPoint tp, java.lang.Object ruleIdInfo, java.lang.Object classificationInfo, java.util.Date asOfDate) throws BusinessRuleBeansException
findRules
method searches for classifier rules matching
the specified criteria. Only classifier rules are found. This method controls the overall flow
of events for the finding strategy. The events consist of the following steps:
parseRuleIdInfo
method).
findRulesInCache
method).
findRulesInDatabase
method).
addRulesToCache
method).
When implementing a custom finding strategy, if this method is overridden, care should be taken that the new implementation fulfills the method's contract. Normally the overall sequence of events defined in this implementation should be adequate and clients should override one or more of the methods listed above in the four steps to implement a custom finding strategy.
findRules
in interface FindingStrategy
tp
- the trigger point which is used to make this callruleIdInfo
- an object that can be used to identify the rules to be found; normally
a fully-qualified name or an array of fully-qualified namesclassificationInfo
- an object that can be used to determine the classification of the rules
to be found, or null for unclassified rulesasOfDate
- rules returned should be in effect as of this date; null means use
the current date and time
BusinessRuleBeansException
- if any exceptions occurpublic IRule[] findRulesInCache(java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.util.Date asOfDate) throws BusinessRuleBeansException
Look in the cache for classifier rules with the specified name in the specified folder that are in effect on the specified date. The rules must also be marked as ready. The specified asOfDate may be null which means to look for rules that are in effect at the current date and time.
Note that there are two "no rules found in cache" conditions that must be distinguished:
This implementation simply calls a helper method to find rules in the BRBeans-supplied cache.
Users may add to or otherwise change this behavior by overriding this method. If this method is
overridden, the addRulesToCache
method may also need to be overridden.
folderName
- Search for rules in this folder.ruleName
- Search for rules with this name.tp
- The TriggerPoint used to make this call.asOfDate
- Rules found should be in effect on this date. If null, rules in effect at the
current date and time should be found.
BusinessRuleBeansException
- If any errors occur.public IRule[] findRulesInDatabase(java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.util.Date date) throws BusinessRuleBeansException
Look in the database for classifier rules with the specified name in the specified folder that are in effect on the specified date. The rule must also be marked as ready.
This implementation simply calls a helper method to find rules in the database. Users may add to or otherwise change this behavior by overriding this method.
folderName
- Search for rules in this folder.ruleName
- Search for rules with this name.tp
- The TriggerPoint used to make this call.date
- Search for rules that are effective on this date.
BusinessRuleBeansException
- If any errors occur.public java.lang.String[] parseRuleIdInfo(java.lang.Object ruleIdInfo, java.lang.String baseFolderName) throws BusinessRuleBeansException
Uses the rule ID information object passed into the finding strategy to determine the fully-qualified names of the rules to be found. The ruleIdInfo parameter can be any object that can be used to determine the rule names. It is exactly the rule ID information object passed on the TriggerPoint call. For the BRBeans-supplied finding strategies, this is required to be either a single String (find rules with this fully-qualified name) or a String[] or an Object[] containing Strings (find rules that have any of the fully-qualified names in the array). Any other types will result in a BusinessRuleBeansException being thrown. Users can override this method in their own finding strategies to take any type of parameter, as long as it can be used to produce an array of fully-qualified rule names.
ruleIdInfo
- Object containing information to be used to produce an array of fully-qualified
rule names. BRBeans-supplied finding strategies require that this is either a
String, a String[], or an Object[] containing Strings.baseFolderName
- The base folder name that rule names should be relative to. If null, then
rule names must be fully-qualified.
BusinessRuleBeansException
- If any errors occur.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |