View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.jdbc.xa;
8   
9   import java.lang.reflect.InvocationHandler;
10  import java.lang.reflect.InvocationTargetException;
11  import java.lang.reflect.Method;
12  import java.sql.Statement;
13  
14  
15  public class StatementInvocationHandler implements InvocationHandler
16  {
17  
18      private Statement statement;
19  
20      public StatementInvocationHandler(ConnectionWrapper connectionWrapper, Statement statement)
21      {
22          this.statement = statement;
23      }
24  
25      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
26      {
27          try
28          {
29              return method.invoke(statement, args);
30          }
31          catch (InvocationTargetException ex)
32          {
33              throw ex.getCause();
34          }
35      }
36  
37  }