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