View Javadoc

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