Package org.apache.synapse.util.xpath

Examples of org.apache.synapse.util.xpath.SynapseXPath$ContextWrapper


        usernameCred.setName("username");
        usernameCred.setSourceValue(credentials.getUsernameValue());
        usernameCred.setSourceXPath(credentials.getUsernameXPath());
        /*insert test value*/
        Input testInputUserName = new Input();
        SynapseXPath usernameXpathExpr = null;
        //create xpath expr
        usernameXpathExpr = new SynapseXPath("//ns2:WebRequest/ns2:user");
        usernameXpathExpr.addNamespace("ns2", "http://wso2.org/sample");
        testInputUserName.setSourceXPath(usernameXpathExpr);
        testInputUserName.setName(usernameCred.getName());
        map.put(usernameCred.getName(), testInputUserName);
        credInputsList.add(usernameCred);

        Input passwordCred = new Input();
        passwordCred.setName("password");
        passwordCred.setSourceValue(credentials.getPasswordValue());
        passwordCred.setSourceXPath(credentials.getPasswordXPath());
        /*insert test value*/
        Input testInputPassword = new Input();
        SynapseXPath passwordXpathExpr = new SynapseXPath("//ns27:WebRequest/ns27:pass");
        passwordXpathExpr.addNamespace("ns27", "http://wso2.org/sample");
        testInputPassword.setSourceXPath(passwordXpathExpr);
        testInputPassword.setName(passwordCred.getName());
        map.put(passwordCred.getName(), testInputPassword);
        credInputsList.add(passwordCred);

View Full Code Here


        HashMap map = new HashMap();

        Input detailInput = new Input();
        detailInput.setName("DetailLevel");
        SynapseXPath detailXpathExpr = new SynapseXPath("//ns27:WebRequest/ns27:detail");
        detailXpathExpr.addNamespace("ns27", "http://wso2.org/sample");
        detailInput.setSourceXPath(detailXpathExpr);
        map.put(detailInput.getName(), detailInput);

        Input errorLang = new Input();
        errorLang.setName("ErrorLanguage");
        SynapseXPath errorXpathExpr = new SynapseXPath("//ns2:WebRequest/ns2:errorlang");
        errorXpathExpr.addNamespace("ns2", "http://wso2.org/sample");
        errorLang.setSourceXPath(errorXpathExpr);
        map.put(errorLang.getName(), errorLang);

        List<Input> inputs = operation.getInputs();
        PaypalTestUtil.validateSimpleInputs(map, inputs);
View Full Code Here

     */
    public OMElement handleOutput(OutputType output, MessageContext synCtx,
                                  Object result) {
        String type = output.getType();
        String propertyKey = output.getTargetKey();
        SynapseXPath targetXPath = output.getTargetXPath();
        SynapseXPath srcXPath = output.getSourceXPath();

        if (type == null) {
            log.info("Response handler Types not defined for salesforce.com configuration");
            return null;
        }
View Full Code Here

     *
     * @param outputKey
     * @return
     */
    private boolean checkOutputTypeForProcessing(OutputType outputKey) {
        SynapseXPath srcXPath = outputKey.getSourceXPath();
        SynapseXPath targetXPath = outputKey.getTargetXPath();
        String targetKey = outputKey.getTargetKey();
        if ((srcXPath != null && (targetKey != null && !"".equals(targetKey) || targetXPath != null)) ||
            (targetKey != null && !"".equals(targetKey))) {
            return true;
        }
View Full Code Here

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

                if (xpath != null || value != null) {

                    SynapseXPath xp = null;
                    if (xpath != null) {
                        try {
                            xp = SynapseXPathFactory.getSynapseXPath(paramElt, ATT_EXPRN);

                        } catch (JaxenException e) {
View Full Code Here

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

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

            } else if (pool.getFirstChildWithName(DSNAME_Q) != null) {
View Full Code Here

     * @return SynapseXpath
     */
    public SynapseXPath getExpression() {
        if(expression == null && keyValue != null && hasExprTypeKey()){
            try {
                expression = new SynapseXPath(keyValue.substring(1, keyValue.length()-1));
                for (OMNamespace aNamespaceList : namespaceList) {
                    expression.addNamespace(aNamespaceList);
                }
            } catch (JaxenException e) {
                expression = null;
View Full Code Here

        if (attKey != null) {
            String attributeValue = attKey.getAttributeValue();
            boolean hasEscape = isEscapedExpression(attributeValue);
            if (!hasEscape && isDynamicKey(attributeValue)) {
                /** dynamic key */
                SynapseXPath synXpath = createSynXpath(elem, attributeValue);
                key = new Value(synXpath);
            } else if (hasEscape) {
                /** escaped expr */
                key = new Value(getEscapedExpression(attributeValue));
                key.setNamespaces(elem);
View Full Code Here

     */
    public SynapseXPath createSynXpath(OMElement elem, String key) {
        //derive XPath Expression from key
        String xpathExpr = key.trim().substring(1, key.length() - 1);

        SynapseXPath synapseXPath = null;

        try {
            synapseXPath = SynapseXPathFactory.getSynapseXPath(elem, xpathExpr);
        } catch (JaxenException e) {
            handleException("Can not create Synapse Xpath from given key");
View Full Code Here

    public BaseXPath createXPath(String xpath, Collection<OMNamespace> omNameSpaces) {
        if (xpath == null || "".equals(xpath)) {
            throw new LoggedRuntimeException("XPath expression is null or empty", log);
        }
        try {
            SynapseXPath synapseXPath = new SynapseXPath(xpath);
            for (OMNamespace omNamespace : omNameSpaces) {
                if (omNamespace != null) {
                    synapseXPath.addNamespace(omNamespace.getPrefix(), omNamespace.getNamespaceURI());
                }
            }
            return synapseXPath;
        } catch (JaxenException e) {
            throw new LoggedRuntimeException("Invalid XPapth expression : " +
View Full Code Here

TOP

Related Classes of org.apache.synapse.util.xpath.SynapseXPath$ContextWrapper

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.