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  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.config.spring;
 8  
 
 9  
 import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
 10  
 import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
 11  
 import org.springframework.beans.factory.xml.XmlReaderContext;
 12  
 import org.springframework.util.StringUtils;
 13  
 import org.w3c.dom.Element;
 14  
 
 15  
 /**
 16  
  * Allows us to hook in our own Hierarchical Parser delegate. this enables the
 17  
  * parsing of custom spring bean elements nested within each other
 18  
  */
 19  0
 public class MuleBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader
 20  
 {
 21  
 
 22  
     protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root)
 23  
     {
 24  0
         BeanDefinitionParserDelegate delegate = new MuleHierarchicalBeanDefinitionParserDelegate(readerContext, this);
 25  0
         delegate.initDefaults(root);
 26  0
         return delegate;
 27  
     }
 28  
 
 29  
     /**
 30  
      * Override to reject configuration files with no namespace, e.g. mule legacy
 31  
      * configuration file.
 32  
      */
 33  
     protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate)
 34  
     {
 35  0
         if (!StringUtils.hasLength(root.getNamespaceURI()))
 36  
         {
 37  0
             getReaderContext().error("Unable to locate NamespaceHandler for namespace [null]", root);
 38  
         }
 39  
         else
 40  
         {
 41  0
             super.parseBeanDefinitions(root, delegate);
 42  
         }
 43  0
     }
 44  
 
 45  
 }