Package org.wso2.carbon.rulecep.commons

Examples of org.wso2.carbon.rulecep.commons.LoggedRuntimeException


                OMNamespaceFactory omNamespaceFactory = OMNamespaceFactory.getInstance();
                opElement = OM_FACTORY.createOMElement(CommonsConstants.ELE_OPERATION, NULL_NS);
                opElement.addAttribute(OM_FACTORY.createOMAttribute("name",
                        omNamespaceFactory.createOMNamespace(name), name.getLocalPart()));
            } else {
                throw new LoggedRuntimeException("Operation name missing", log);
            }
        }

        if (description.isForceInOnly()) {
            opElement.addAttribute(OM_FACTORY.createOMAttribute("mep",
View Full Code Here


        QName name = description.getName();
        if (name != null) {
            opElement.addAttribute(OM_FACTORY.createOMAttribute("name",
                    omNamespaceFactory.createOMNamespace(name), name.getLocalPart()));
        } else {
            throw new LoggedRuntimeException("Operation name missing", log);
        }
        extensionSerializer.serialize(description, xPathSerializer, opElement);
        serialize(description, xPathSerializer, opElement);

        return opElement;
View Full Code Here

        QName elementQName = qNameFactory.createQName(CommonsConstants.ELE_ELEMENT, omNamespace);
        if (description.isContainsResult()) {
            ResourceDescription firstDescription = description.getResultDescriptions().get(0);
            if (!"omelement".equals(firstDescription.getType())) { //todo
                throw new LoggedRuntimeException("Invalid result !! result type is invalid", log);
            }
            OMElement resultElement = OM_FACTORY.createOMElement(CommonsConstants.ELE_RESULT,
                    omNamespace);
            String name = firstDescription.getName();
            if (name != null && !"".equals(name)) {
View Full Code Here

            RuleSetDescription description =
                    RuleSetDescriptionFactory.create(executionSetElement, xPathFactory,
                            configurationExtensionBuilder);
            ruleMediatorDescription.setRuleSetDescription(description);
        } else {
            throw new LoggedRuntimeException("ruleset configuration element must be given",
                    log);
        }

        QName factsQName = qNameFactory.createQName("facts", tagQName);
        OMElement factsElement = configurationXML.getFirstChildWithName(factsQName);
View Full Code Here

            XMLStreamReader parser = XMLInputFactory.newInstance().
                    createXMLStreamReader(inputStream);
            StAXOMBuilder builder = new StAXOMBuilder(parser);
            return builder.getDocumentElement();
        } catch (FileNotFoundException e) {
            throw new LoggedRuntimeException(COMPONENT_CONF + "cannot be found in" +
                    " the path : " + path,
                    e, log);
        } catch (XMLStreamException e) {
            throw new LoggedRuntimeException("Invalid XML for " + COMPONENT_CONF + " located in" +
                    " the path : " +
                    path, e, log);
        } finally {
            try {
                if (inputStream != null) {
View Full Code Here

    public void build(ExtensibleConfiguration extensibleConfiguration,
                      OMElement ruleSet, XPathFactory xPathFactory) {

        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 {
View Full Code Here

    public void build(ExtensibleConfiguration extensibleConfiguration,
                      OMElement ruleSet, XPathFactory xPathFactory) {

        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 {
View Full Code Here

    public OMElement serialize(ExtensibleConfiguration configuration,
                               XPathSerializer xPathSerializer,
                               OMElement parent) {

        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);
        }

        if (key != null && !"".equals(key)) {
            sourceOmElement.addAttribute(OM_FACTORY.createOMAttribute(
View Full Code Here

        OMElement prop = OM_FACTORY.createOMElement("property", OmNamespace);
        if (property.getName() != null) {
            prop.addAttribute(OM_FACTORY.createOMAttribute("name", NULL_NS, property.getName()));
        } else {
            throw new LoggedRuntimeException("Property name missing", log);
        }

        if (property.getValue() != null) {
            prop.addAttribute(OM_FACTORY.createOMAttribute("value", NULL_NS, property.getValue()));

        } else if (property.getExpression() != null) {
            xPathSerializer.serializeXPath(property.getExpression(), prop, "expression");

        } else {
            throw new LoggedRuntimeException("Property must have a literal" +
                    " value or be an expression", log);
        }
        return prop;
    }
View Full Code Here

                    attributeName, nullNS, xpath.toString()));

            serializeNameSpaces(element, xpath);

        } else {
            throw new LoggedRuntimeException("Couldn't find the xpath in the AXIOMXPath", log);
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.rulecep.commons.LoggedRuntimeException

Copyright © 2018 www.massapicom. 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.