Coverage Report - org.mule.providers.jms.xa.ConsumerProducerInvocationHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
ConsumerProducerInvocationHandler
73%
8/11
75%
3/4
3.5
 
 1  
 /*
 2  
  * $Id: ConsumerProducerInvocationHandler.java 9431 2007-10-29 13:04:36Z aperepel $
 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  
 package org.mule.providers.jms.xa;
 11  
 
 12  
 import java.lang.reflect.InvocationHandler;
 13  
 import java.lang.reflect.InvocationTargetException;
 14  
 import java.lang.reflect.Method;
 15  
 
 16  
 public class ConsumerProducerInvocationHandler implements InvocationHandler
 17  
 {
 18  
 
 19  
     private Object target;
 20  
     private SessionInvocationHandler sessionInvocationHandler;
 21  
 
 22  
     public ConsumerProducerInvocationHandler(SessionInvocationHandler sessionInvocationHandler, Object target)
 23  24
     {
 24  23
         this.sessionInvocationHandler = sessionInvocationHandler;
 25  23
         this.target = target;
 26  24
     }
 27  
 
 28  
     /*
 29  
      * (non-Javadoc)
 30  
      *
 31  
      * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object,
 32  
      *      java.lang.reflect.Method, java.lang.Object[])
 33  
      */
 34  
     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
 35  
     {
 36  50
         if (ConnectionFactoryWrapper.logger.isDebugEnabled())
 37  
         {
 38  0
             ConnectionFactoryWrapper.logger.debug("Invoking " + method);
 39  
         }
 40  49
         if (!method.getName().equals("close"))
 41  
         {
 42  26
             sessionInvocationHandler.enlist();
 43  
         }
 44  
         try
 45  
         {
 46  50
             return method.invoke(target, args);
 47  
         }
 48  0
         catch (InvocationTargetException e)
 49  
         {
 50  0
             throw e.getCause();
 51  
         }
 52  
     }
 53  
 }