Coverage report

  %line %branch
net.sf.infrared.aspects.jdbc.JdbcAspect
0% 
0% 

 1  
 /* 
 2  
  * Copyright 2005 Tavant Technologies and Contributors
 3  
  * 
 4  
  * Licensed under the Apache License, Version 2.0 (the "License")
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  * 
 16  
  *
 17  
  *
 18  
  * Original Author:  binil.thomas (Tavant Technologies)
 19  
  * Contributor(s):   -;
 20  
  *
 21  
  */
 22  
 package net.sf.infrared.aspects.jdbc;
 23  
 
 24  
 import java.sql.Connection;
 25  
 import java.sql.SQLException;
 26  
 
 27  
 import net.sf.infrared.aspects.jdbc.p6spy.InfraREDP6Connection;
 28  
 import net.sf.infrared.aspects.jdbc.p6spy.InfraREDP6Factory;
 29  
 import net.sf.infrared.base.util.LoggingFactory;
 30  
 
 31  
 import org.apache.log4j.Logger;
 32  
 import org.codehaus.aspectwerkz.AspectContext;
 33  
 import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint;
 34  
 
 35  
 /**
 36  
  * 
 37  
  * @author binil.thomas
 38  
  */
 39  
 public class JdbcAspect {
 40  
     private InfraREDP6Factory factory;
 41  
 
 42  0
     private Logger log = LoggingFactory.getLogger(JdbcAspect.class);
 43  
 
 44  0
     public JdbcAspect(AspectContext actx) {
 45  0
         factory = new InfraREDP6Factory();
 46  0
     }
 47  
 
 48  
     public Object aroundGetConnection(StaticJoinPoint jp) throws Throwable {
 49  0
         Connection con = (Connection) jp.proceed();
 50  0
         if (!(con instanceof InfraREDP6Connection)) {            
 51  
             try {
 52  0
                 con = factory.getConnection(con);
 53  0
                 if (log.isDebugEnabled()) {
 54  0
                     log.debug("Wrapped Connection with the Infrared P6 connection " + con);
 55  
                 }
 56  0
             } catch (SQLException sqlex) {
 57  0
                 log.error("Failed to wrap Connection with the Infrared P6 connection", sqlex);
 58  0
             }
 59  
         }
 60  0
         return con;
 61  
     }
 62  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.