com.ibm.websphere.brb.strategy
Class StrategyHelper

java.lang.Object
  extended bycom.ibm.websphere.brb.strategy.StrategyHelper

public abstract class StrategyHelper
extends java.lang.Object

A general helper class for use by strategy implementations. This class contains general helper methods that may be useful in implementing a strategy.


Field Summary
static java.lang.String BRB_RESOURCE_BUNDLE
          The name of the BRBeans-supplied resource bundle containing messages used at runtime.
 
Constructor Summary
StrategyHelper()
           
 
Method Summary
static void addClassifiedRulesToBRBCache(IRule[] rulesToAdd, java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.lang.String[] classifications, java.util.Date asOfDate)
          Add the specified rules to the BRBeans-supplied cache.
static void addClassifierRulesToBRBCache(IRule[] rulesToAdd, java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.util.Date asOfDate)
          Add the specified rules to the BRBeans-supplied cache.
static void addRulesToBRBCache(IRule[] rulesToAdd, java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.util.Date asOfDate)
          Add the specified rules to the BRBeans-supplied cache.
static IRule[] findClassifiedRulesInBRBCache(java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.lang.String[] classifications, java.util.Date asOfDate)
          Find classified rules in the BRBeans-supplied rule cache matching the specified search criteria.
static IRule[] findClassifiedRulesInDatabase(java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.lang.String[] classifications, java.util.Date date)
          Find rules in the database matching the specified search criteria.
static IRule[] findClassifierRulesInBRBCache(java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.util.Date asOfDate)
          Find classifier rules in the BRBeans-supplied rule cache matching the specified search criteria.
static IRule[] findClassifierRulesInDatabase(java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.util.Date date)
          Find rules in the database matching the specified search criteria.
static IRule[] findRulesInBRBCache(java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.util.Date asOfDate)
          Find rules that are neither classifiers nor classified in the BRBeans-supplied rule cache matching the specified search criteria.
static IRule[] findRulesInDatabase(java.lang.String folderName, java.lang.String ruleName, TriggerPoint tp, java.util.Date date)
          Find rules in the database matching the specified search criteria.
static java.lang.String[] parseFullRuleName(java.lang.String fullRuleName)
          Parses the given fullRuleName (folderName followed by a '/' followed by ruleName) into the folderName and ruleName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BRB_RESOURCE_BUNDLE

public static final java.lang.String BRB_RESOURCE_BUNDLE
The name of the BRBeans-supplied resource bundle containing messages used at runtime.

See Also:
Constant Field Values
Constructor Detail

StrategyHelper

public StrategyHelper()
Method Detail

addClassifiedRulesToBRBCache

public static void addClassifiedRulesToBRBCache(IRule[] rulesToAdd,
                                                java.lang.String folderName,
                                                java.lang.String ruleName,
                                                TriggerPoint tp,
                                                java.lang.String[] classifications,
                                                java.util.Date asOfDate)
                                         throws BusinessRuleBeansException

Add the specified rules to the BRBeans-supplied cache. The rules will be associated with the specified folder name, rule name, and asOfDate. The rules must be classified rules.

Parameters:
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.
classifications - The rules will be associated with these classifications.
asOfDate - The rules will be associated with this asOfDate in the cache. If null, then the current date and time is used.
Throws:
BusinessRuleBeansException - If any errors occur.

addClassifierRulesToBRBCache

public static void addClassifierRulesToBRBCache(IRule[] rulesToAdd,
                                                java.lang.String folderName,
                                                java.lang.String ruleName,
                                                TriggerPoint tp,
                                                java.util.Date asOfDate)
                                         throws BusinessRuleBeansException

Add the specified rules to the BRBeans-supplied cache. The rules will be associated with the specified folder name, rule name, and asOfDate. The rules must be classifiers.

Parameters:
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.
Throws:
BusinessRuleBeansException - If any errors occur.

addRulesToBRBCache

public static void addRulesToBRBCache(IRule[] rulesToAdd,
                                      java.lang.String folderName,
                                      java.lang.String ruleName,
                                      TriggerPoint tp,
                                      java.util.Date asOfDate)
                               throws BusinessRuleBeansException

Add the specified rules to the BRBeans-supplied cache. The rules will be associated with the specified folder name, rule name, and asOfDate. The rules must be neither classifiers nor classified.

Parameters:
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.
Throws:
BusinessRuleBeansException - If any errors occur.

findClassifiedRulesInBRBCache

public static IRule[] findClassifiedRulesInBRBCache(java.lang.String folderName,
                                                    java.lang.String ruleName,
                                                    TriggerPoint tp,
                                                    java.lang.String[] classifications,
                                                    java.util.Date asOfDate)
                                             throws BusinessRuleBeansException

Find classified rules in the BRBeans-supplied rule cache matching the specified search criteria.

Parameters:
folderName - Look for rules in this folder.
ruleName - Look for rules with this name.
tp - The TriggerPoint used to make this call.
classifications - Look for rules classified with one of these classifications.
asOfDate - Rules found should be in effect on this date. If null, rules in effect at the current date and time should be found.
Returns:
An array containg all rules in the cache matching the search criteria. If an entry is in the cache indicating that there are no rules matching the search criteria, then a zero-length array is returned. If there is no entry in the cache for the search criteria, then null is returned.
Throws:
BusinessRuleBeansException - If any errors occur.

findClassifiedRulesInDatabase

public static IRule[] findClassifiedRulesInDatabase(java.lang.String folderName,
                                                    java.lang.String ruleName,
                                                    TriggerPoint tp,
                                                    java.lang.String[] classifications,
                                                    java.util.Date date)
                                             throws BusinessRuleBeansException

Find rules in the database matching the specified search criteria. The rules found will be classified rules.

Parameters:
folderName - Search for rules in this folder.
ruleName - Search for rules with this name.
tp - The TriggerPoint used to make this call.
classifications - Search for rules with these classifications.
date - Search for rules that are effective on this date.
Returns:
An array containg all rules in the database matching the search criteria. If no rules are found matching the search criteria, then a zero-length array is returned.
Throws:
BusinessRuleBeansException - If any errors occur.

findClassifierRulesInBRBCache

public static IRule[] findClassifierRulesInBRBCache(java.lang.String folderName,
                                                    java.lang.String ruleName,
                                                    TriggerPoint tp,
                                                    java.util.Date asOfDate)
                                             throws BusinessRuleBeansException

Find classifier rules in the BRBeans-supplied rule cache matching the specified search criteria.

Parameters:
folderName - Look for rules in this folder.
ruleName - Look 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.
Returns:
An array containg all rules in the cache matching the search criteria. If an entry is in the cache indicating that there are no rules matching the search criteria, then a zero-length array is returned. If there is no entry in the cache for the search criteria, then null is returned.
Throws:
BusinessRuleBeansException - If any errors occur.

findClassifierRulesInDatabase

public static IRule[] findClassifierRulesInDatabase(java.lang.String folderName,
                                                    java.lang.String ruleName,
                                                    TriggerPoint tp,
                                                    java.util.Date date)
                                             throws BusinessRuleBeansException

Find rules in the database matching the specified search criteria. The rules found will be classifiers.

Parameters:
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.
Returns:
An array containg all rules in the database matching the search criteria. If no rules are found matching the search criteria, then a zero-length array is returned.
Throws:
BusinessRuleBeansException - If any errors occur.

findRulesInBRBCache

public static IRule[] findRulesInBRBCache(java.lang.String folderName,
                                          java.lang.String ruleName,
                                          TriggerPoint tp,
                                          java.util.Date asOfDate)
                                   throws BusinessRuleBeansException

Find rules that are neither classifiers nor classified in the BRBeans-supplied rule cache matching the specified search criteria.

Parameters:
folderName - Look for rules in this folder.
ruleName - Look 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.
Returns:
An array containg all rules in the cache matching the search criteria. If an entry is in the cache indicating that there are no rules matching the search criteria, then a zero-length array is returned. If there is no entry in the cache for the search criteria, then null is returned.
Throws:
BusinessRuleBeansException - If any errors occur.

findRulesInDatabase

public static IRule[] findRulesInDatabase(java.lang.String folderName,
                                          java.lang.String ruleName,
                                          TriggerPoint tp,
                                          java.util.Date date)
                                   throws BusinessRuleBeansException

Find rules in the database matching the specified search criteria. The rules found will be neither classifiers nor classified.

Parameters:
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.
Returns:
An array containg all rules in the database matching the search criteria. If no rules are found matching the search criteria, then a zero-length array is returned.
Throws:
BusinessRuleBeansException - If any errors occur.

parseFullRuleName

public static java.lang.String[] parseFullRuleName(java.lang.String fullRuleName)

Parses the given fullRuleName (folderName followed by a '/' followed by ruleName) into the folderName and ruleName. An array of two Strings is returned; the first String is the folderName and the second is the ruleName. If there is no folderName in the given fullRuleName, "" will be returned as the folderName.

Parameters:
fullRuleName - the full rule name (foldername "/" ruleName) to parse
Returns:
An array of two Strings, the first being the folderName (or ""), the second being the ruleName (or "");