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