RuleEngineProvider ruleEngineProvider =
Util.getRuleEngineConfigService().getRuleConfig().getRuleEngineProvider();
Class ruleBackendRuntimeFactoryClass;
RuleBackendRuntime ruleBackendRuntime;
try{
ruleBackendRuntimeFactoryClass = Class.forName(ruleEngineProvider.getClassName());
RuleBackendRuntimeFactory ruleBackendRuntimeFactory =
(RuleBackendRuntimeFactory) ruleBackendRuntimeFactoryClass.newInstance();
ruleBackendRuntime =
ruleBackendRuntimeFactory.getRuleBackendRuntime(ruleEngineProvider.getProperties(),
Thread.currentThread().getContextClassLoader());
// create a rule set to add
RuleSet ruleSet = new RuleSet();
Rule rule = new Rule();
rule.setResourceType(Constants.RULE_RESOURCE_TYPE_REGULAR);
rule.setSourceType(Constants.RULE_SOURCE_TYPE_REGISTRY);
rule.setValue("gov:" + StratosConstants.THROTTLING_RULES_PATH);
ruleSet.addRule(rule);
ruleBackendRuntime.addRuleSet(ruleSet);
this.session = ruleBackendRuntime.createSession(Constants.RULE_STATEFUL_SESSION);
}catch(Exception e){
String msg = "Error occurred while initializing the rule executing environment: " + e.getMessage();
log.error(msg);