1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.config.spring.parsers.specific; |
12 | |
|
13 | |
import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; |
14 | |
import org.mule.config.spring.parsers.processors.ProvideDefaultName; |
15 | |
|
16 | |
import org.springframework.beans.factory.support.BeanDefinitionBuilder; |
17 | |
import org.springframework.beans.factory.xml.ParserContext; |
18 | |
import org.w3c.dom.Element; |
19 | |
|
20 | |
public class ServiceDefinitionParser extends OrphanDefinitionParser |
21 | |
{ |
22 | |
|
23 | |
|
24 | |
public ServiceDefinitionParser() |
25 | |
{ |
26 | 0 | super(true); |
27 | 0 | registerPreProcessor(new ProvideDefaultName("service")); |
28 | 0 | } |
29 | |
|
30 | |
public ServiceDefinitionParser(Class clazz) |
31 | |
{ |
32 | 0 | super(clazz, true); |
33 | 0 | registerPreProcessor(new ProvideDefaultName("service")); |
34 | 0 | } |
35 | |
|
36 | |
|
37 | |
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) |
38 | |
{ |
39 | 0 | Element parent = (Element) element.getParentNode(); |
40 | 0 | String modelName = parent.getAttribute(ATTRIBUTE_NAME); |
41 | 0 | builder.addPropertyReference("model", modelName); |
42 | 0 | super.doParse(element, parserContext, builder); |
43 | 0 | } |
44 | |
|
45 | |
} |