1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.mule.config.spring.parsers.generic; |
11 | |
|
12 | |
import org.mule.config.spring.util.SpringXMLUtils; |
13 | |
|
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 | |
|
20 | |
|
21 | |
public class MuleOrphanDefinitionParser extends OrphanDefinitionParser |
22 | |
{ |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public MuleOrphanDefinitionParser(boolean singleton) |
28 | |
{ |
29 | 0 | super(singleton); |
30 | 0 | } |
31 | |
|
32 | |
public MuleOrphanDefinitionParser(Class beanClass, boolean singleton) |
33 | |
{ |
34 | 0 | super(beanClass, singleton); |
35 | 0 | } |
36 | |
|
37 | |
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) |
38 | |
{ |
39 | 0 | assertMuleParent(element); |
40 | 0 | return super.parseInternal(element, parserContext); |
41 | |
} |
42 | |
|
43 | |
protected void assertMuleParent(Element element) |
44 | |
{ |
45 | 0 | if (!isTopLevel(element)) |
46 | |
{ |
47 | 0 | throw new IllegalStateException("This element should be embedded inside the Mule <" |
48 | |
+ ROOT_ELEMENT + "> element: " + SpringXMLUtils.elementToString(element)); |
49 | |
} |
50 | 0 | } |
51 | |
|
52 | |
} |