View Javadoc

1   /*
2    * $Id: InvocationAdapter.java 11130 2008-02-29 15:14:53Z acooke $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.module.spring.interceptor;
12  
13  import org.mule.api.MuleException;
14  import org.mule.interceptor.RequestContextInvocation;
15  import org.mule.interceptor.InterceptorException;
16  
17  import org.aopalliance.intercept.MethodInvocation;
18  
19  public class InvocationAdapter extends RequestContextInvocation
20  {
21  
22      private MethodInvocation invocation;
23      private Object result;
24  
25      public InvocationAdapter(MethodInvocation invocation)
26      {
27          this.invocation = invocation;
28      }
29  
30      public Object execute() throws MuleException
31      {
32          try
33          {
34              result = invocation.proceed();
35              return result;
36          }
37          catch (MuleException e)
38          {
39              throw e;
40          }
41          catch (Throwable e)
42          {
43              throw new InterceptorException(e);
44          }
45      }
46  
47      public Object getResult()
48      {
49          return result;
50      }
51  
52  }