Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ConfigurationChildDefinitionParser |
|
| 2.0;2 |
1 | /* | |
2 | * $Id: ConfigurationChildDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ | |
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.config.spring.parsers.specific; | |
12 | ||
13 | import org.mule.api.config.MuleProperties; | |
14 | import org.mule.config.spring.parsers.generic.ChildDefinitionParser; | |
15 | ||
16 | import org.w3c.dom.Element; | |
17 | ||
18 | /** | |
19 | * Extend {@link org.mule.config.spring.parsers.generic.ChildDefinitionParser} to include | |
20 | * logic for identifying parent configuration element (since this only applies to "default" | |
21 | * elements there's an ugliness here - contradicitions (non-default children of configuration) | |
22 | * are avoided by the mule.xsd schema). | |
23 | */ | |
24 | public class ConfigurationChildDefinitionParser extends ChildDefinitionParser | |
25 | { | |
26 | ||
27 | /** Name of the mule:configuration element **/ | |
28 | public static final String CONFIGURATION = "configuration"; | |
29 | ||
30 | public ConfigurationChildDefinitionParser(String setterMethod, Class clazz) | |
31 | { | |
32 | 0 | super(setterMethod, clazz); |
33 | 0 | } |
34 | ||
35 | protected String getParentBeanName(Element element) | |
36 | { | |
37 | //The mule:configuration element is a fixed name element so we need to handle the | |
38 | //special case here | |
39 | 0 | if (CONFIGURATION.equals(element.getParentNode().getLocalName())) |
40 | { | |
41 | 0 | return MuleProperties.OBJECT_MULE_CONFIGURATION; |
42 | } | |
43 | else | |
44 | { | |
45 | 0 | return super.getParentBeanName(element); |
46 | } | |
47 | } | |
48 | ||
49 | } |