Coverage Report - org.mule.config.spring.parsers.specific.GlobalPropertyDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
GlobalPropertyDefinitionParser
0%
0/14
0%
0/2
1.333
 
 1  
 /*
 2  
  * $Id: GlobalPropertyDefinitionParser.java 12259 2008-07-09 14:18:28Z 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  
 package org.mule.config.spring.parsers.specific;
 11  
 
 12  
 import org.mule.config.spring.parsers.assembly.BeanAssembler;
 13  
 import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser;
 14  
 
 15  
 import org.springframework.beans.factory.xml.ParserContext;
 16  
 import org.springframework.util.SystemPropertyUtils;
 17  
 import org.w3c.dom.Element;
 18  
 
 19  
 public class GlobalPropertyDefinitionParser extends MuleOrphanDefinitionParser
 20  
 {
 21  0
     private final String VALUE_ATTR = "value";
 22  0
     private final String NAME_ATTR = "name";
 23  
 
 24  
     public GlobalPropertyDefinitionParser()
 25  
     {
 26  0
         super(true);
 27  0
         addIgnored(NAME_ATTR);
 28  0
         addIgnored(VALUE_ATTR);
 29  0
     }
 30  
 
 31  
     protected Class getBeanClass(Element element)
 32  
     {
 33  0
         return String.class;
 34  
     }
 35  
 
 36  
     protected void postProcess(ParserContext context, BeanAssembler assembler, Element element)
 37  
     {
 38  0
         String name = element.getAttribute(NAME_ATTR);
 39  0
         if(name.indexOf(' ') != -1)
 40  
         {
 41  0
             logger.warn("Environment property name should not contain spaces: \"" + name + "\"");
 42  
         }
 43  
 
 44  0
         String value = element.getAttribute(VALUE_ATTR);
 45  0
         assembler.getBean().addConstructorArgValue(SystemPropertyUtils.resolvePlaceholders(value));
 46  0
         super.postProcess(context, assembler, element);
 47  0
     }
 48  
 }