Coverage Report - org.mule.extras.spring.config.MuleApplicationContext
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleApplicationContext
0%
0/22
0%
0/3
1.286
 
 1  
 /*
 2  
  * $Id: MuleApplicationContext.java 7976 2007-08-21 14:26:13Z 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.extras.spring.config;
 12  
 
 13  
 import java.io.IOException;
 14  
 
 15  
 import org.springframework.beans.BeansException;
 16  
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 17  
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 18  
 import org.springframework.context.support.AbstractXmlApplicationContext;
 19  
 import org.springframework.core.io.Resource;
 20  
 
 21  
 /**
 22  
  * <code>MuleApplicationContext</code> is A Simple extension Application context
 23  
  * that allows rosurces to be loaded from the Classpath of file system using the
 24  
  * MuleBeanDefinitionReader.
 25  
  * 
 26  
  * @see MuleBeanDefinitionReader
 27  
  */
 28  
 public class MuleApplicationContext extends AbstractXmlApplicationContext
 29  
 {
 30  
     private final Resource[] configResources;
 31  
     private final String[] configLocations;
 32  
 
 33  
     public MuleApplicationContext(Resource[] configResources)
 34  
     {
 35  0
         this(configResources, true);
 36  0
     }
 37  
 
 38  
     public MuleApplicationContext(Resource[] configResources, boolean refresh) throws BeansException
 39  0
     {
 40  0
         this.configResources = configResources;
 41  0
         this.configLocations = null;
 42  0
         if (refresh)
 43  
         {
 44  0
             refresh();
 45  
         }
 46  0
     }
 47  
 
 48  
     public MuleApplicationContext(String[] configLocations)
 49  
     {
 50  0
         this(configLocations, true);
 51  0
     }
 52  
 
 53  
     public MuleApplicationContext(String[] configLocations, boolean refresh) throws BeansException
 54  0
     {
 55  0
         this.configLocations = configLocations;
 56  0
         this.configResources = null;
 57  0
         if (refresh)
 58  
         {
 59  0
             refresh();
 60  
         }
 61  0
     }
 62  
 
 63  
     //@Override
 64  
     protected Resource[] getConfigResources() 
 65  
     {
 66  0
         return configResources;
 67  
     }
 68  
     
 69  
     //@Override
 70  
     protected String[] getConfigLocations()
 71  
     {
 72  0
         return configLocations;
 73  
     }
 74  
 
 75  
     //@Override
 76  
     protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException 
 77  
     {
 78  0
         XmlBeanDefinitionReader beanDefinitionReader = new MuleBeanDefinitionReader(beanFactory,
 79  
             configResources != null ? configResources.length : configLocations.length);
 80  
 
 81  0
         initBeanDefinitionReader(beanDefinitionReader);
 82  0
         loadBeanDefinitions(beanDefinitionReader);
 83  0
     }
 84  
 }