Examples of RuleSetDescription


Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader == null) {
            classLoader = this.getClass().getClassLoader();
        }

        RuleSetDescription ruleSetDescription = ruleMediatorDescription.getRuleSetDescription();
        ruleEngine = ruleServerManager.createRuleEngine(classLoader);
        if (ruleSetDescription.getRuleSource() != null) {
            String bindURI = ruleEngine.addRuleSet(ruleSetDescription);
            SessionDescription sessionDescription = ruleMediatorDescription.getSessionDescription();
            sessionDescription.setRuleSetURI(bindURI);
        } else {
            registryKey = ruleSetDescription.getKey();
        }

        inputManager = inputOutputAdaptersService.createInputManager(
                ruleMediatorDescription.getFacts(),
                interceptor);
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

     *
     * @param ruleSet            rule set as a object
     * @param sessionDescription information about the session to be associated with the rule set
     */
    private void addRuleSet(Object ruleSet, SessionDescription sessionDescription) {
        RuleSetDescription ruleSetDescription =
                ruleMediatorDescription.getRuleSetDescription();
        if (added) {
            ruleEngine.removeRuleSet(ruleSetDescription);
        }
        ruleSetDescription.setRuleSource(ruleSet);
        String bindURI = ruleEngine.addRuleSet(ruleSetDescription);
        added = true;
        sessionDescription.setRuleSetURI(bindURI);
    }
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

        // rule set
        QName parameterQName = qNameFactory.createQName(CommonsConstants.ELE_RULESET,
                parentQName);
        OMElement parameterElem = configuration.getFirstChildWithName(parameterQName);
        if (parameterElem != null) {
            RuleSetDescription ruleSetDescription =
                    RuleSetDescriptionFactory.create(parameterElem, xPathFactory, extensionBuilder);
            if (ruleSetDescription != null) {
                description.setRuleSetDescription(ruleSetDescription);
            }
        }
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

        if (!(configuration instanceof RuleSetDescription)) {
            throw new LoggedRuntimeException("Invalid rule configuration," +
                    "expect RuleSetDescription.", log);
        }

        RuleSetDescription description = (RuleSetDescription) configuration;
        String key = description.getKey();
        String path = description.getPath();
        Object inLinedScript = description.getRuleSource();

        if (key == null && inLinedScript == null && path == null) {
            throw new LoggedRuntimeException("Invalid Configuration !!- Either script in-lined " +
                    "value or key or path should be presented", log);
        }
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

            ServiceDescription serviceDescription = (ServiceDescription) configuration;
            RuleServiceExtensionDescription extensionDescription =
                    (RuleServiceExtensionDescription)
                            serviceDescription.getServiceExtensionDescription();
            RuleSetDescription ruleSetDescription = extensionDescription.getRuleSetDescription();
            OMNamespaceFactory omNamespaceFactory = OMNamespaceFactory.getInstance();
            OMNamespace omNamespace = omNamespaceFactory.createOMNamespace(
                    parent.getNamespace().getNamespaceURI(), "");
            if (ruleSetDescription != null) {
                OMElement ruleSetElement = OM_FACTORY.createOMElement(CommonsConstants.ELE_RULESET,
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

        QName executionSetQName = qNameFactory.createQName(CommonsConstants.ELE_RULESET,
                tagQName);
        OMElement executionSetElement = configurationXML.getFirstChildWithName(executionSetQName);

        if (executionSetElement != null) {
            RuleSetDescription description =
                    RuleSetDescriptionFactory.create(executionSetElement, xPathFactory,
                            configurationExtensionBuilder);
            ruleMediatorDescription.setRuleSetDescription(description);
        } else {
            throw new LoggedRuntimeException("ruleset configuration element must be given",
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

        if (!(extensibleConfiguration instanceof RuleSetDescription)) {
            throw new LoggedRuntimeException("Invalid rule configuration," +
                    "expect RuleSetDescription.", log);
        }

        RuleSetDescription description = (RuleSetDescription) extensibleConfiguration;
        QName parentQName = ruleSet.getQName();
        QNameFactory qNameFactory = QNameFactory.getInstance();
        QName sourceQName = qNameFactory.createQName(CommonsConstants.ELE_SOURCE,
                parentQName);

        OMElement sourceElement = ruleSet.getFirstChildWithName(sourceQName);
        if (sourceElement == null) {
            throw new LoggedRuntimeException("Invalid configuration. " +
                    "The rule set source cannot be found.", log);
        }

        String ruleKey = sourceElement.getAttributeValue(CommonsConstants.ATT_KEY_Q);
        if (ruleKey != null && !"".equals(ruleKey)) {
            description.setKey(ruleKey.trim());
        } else {
            OMElement inLinedSource = sourceElement.getFirstElement();
            if (inLinedSource == null) {
                String inLinedText = sourceElement.getText();
                if (inLinedText == null || "".equals(inLinedText.trim())) {
                    throw new LoggedRuntimeException("The rule set source cannot be found " +
                            "from either in-lined or key. It is required.", log);
                } else {
                    description.setRuleSource(inLinedText.trim());
                }
            } else {
                description.setRuleSource(inLinedSource);
            }
        }
    }
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

        if (!(extensibleConfiguration instanceof RuleSetDescription)) {
            throw new LoggedRuntimeException("Invalid rule configuration," +
                    "expect RuleSetDescription.", log);
        }
        RuleSetDescription description = (RuleSetDescription) extensibleConfiguration;

        String ruleKey = ruleSet.getAttributeValue(CommonsConstants.ATT_KEY_Q);
        if (ruleKey != null && !"".equals(ruleKey)) {
            description.setKey(ruleKey.trim());
        } else {
            String path = ruleSet.getAttributeValue(CommonsConstants.ATT_PATH_Q);
            if (path != null && !"".equals(path)) {
                description.setPath(path);
            } else {
                OMElement inLinedSource = ruleSet.getFirstElement();
                if (inLinedSource == null) {
                    String inLinedText = ruleSet.getText();
                    if (inLinedText == null || "".equals(inLinedText.trim())) {
                        throw new LoggedRuntimeException("The rule set source cannot be found " +
                                "from either in-lined or key. It is required.", log);
                    } else {
                        description.setRuleSource(inLinedText.trim());
                    }
                } else {
                    description.setRuleSource(inLinedSource);
                }
            }
        }
    }
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

        if (!(configuration instanceof RuleSetDescription)) {
            throw new LoggedRuntimeException("Invalid rule configuration," +
                    "expect RuleSetDescription.", log);
        }

        RuleSetDescription description = (RuleSetDescription) configuration;

        OMNamespace omNamespace = parent.getNamespace();
        OMElement sourceOmElement = OM_FACTORY.createOMElement("source", omNamespace);
        String key = description.getKey();
        Object inLinedScript = description.getRuleSource();
        if (key == null && inLinedScript == null) {
            throw new LoggedRuntimeException("Invalid Configuration !!- Either script in-lined " +
                    "value or key should be presented", log);
        }
View Full Code Here

Examples of org.wso2.carbon.rulecep.commons.descriptions.rule.RuleSetDescription

        RuleEngine ruleEngine =
                RuleServiceManger.getInstance().getRuleServerManagerService().createRuleEngine(
                        axisService.getClassLoader());
        RuleServiceExtensionDescription extensionDescription =
                (RuleServiceExtensionDescription) serviceDescription.getServiceExtensionDescription();
        RuleSetDescription ruleSetDescription = extensionDescription.getRuleSetDescription();
        Object ruleSource = ruleSetDescription.getRuleSource();

        int tenantId =  SuperTenantCarbonContext.getCurrentContext(axisService).getTenantId();
        if (ruleSource == null) {
            Object value = loadRuleScript(axisService.getClassLoader(), ruleSetDescription,
                    resourceLoader,tenantId);
            if (value == null) {
                throw new LoggedRuntimeException("Cannot load the rule script from" +
                        " the " + ruleSetDescription, log);
            }
            ruleSetDescription.setRuleSource(value);
        }

        String uri = ruleEngine.addRuleSet(ruleSetDescription);
        return new RuleServiceEngine(axisService, ruleEngine, uri);
    }
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.