Package org.apache.axiom.om.xpath

Examples of org.apache.axiom.om.xpath.AXIOMXPath


                faultMediator.setFaultCodeValue(
                    new QName(OMElementUtils.getNameSpaceWithPrefix(prefix, code), name, prefix));
               
            } else if (expression != null) {
                try {
                    AXIOMXPath xp = new AXIOMXPath(expression.getAttributeValue());
                    OMElementUtils.addNameSpaces(xp, code, log);
                    faultMediator.setFaultCodeExpr(xp);
                } catch (JaxenException je) {
                    String msg = "Invalid fault code expression : " + je.getMessage();
                    log.error(msg);
                    throw new SynapseException(msg, je);
                }
            } else {
                String msg = "A 'value' or 'expression' attribute must specify the fault code";
                log.error(msg);
                throw new SynapseException(msg);
            }

        } else {
            String msg = "The fault code is a required attribute for the makefault mediator";
            log.error(msg);
            throw new SynapseException(msg);
        }

        OMElement reason = elem.getFirstChildWithName(REASON_Q);
        if (reason != null) {
            OMAttribute value = reason.getAttribute(ATT_VALUE);
            OMAttribute expression = reason.getAttribute(ATT_EXPRN);

            if (value != null) {
                faultMediator.setFaultReasonValue(value.getAttributeValue());
            } else if (expression != null) {
                try {
                    AXIOMXPath xp = new AXIOMXPath(expression.getAttributeValue());
                    OMElementUtils.addNameSpaces(xp, reason, log);
                    faultMediator.setFaultReasonExpr(xp);

                } catch (JaxenException je) {
                    String msg = "Invalid fault reason expression : " + je.getMessage();
View Full Code Here


        }

        OMAttribute expression = elem.getAttribute(ATT_EXPRN);
        if (expression != null) {
            try {
                AXIOMXPath xp = new AXIOMXPath(expression.getAttributeValue());
                OMElementUtils.addNameSpaces(xp, elem, log);
                mediator.setExpression(xp);
            } catch (JaxenException e) {
                handleException("Unable to build the IterateMediator. " + "Invalid XPATH " +
                    expression.getAttributeValue(), e);
            }
        } else {
            handleException("XPATH expression is required " +
                "for an IterateMediator under the \"expression\" attribute");
        }

        OMAttribute attachPath = elem.getAttribute(ATT_ATTACHPATH);
        String attachPathValue = ".";
        if (attachPath != null && !mediator.isPreservePayload()) {
            handleException("Wrong configuration for the iterate mediator :: if the iterator " +
                "should not preserve payload, then attachPath can not be present");
        } else if (attachPath != null) {
            attachPathValue = attachPath.getAttributeValue();
        }
       
        try {
            AXIOMXPath xp = new AXIOMXPath(attachPathValue);
            OMElementUtils.addNameSpaces(xp, elem, log);
            mediator.setAttachPath(xp);
        } catch (JaxenException e) {
            handleException("Unable to build the IterateMediator. Invalid XPATH " +
                attachPathValue, e);
View Full Code Here

        OMElement pool = null;
        // get the 'pool' element and determine if we need to create a DataSource or
        // look up using JNDI
        try {
            AXIOMXPath xpath = new AXIOMXPath("//syn:connection/syn:pool");
            xpath.addNamespace("syn", XMLConfigConstants.SYNAPSE_NAMESPACE);
            pool = (OMElement) xpath.selectSingleNode(elem);

            if (pool.getFirstChildWithName(DRIVER_Q) != null) {
                mediator.setDataSource(createCustomDataSource(pool, mediator));

            } else if (
View Full Code Here

                String xpath = getAttribute(paramElt, ATT_EXPRN);
                String value = getAttribute(paramElt, ATT_VALUE);

                if (xpath != null || value != null) {
                   
                    AXIOMXPath xp = null;
                    if (xpath != null) {
                        try {
                            xp = new AXIOMXPath(xpath);
                            OMElementUtils.addNameSpaces(xp, paramElt, log);

                        } catch (JaxenException e) {
                            handleException("Invalid XPath specified for the source attribute : " +
                                    xpath);
View Full Code Here

                if (propName == null) {
                    handleException(
                        "A POJO command mediator property must specify the name attribute");
                } else {
                    if (child.getAttribute(ATT_EXPRN) != null) {
                        AXIOMXPath xpath = null;
                        try {
                            xpath = new AXIOMXPath(
                                child.getAttribute(ATT_EXPRN).getAttributeValue());
                            OMElementUtils.addNameSpaces(xpath, child, log);
                            pojoMediator.addDynamicProperty(propName, xpath);
                        } catch (JaxenException e) {
                            handleException("Error instantiating XPath expression : " +
View Full Code Here

    private boolean isTimerSet = false;

    public AggregateMediator() {
        try {
            aggregationExpression = new AXIOMXPath("s11:Body/child::*[position()=1] | " +
                "s12:Body/child::*[position()=1]");
            aggregationExpression.addNamespace("s11", SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
            aggregationExpression.addNamespace("s12", SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        } catch (JaxenException e) {
            if (log.isDebugEnabled()) {
View Full Code Here

        }

        if (attSource != null) {
            try {
                transformMediator.setSourceXPathString(attSource.getAttributeValue());
                AXIOMXPath xp = new AXIOMXPath(attSource.getAttributeValue());
                OMElementUtils.addNameSpaces(xp, elem, log);
                transformMediator.setSource(xp);

            } catch (JaxenException e) {
                handleException("Invalid XPath specified for the source attribute : " +
View Full Code Here

        OMElement response = businessClient.sendReceive(commodityPayload());

        assertNotNull(response);

        AXIOMXPath xPath = new AXIOMXPath("//return");
        xPath.addNamespace("ns","http://services.samples/xsd");
        OMElement returnEle = (OMElement) xPath.selectSingleNode(response);

        assertNotNull(returnEle);

        assertEquals(returnEle.getText().trim(),"100");
View Full Code Here

        // set the schema url, source xpath and any name spaces
        List keys = new ArrayList();
        keys.add("xsd-key");
        validate.setSchemaKeys(keys);
        AXIOMXPath source = new AXIOMXPath("//m0:CheckPriceRequest");
        source.addNamespace("m0", "http://services.samples/xsd");
        validate.setSource(source);

        // set dummy mediator to be called on fail
        validate.addChild(testMediator);
View Full Code Here

        // set the schema url, source xpath and any name spaces
        List keys = new ArrayList();
        keys.add("xsd-key-1");
        keys.add("xsd-key-2");
        validate.setSchemaKeys(keys);
        AXIOMXPath source = new AXIOMXPath("//m0:Outer");
        source.addNamespace("m0", "http://services.samples/xsd2");
        validate.setSource(source);

        // set dummy mediator to be called on fail
        validate.addChild(testMediator);
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.xpath.AXIOMXPath

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.