Package org.mule.expression

Source Code of org.mule.expression.MessageHeaderExpressionEnricher

/*
* $Id: MessageHeaderExpressionEnricher.java 20273 2010-11-19 12:52:55Z dirk.olmes $
* --------------------------------------------------------------------------------------
* Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
*
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/

package org.mule.expression;

import org.mule.api.MuleMessage;
import org.mule.api.expression.ExpressionEnricher;
import org.mule.api.transport.PropertyScope;

public class MessageHeaderExpressionEnricher implements ExpressionEnricher
{

    public static final String NAME = "header";

    public void enrich(String expression, MuleMessage message, Object object)
    {
        String propertyName = expression;
        PropertyScope scope = ExpressionUtils.getScope(expression);
        if (scope != null)
        {
            // cut-off leading scope and separator
            propertyName = expression.substring(scope.getScopeName().length() + 1);
        }
        else
        {
            // default
            scope = PropertyScope.OUTBOUND;
        }

        message.setProperty(propertyName, object, scope);
    }

    public String getName()
    {
        return NAME;
    }

    public void setName(String name)
    {
        throw new UnsupportedOperationException();
    }

}
TOP

Related Classes of org.mule.expression.MessageHeaderExpressionEnricher

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.