Coverage Report - org.mule.expression.MessageHeaderExpressionEnricher
 
Classes in this File Line Coverage Branch Coverage Complexity
MessageHeaderExpressionEnricher
0%
0/10
0%
0/2
1.667
 
 1  
 /*
 2  
  * $Id: MessageHeaderExpressionEnricher.java 20273 2010-11-19 12:52:55Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.expression;
 12  
 
 13  
 import org.mule.api.MuleMessage;
 14  
 import org.mule.api.expression.ExpressionEnricher;
 15  
 import org.mule.api.transport.PropertyScope;
 16  
 
 17  0
 public class MessageHeaderExpressionEnricher implements ExpressionEnricher
 18  
 {
 19  
 
 20  
     public static final String NAME = "header";
 21  
 
 22  
     public void enrich(String expression, MuleMessage message, Object object)
 23  
     {
 24  0
         String propertyName = expression;
 25  0
         PropertyScope scope = ExpressionUtils.getScope(expression);
 26  0
         if (scope != null)
 27  
         {
 28  
             // cut-off leading scope and separator
 29  0
             propertyName = expression.substring(scope.getScopeName().length() + 1);
 30  
         }
 31  
         else
 32  
         {
 33  
             // default
 34  0
             scope = PropertyScope.OUTBOUND;
 35  
         }
 36  
 
 37  0
         message.setProperty(propertyName, object, scope);
 38  0
     }
 39  
 
 40  
     public String getName()
 41  
     {
 42  0
         return NAME;
 43  
     }
 44  
 
 45  
     public void setName(String name)
 46  
     {
 47  0
         throw new UnsupportedOperationException();
 48  
     }
 49  
 
 50  
 }