com.ibm.commerce.rules
Class RulesSystemDataModel

java.lang.Object
  |
  +--com.ibm.commerce.rules.RulesSystemDataModel
Direct Known Subclasses:
RulesSystemDataModelEjbImpl, RulesSystemDataModelMemoryImpl

public abstract class RulesSystemDataModel
extends java.lang.Object

This class represents the Rules System part of the data model. Its primary responsibility is to centralize interaction with the data model and its persistence mechanisms. It also allows for conversions between the data model types and the persistence mechanism types, when they are different.

All interaction with a particular persistence mechanism should be placed in subclasses.

Almost all these methods can throw the unchecked exception RulesSystemDataModelException, which subclasses should throw only to indicate a low-level exception within its persistent store. These are exceptions which should never happen, for example, to an in-memory implementation of the data model. Common examples include serialization errors, database errors and network/distributed database errors. These are generally unrecoverable or fatal errors.


Field Summary
static java.lang.String COPYRIGHT
           
 
Constructor Summary
RulesSystemDataModel()
           
 
Method Summary
abstract  boolean commitRuleServerConfiguration(RuleServerConfiguration aRuleServerConfiguration)
          Commits the specified rule server configuration to this data model's persistent store.
abstract  boolean commitRuleServiceConfiguration(RuleServiceConfiguration aRuleServiceConfiguration)
          Commits the specified rule service configuration to this data model's persistent store.
abstract  void commitRuleServiceStatus(java.lang.String aServerName, RuleServiceKey aServiceKey, java.lang.String aCloneName, RuleServiceStatusCode aStatusCode)
          Commits the specified rule service status report to this data model's persistent store.
abstract  int countRuleServiceConfigurations()
          Counts the number of rule service configurations in all rule servers
abstract  int countRuleServiceConfigurationsInServer(java.lang.String aServerName)
          Counts the number of rule service configurations in the specified rule server.
 com.ibm.commerce.rules.blaze.BlazeRuleServiceConfiguration createBlazeRuleServiceConfiguration(RuleServiceConfiguration from)
          Creates a BlazeRuleServiceConfiguration from the specified RuleServiceConfigurationAccessBean.
abstract  void eachRuleServiceConfiguration(RuleServiceConfigurationBlock command)
          Executes the specified block of code for each rule service configuration in all rule servers.
abstract  void eachRuleServiceConfigurationInServer(java.lang.String aServerName, RuleServiceConfigurationBlock command)
          Executes the specified block of code for each rule service configuration in the specified server.
static RulesSystemDataModel getInstance()
          Provides access to an instance of the data model implementation used by the production system.
abstract  RuleServerConfiguration lookupRuleServerConfiguration(java.lang.String aServerName)
          Retrieves the rule server configuration with the specified name.
abstract  RuleServiceConfiguration lookupRuleServiceConfiguration(java.lang.String aServerName, RuleServiceKey aRuleServiceKey)
          Retrieves the rule service configuration in the specified rule server with the specified identifying key.
abstract  RuleServiceStatus lookupRuleServiceStatus(java.lang.String aServerName, RuleServiceKey aServiceKey)
          Retrieves the rule service status for the specified rule service within the specified rule server.
abstract  void removeRuleServerConfiguration(java.lang.String aServerName)
          Removes a rule server configuration specified by name, along with all its configured rule services.
abstract  void removeRuleServiceConfiguration(java.lang.String aServerName, RuleServiceKey aRuleServiceKey)
          Removes a rule service configuration from the rule server specified by name.
abstract  void removeRuleServiceConfigurations(RuleServiceConfigurationFilter filter)
          Removes the rule service configurations accepted by the specified filter.
static void reset()
          Resets the singleton, which can be useful to clear caches, and so on.
 boolean ruleServerConfigurationExists(RuleServerConfiguration aRuleServerConfiguration)
          Answers the question, "Does this rule server configuration exist in the persistent store?"
abstract  boolean ruleServerConfigurationExists(java.lang.String aServerName)
          Answers the question, "Does a rule server configuration exist in the persistent store with this name?"
abstract  boolean ruleServiceConfigurationExists(java.lang.String aServerName, RuleServiceKey aServiceKey)
          Answers the question, "Does a rule service configuration exist in the persistent store with this key and in this rule server?"
abstract  boolean ruleServiceStatusExists(java.lang.String aServerName, RuleServiceKey aServiceKey)
          Answers the question, "Is there a rule service status report in the persistent store for this rule service key in this rule server?"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Constructor Detail

RulesSystemDataModel

public RulesSystemDataModel()
Method Detail

commitRuleServerConfiguration

public abstract boolean commitRuleServerConfiguration(RuleServerConfiguration aRuleServerConfiguration)
                                               throws RulesSystemDataModelException
Commits the specified rule server configuration to this data model's persistent store.
Returns:
true if a new persistent object was created; false if one was only updated.

commitRuleServiceConfiguration

public abstract boolean commitRuleServiceConfiguration(RuleServiceConfiguration aRuleServiceConfiguration)
                                                throws RulesSystemDataModelException,
                                                       RuleServerConfigurationNotFoundException
Commits the specified rule service configuration to this data model's persistent store.
Returns:
true if a new persistent object was created; false if one was only updated.
Throws:
RuleServerConfigurationNotFoundException - Indicates that the rule server configuration for the rule server to which the specified rule service belongs does not exist.

commitRuleServiceStatus

public abstract void commitRuleServiceStatus(java.lang.String aServerName,
                                             RuleServiceKey aServiceKey,
                                             java.lang.String aCloneName,
                                             RuleServiceStatusCode aStatusCode)
Commits the specified rule service status report to this data model's persistent store.
Parameters:
aServerName - The name of the rule server to which the rule service belongs.
aServiceKey - The identifying key of the rule service.
aCloneName - The name of the clone for which the rule service status is to be reported.
aStatusCode - The status to report for the rule service.
Throws:
RuleServerConfigurationNotFoundException - Indicates that the rule server configuration for the rule server to which the specified rule service belongs does not exist.

countRuleServiceConfigurations

public abstract int countRuleServiceConfigurations()
Counts the number of rule service configurations in all rule servers

countRuleServiceConfigurationsInServer

public abstract int countRuleServiceConfigurationsInServer(java.lang.String aServerName)
                                                    throws RulesSystemDataModelException
Counts the number of rule service configurations in the specified rule server. Note that if the specified server is not found, this method does not throw an exception; instead, it returns 0. Use ruleServerConfigurationExists(aServerName) if you are unsure whether the rule server configuration exists for your specified server.
Parameters:
aServerName - The name of a rule server.

createBlazeRuleServiceConfiguration

public com.ibm.commerce.rules.blaze.BlazeRuleServiceConfiguration createBlazeRuleServiceConfiguration(RuleServiceConfiguration from)
                                                                                               throws RulesSystemDataModelException
Creates a BlazeRuleServiceConfiguration from the specified RuleServiceConfigurationAccessBean.

eachRuleServiceConfiguration

public abstract void eachRuleServiceConfiguration(RuleServiceConfigurationBlock command)
                                           throws RulesSystemDataModelException
Executes the specified block of code for each rule service configuration in all rule servers.
Parameters:
command - A block of code to execute.
See Also:
RuleServiceConfigurationBlock

eachRuleServiceConfigurationInServer

public abstract void eachRuleServiceConfigurationInServer(java.lang.String aServerName,
                                                          RuleServiceConfigurationBlock command)
                                                   throws RulesSystemDataModelException
Executes the specified block of code for each rule service configuration in the specified server. Note that if the specified server is not found, this method does not throw an exception; instead, it does nothing. Use ruleServerConfigurationExists(aServerName) if you are unsure whether the rule server configuration exists for your specified server.
Parameters:
aServerName - The name of a rule server.
command - A block of code to execute.
See Also:
RuleServiceConfigurationBlock

getInstance

public static RulesSystemDataModel getInstance()
Provides access to an instance of the data model implementation used by the production system.

lookupRuleServerConfiguration

public abstract RuleServerConfiguration lookupRuleServerConfiguration(java.lang.String aServerName)
                                                               throws RuleServerConfigurationNotFoundException,
                                                                      RulesSystemDataModelException
Retrieves the rule server configuration with the specified name.
Throws:
RuleServerConfigurationNotFoundException - Indicates that the rule server configuration does not exist.

lookupRuleServiceConfiguration

public abstract RuleServiceConfiguration lookupRuleServiceConfiguration(java.lang.String aServerName,
                                                                        RuleServiceKey aRuleServiceKey)
                                                                 throws RuleServerConfigurationNotFoundException,
                                                                        RuleServiceConfigurationNotFoundException,
                                                                        RulesSystemDataModelException
Retrieves the rule service configuration in the specified rule server with the specified identifying key.
Throws:
RuleServerConfigurationNotFoundException - Indicates that the rule server configuration does not exist.
RuleServiceConfigurationNotFoundException - Indicates that the rule service configuration does not exist in the specified rule server.

lookupRuleServiceStatus

public abstract RuleServiceStatus lookupRuleServiceStatus(java.lang.String aServerName,
                                                          RuleServiceKey aServiceKey)
                                                   throws RuleServerConfigurationNotFoundException,
                                                          RuleServiceConfigurationNotFoundException,
                                                          RulesSystemDataModelException
Retrieves the rule service status for the specified rule service within the specified rule server. If no status reports have been made on the specified rule service, then an empty status is returned.
Throws:
RuleServerConfigurationNotFoundException - Indicates that the rule server configuration does not exist.
RuleServiceConfigurationNotFoundException - Indicates that the rule service configuration does not exist in the specified rule server.

removeRuleServerConfiguration

public abstract void removeRuleServerConfiguration(java.lang.String aServerName)
                                            throws RulesSystemDataModelException
Removes a rule server configuration specified by name, along with all its configured rule services. Clients should call ruleServerConfigurationExists(aServerName) first to determine whether the rule server configuration already exists.

removeRuleServiceConfiguration

public abstract void removeRuleServiceConfiguration(java.lang.String aServerName,
                                                    RuleServiceKey aRuleServiceKey)
                                             throws RuleServerConfigurationNotFoundException,
                                                    RuleServiceConfigurationNotFoundException,
                                                    RulesSystemDataModelException
Removes a rule service configuration from the rule server specified by name.
Throws:
RuleServerConfigurationNotFoundException - Indicates that the rule server configuration does not exist.
RuleServiceConfigurationNotFoundException - Indicates that the rule service configuration does not exist in the specified rule server.

removeRuleServiceConfigurations

public abstract void removeRuleServiceConfigurations(RuleServiceConfigurationFilter filter)
                                              throws RulesSystemDataModelException
Removes the rule service configurations accepted by the specified filter.

For example, to remove all disabled rule service configurations, clients can write the following.

 aRulesSystemDataModel.removeRuleServiceConfigurations(new RuleServiceConfigurationFilter() {
     // Return true to indicate that the rules system data model
     // should remove this rule service configuration.
     public boolean accept(RuleServiceConfiguration each) {
         return !each.isEnabled();
     }
 });
 

reset

public static void reset()
Resets the singleton, which can be useful to clear caches, and so on.

ruleServerConfigurationExists

public boolean ruleServerConfigurationExists(RuleServerConfiguration aRuleServerConfiguration)
                                      throws RulesSystemDataModelException
Answers the question, "Does this rule server configuration exist in the persistent store?"

ruleServerConfigurationExists

public abstract boolean ruleServerConfigurationExists(java.lang.String aServerName)
                                               throws RulesSystemDataModelException
Answers the question, "Does a rule server configuration exist in the persistent store with this name?"

ruleServiceConfigurationExists

public abstract boolean ruleServiceConfigurationExists(java.lang.String aServerName,
                                                       RuleServiceKey aServiceKey)
                                                throws RulesSystemDataModelException
Answers the question, "Does a rule service configuration exist in the persistent store with this key and in this rule server?"

ruleServiceStatusExists

public abstract boolean ruleServiceStatusExists(java.lang.String aServerName,
                                                RuleServiceKey aServiceKey)
                                         throws RulesSystemDataModelException
Answers the question, "Is there a rule service status report in the persistent store for this rule service key in this rule server?"