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.AbstractMuleBeanDefinitionParser; |
14 | |
import org.mule.config.spring.parsers.MuleDefinitionParser; |
15 | |
import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser; |
16 | |
import org.mule.config.spring.parsers.generic.ChildDefinitionParser; |
17 | |
import org.mule.config.spring.parsers.processors.BlockAttribute; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
public class TransactionDefinitionParser extends AbstractSingleParentFamilyDefinitionParser |
24 | |
{ |
25 | |
|
26 | |
public static final String FACTORY = "factory"; |
27 | |
public static final String FACTORY_REF = FACTORY + "-ref"; |
28 | |
public static final String FACTORY_CLASS = FACTORY + "-" + AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS; |
29 | |
public static final String ACTION = "action"; |
30 | |
public static final String TIMEOUT = "timeout"; |
31 | |
|
32 | |
public TransactionDefinitionParser() |
33 | 0 | { |
34 | 0 | commonInit(null); |
35 | 0 | } |
36 | |
|
37 | |
public TransactionDefinitionParser(Class factoryClass) |
38 | 0 | { |
39 | 0 | commonInit(factoryClass); |
40 | 0 | MuleDefinitionParser factoryParser = getDelegate(1); |
41 | |
|
42 | 0 | factoryParser.registerPreProcessor(new BlockAttribute(new String[]{FACTORY_CLASS, FACTORY_REF})); |
43 | 0 | } |
44 | |
|
45 | |
private void commonInit(Class factoryClass) |
46 | |
{ |
47 | 0 | addDelegate(new TransactionConfigDefinitionParser()) |
48 | |
.setIgnoredDefault(true) |
49 | |
.removeIgnored(FACTORY_REF) |
50 | |
.removeIgnored(ACTION) |
51 | |
.removeIgnored(TIMEOUT); |
52 | 0 | addDelegateAsChild(new ChildDefinitionParser(FACTORY, factoryClass)) |
53 | |
.setIgnoredDefault(false) |
54 | |
.addIgnored(FACTORY_REF) |
55 | |
.addIgnored(ACTION) |
56 | |
.addIgnored(TIMEOUT) |
57 | |
.addAlias(FACTORY_CLASS, AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS) |
58 | |
|
59 | |
.registerPreProcessor(new BlockAttribute(FACTORY)); |
60 | 0 | addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); |
61 | 0 | addHandledException(BlockAttribute.BlockAttributeException.class); |
62 | 0 | } |
63 | |
|
64 | |
} |