Coverage Report - org.mule.config.spring.MuleBeanDefinitionDocumentReader
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleBeanDefinitionDocumentReader
0%
0/8
0%
0/2
1.5
 
 1  
 /*
 2  
  * $Id: MuleBeanDefinitionDocumentReader.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.config.spring;
 12  
 
 13  
 import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
 14  
 import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
 15  
 import org.springframework.beans.factory.xml.XmlReaderContext;
 16  
 import org.springframework.util.StringUtils;
 17  
 import org.w3c.dom.Element;
 18  
 
 19  
 /**
 20  
  * Allows us to hook in our own Hierarchical Parser delegate. this enables the
 21  
  * parsing of custom spring bean elements nested within each other
 22  
  */
 23  0
 public class MuleBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader
 24  
 {
 25  
 
 26  
     protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root)
 27  
     {
 28  0
         BeanDefinitionParserDelegate delegate = new MuleHierarchicalBeanDefinitionParserDelegate(readerContext, this);
 29  0
         delegate.initDefaults(root);
 30  0
         return delegate;
 31  
     }
 32  
 
 33  
     /**
 34  
      * Override to reject configuration files with no namespace, e.g. mule legacy
 35  
      * configuration file.
 36  
      */
 37  
     protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate)
 38  
     {
 39  0
         if (!StringUtils.hasLength(root.getNamespaceURI()))
 40  
         {
 41  0
             getReaderContext().error("Unable to locate NamespaceHandler for namespace [null]", root);
 42  
         }
 43  
         else
 44  
         {
 45  0
             super.parseBeanDefinitions(root, delegate);
 46  
         }
 47  0
     }
 48  
 
 49  
 }