View Javadoc
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.parsers.specific;
8   
9   import org.mule.api.config.MuleConfiguration;
10  import org.mule.api.config.MuleProperties;
11  import org.mule.config.spring.parsers.generic.NamedDefinitionParser;
12  
13  import org.springframework.beans.factory.BeanDefinitionStoreException;
14  import org.springframework.beans.factory.support.AbstractBeanDefinition;
15  import org.springframework.beans.factory.xml.ParserContext;
16  import org.w3c.dom.Element;
17  
18  /**
19   * Parses the <mule:configuration> element. If this element appears in multiple Xml config files each will its configuration
20   * to a single {@link MuleConfiguration} object.
21   *
22   * @see MuleConfiguration
23   */
24  public class ConfigurationDefinitionParser extends NamedDefinitionParser
25  {
26      public ConfigurationDefinitionParser()
27      {
28          super(MuleProperties.OBJECT_MULE_CONFIGURATION);
29          singleton=true;
30      }
31  
32      protected Class getBeanClass(Element element)
33      {
34          return MuleConfiguration.class;
35      }
36  
37      @Override
38      protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException
39      {
40          return MuleProperties.OBJECT_MULE_CONFIGURATION;
41      }
42  
43  }