KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > extras > spring > config > MuleApplicationContext


1 /*
2  * $Id: MuleApplicationContext.java 3798 2006-11-04 04:07:14Z aperepel $
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 MuleSource MPL
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 JavaDoc;
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
20 /**
21  * <code>MuleApplicationContext</code> is A Simple extension Application context
22  * that allows rosurces to be loaded from the Classpath of file system using the
23  * MuleBeanDefinitionReader.
24  *
25  * @see MuleBeanDefinitionReader
26  */

27 public class MuleApplicationContext extends AbstractXmlApplicationContext
28 {
29     private final String JavaDoc[] configLocations;
30
31     public MuleApplicationContext(String JavaDoc configLocation)
32     {
33         this(new String JavaDoc[]{configLocation});
34     }
35
36     public MuleApplicationContext(String JavaDoc[] configLocations)
37     {
38         this(configLocations, true);
39     }
40
41     public MuleApplicationContext(String JavaDoc[] configLocations, boolean refresh) throws BeansException
42     {
43         this.configLocations = configLocations;
44         if (refresh)
45         {
46             refresh();
47         }
48     }
49
50     protected String JavaDoc[] getConfigLocations()
51     {
52         return configLocations;
53     }
54
55     protected void initBeanDefinitionReader(XmlBeanDefinitionReader xmlBeanDefinitionReader)
56     {
57         super.initBeanDefinitionReader(xmlBeanDefinitionReader);
58     }
59
60     protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException JavaDoc
61     {
62         XmlBeanDefinitionReader beanDefinitionReader = new MuleBeanDefinitionReader(beanFactory,
63             configLocations.length);
64         initBeanDefinitionReader(beanDefinitionReader);
65         loadBeanDefinitions(beanDefinitionReader);
66     }
67 }
68
Popular Tags