1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.spring.interceptor;
12
13 import org.mule.api.interceptor.Interceptor;
14 import org.mule.api.MuleMessage;
15
16 import org.aopalliance.intercept.MethodInterceptor;
17 import org.aopalliance.intercept.MethodInvocation;
18
19
20
21
22
23
24
25 public class InterceptorAdapter implements MethodInterceptor
26 {
27
28 private Interceptor interceptor;
29
30 public Object invoke(MethodInvocation invocation) throws Throwable
31 {
32 InvocationAdapter adapter = new InvocationAdapter(invocation);
33 MuleMessage message = interceptor.intercept(adapter);
34 if (null == message)
35 {
36 return adapter.getResult();
37 }
38 else
39 {
40 return message;
41 }
42 }
43
44 public void setInterceptor(Interceptor interceptor)
45 {
46 this.interceptor = interceptor;
47 }
48
49 }