1
2
3
4
5
6
7 package org.mule.config.spring.parsers.specific.endpoint;
8
9 import org.mule.config.spring.parsers.generic.ParentDefinitionParser;
10 import org.mule.config.spring.parsers.processors.CheckExclusiveAttributes;
11 import org.mule.util.StringUtils;
12
13 import org.w3c.dom.Element;
14
15
16
17
18
19
20
21
22
23
24
25 public class EndpointRefParser extends ParentDefinitionParser
26 {
27 public EndpointRefParser(String propertyName)
28 {
29 addAlias("address", propertyName);
30 addAlias("ref", propertyName);
31 addAlias("reference", propertyName);
32 registerPreProcessor(new CheckExclusiveAttributes(new String[][]{new String[]{"ref"}, new String[]{"address"}}));
33 }
34
35
36
37 @Override
38 protected void preProcess(Element element)
39 {
40
41 if(StringUtils.isNotEmpty(element.getAttribute("ref")))
42 {
43 element.setAttribute("reference", element.getAttribute("ref"));
44 element.removeAttribute("ref");
45 }
46 super.preProcess(element);
47
48 }
49 }