Package org.mule.el.context

Examples of org.mule.el.context.MessageContext


    @Override
    public Object call(Object[] params, ExpressionLanguageContext context)
    {
        validateParams(params);

        final MessageContext ctx = context.getVariable("message");
        final String xpathExpression = getXpathExpression(params);
        final XPathReturnType returnType = getReturnType(params);
        final MuleEvent event = getMuleEvent(context);
        final Object input = getInput(params, event);

        try
        {
            Node node = toDOMNode(input, event);
            Object result = xpathEvaluatorSupplier.get().evaluate(xpathExpression, node, returnType, event);

            MuleMessage message = event.getMessage();
            if (input == message.getPayload() && ((DefaultMuleMessage) message).isConsumable())
            {
                ctx.setPayload(node);
            }

            return result;
        }
        catch (Exception e)
View Full Code Here


        deprecationWarning.warn();

        this.validateParams(params);

        final MessageContext ctx = context.getVariable("message");
        final String xpathExpression = this.getXpathExpression(params);
        final boolean hasCustomPayload = this.hasCustomPayload(params);

        MuleMessage muleMessage = context.getVariable(MVELExpressionLanguageContext.MULE_MESSAGE_INTERNAL_VARIABLE);

        if (hasCustomPayload)
        {
            muleMessage = new DefaultMuleMessage(params[1], muleContext);
        }
        else if (muleMessage == null)
        {
            muleMessage = new DefaultMuleMessage(ctx.getPayload(), muleContext);
        }

        String evaluator = hasCustomPayload ? NODE_EVALUATOR : BRANCH_EVALUATOR;

        try
        {
            Object result = muleContext.getExpressionManager().evaluate(evaluator + xpathExpression, muleMessage);

            if (!hasCustomPayload)
            {
                ctx.setPayload(muleMessage.getPayload());
            }

            return result;
        }
        catch (Exception e)
View Full Code Here

    {
        if (muleMessage != null)
        {
            if (MESSAGE.equals(name))
            {
                return new MuleImmutableVariableResolver<MessageContext>(MESSAGE, new MessageContext(
                    muleMessage), null);
            }
            else if (PAYLOAD.equals(name))
            {
                return new MuleVariableResolver<Object>(PAYLOAD, muleMessage.getPayload(), null,
View Full Code Here

    protected void addMessageToContextWithPayload(String payload) throws TransformerException
    {
        MuleMessage message = Mockito.mock(MuleMessage.class);
        Mockito.when(message.getPayload(Mockito.any(Class.class))).thenReturn(payload);
        context.addFinalVariable("message", new MessageContext(message));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    protected void addMessageToContextWithPayload(String payload) throws TransformerException
    {
        MuleMessage message = Mockito.mock(MuleMessage.class);
        Mockito.when(message.getPayload(Mockito.any(Class.class))).thenReturn(payload);
        context.addFinalVariable("message", new MessageContext(message));
    }
View Full Code Here

TOP

Related Classes of org.mule.el.context.MessageContext

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.