Examples of RuleBackendRuntime


Examples of org.wso2.carbon.rule.kernel.backend.RuleBackendRuntime

       
        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);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.