1
2
3
4
5
6
7
8
9
10
11 package org.mule.config.spring.parsers.specific;
12
13 import org.mule.api.interceptor.Interceptor;
14 import org.mule.config.spring.parsers.generic.ChildDefinitionParser;
15
16 import org.w3c.dom.Element;
17
18
19
20
21 public class InterceptorDefinitionParser extends ChildDefinitionParser
22 {
23
24 public static final String INTERCEPTOR = "interceptor";
25
26 public InterceptorDefinitionParser(Class interceptor)
27 {
28 super(INTERCEPTOR, interceptor, Interceptor.class);
29 }
30
31
32
33
34 public InterceptorDefinitionParser()
35 {
36 super(INTERCEPTOR, null, Interceptor.class);
37 }
38
39 @Override
40 public String getPropertyName(Element e)
41 {
42 String parentName = e.getParentNode().getLocalName().toLowerCase();
43 if ("flow".equals(parentName) || "inbound".equals(parentName) || "endpoint".equals(parentName)
44 || "inbound-endpoint".equals(parentName) || "outbound-endpoint".equals(parentName)
45 || "async-reply".equals(parentName) || "processor-chain".equals(parentName))
46 {
47 return "messageProcessor";
48 }
49 else
50 {
51 return super.getPropertyName(e);
52
53 }
54 }
55 }