Examples of ReturnValue


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

            MessageContext messageContext = ((MessageContext) message);
            OMElement returnElement = messageContext.getEnvelope().getBody().getFirstElement();
            if (returnElement == null) {
                returnElement = messageContext.getEnvelope().getBody();
            }
            return new ReturnValue(returnElement, true);
        }
        return null;
    }
View Full Code Here

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

    public ReturnValue extractEnvelope(Object message) {

        if (message instanceof MessageContext) {
            MessageContext messageContext = ((MessageContext) message);
            return new ReturnValue(messageContext.getEnvelope(), true);
        }
        throw new LoggedRuntimeException("Invalid context object, expected Synapse Message Context",
                log);
    }
View Full Code Here

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

        String key = description.getKey();

        // if the key provides , then it should be a property key or entry key
        if (key != null) {
            // On the first check the availability of the key in property bag
            ReturnValue returnValue = messageInterceptor.extract(key, context, null);
            if (returnValue != null) {
                value = returnValue.getValue();
            }
        }
        if (value == null) {
            value = evaluateExpression(description, context, messageInterceptor);
            if (value == null) {
                ReturnValue returnValue = messageInterceptor.extractPayload(context);
                if (returnValue != null) {
                    value = returnValue.getValue();
                }
            }
        }
        return value;
    }
View Full Code Here

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

        Object targetNode = ResourceDescriptionEvaluator.evaluateExpression(description,
                context,
                messageInterceptor);

        if (targetNode == null) {
            ReturnValue returnValue = messageInterceptor.extractPayload(context);
            targetNode = returnValue.getValue();
        }

        if (value instanceof OMElement) {
            return false;
        }
View Full Code Here

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

        BaseXPath sourceExpression = description.getExpression();
        if (sourceExpression == null) {
            return null;
        }
        // evaluates the expression against source
        ReturnValue returnValue = messageInterceptor.extract(sourceExpression, context, null);
        Object o = returnValue.getValue();
        if (o instanceof OMNode) {
            return o;

        } else if (o instanceof List && !((List) o).isEmpty()) {
            Object nodeObject = ((List) o).get(0); // Always fetches *only* the first
View Full Code Here

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

            if (context == null) {
                throw new LoggedRuntimeException("Invalid property - a value cannot be found" +
                        " for property : " + name, log);
            }
            ReturnValue returnValue = messageInterceptor.extract(
                    propertyDescription.getExpression(),
                    context, value);
            value = returnValue.getValue();
        }

        if (value == null || "".equals(value)) {
            throw new LoggedRuntimeException("Invalid property - a value cannot be found " +
                    "for property : " + name, log);
View Full Code Here

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

        Object targetNode = ResourceDescriptionEvaluator.evaluateExpression(description,
                context,
                messageInterceptor);

        if (targetNode == null) {
            ReturnValue returnValue = messageInterceptor.extractPayload(context);
            targetNode = returnValue.getValue();
        }

        if (targetNode instanceof SOAPBody) {
            ((SOAPBody) targetNode).addChild((OMNode) value);
        } else if (targetNode instanceof OMElement) {
View Full Code Here

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

        Object targetNode = ResourceDescriptionEvaluator.evaluateExpression(description,
                context,
                messageInterceptor);

        if (targetNode == null) {
            ReturnValue returnValue = messageInterceptor.extractPayload(context);
            targetNode = returnValue.getValue();
        }
        if (!(targetNode instanceof OMElement)) {
            throw new LoggedRuntimeException("The target node should have been an OMNode", log);
        }
View Full Code Here

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

        Object targetNode = ResourceDescriptionEvaluator.evaluateExpression(description,
                context,
                messageInterceptor);

        if (targetNode == null) {
            ReturnValue returnValue = messageInterceptor.extractPayload(context);
            targetNode = returnValue.getValue();
        }

        if (targetNode instanceof OMElement) {
            OMElement targetOMNode = (OMElement) targetNode;
            targetOMNode.insertSiblingAfter(ElementHelper.importOMElement(
View Full Code Here

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

     * @return A Value located by the key or default value
     */
    public ReturnValue extract(String key, Object source, Object defaultValue) {

        if (source instanceof MessageContext) {
            return new ReturnValue(((MessageContext) source).getProperty(key));
        }

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        if (log.isDebugEnabled()) {
            log.debug("Loading a file ' " + key + " ' from class-path");
        }

        InputStream in = cl.getResourceAsStream(key);
        if (in == null) {
            if (log.isDebugEnabled()) {
                log.debug("Unable to load file  ' " + key + " ' from class-path. " +
                        "Returning given default value");
            }
            return new ReturnValue(defaultValue);
        }
        return new ReturnValue(in);
    }
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.