Coverage Report - org.mule.transport.jdbc.xa.DataSourceWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
DataSourceWrapper
0%
0/16
N/A
1
 
 1  
 /*
 2  
  * $Id: DataSourceWrapper.java 12181 2008-06-26 20:05:55Z dirk.olmes $
 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.transport.jdbc.xa;
 12  
 
 13  
 import java.io.PrintWriter;
 14  
 import java.sql.Connection;
 15  
 import java.sql.SQLException;
 16  
 
 17  
 import javax.sql.DataSource;
 18  
 import javax.sql.XADataSource;
 19  
 import javax.transaction.TransactionManager;
 20  
 
 21  
 /**
 22  
  * Using for unification XADataSource and DataSource
 23  
  */
 24  
 public class DataSourceWrapper implements DataSource
 25  
 {
 26  
 
 27  
     private XADataSource xaDataSource;
 28  
 
 29  
     public DataSourceWrapper()
 30  
     {
 31  0
         super();
 32  0
     }
 33  
 
 34  
     public DataSourceWrapper(XADataSource xaDataSource, TransactionManager tm)
 35  0
     {
 36  0
         this.xaDataSource = xaDataSource;
 37  0
     }
 38  
 
 39  
     public int getLoginTimeout() throws SQLException
 40  
     {
 41  0
         return xaDataSource.getLoginTimeout();
 42  
     }
 43  
 
 44  
     public void setLoginTimeout(int seconds) throws SQLException
 45  
     {
 46  0
         xaDataSource.setLoginTimeout(seconds);
 47  0
     }
 48  
 
 49  
     public PrintWriter getLogWriter() throws SQLException
 50  
     {
 51  0
         return xaDataSource.getLogWriter();
 52  
     }
 53  
 
 54  
     public void setLogWriter(PrintWriter out) throws SQLException
 55  
     {
 56  0
         xaDataSource.setLogWriter(out);
 57  0
     }
 58  
 
 59  
     public Connection getConnection() throws SQLException
 60  
     {
 61  0
         return new ConnectionWrapper(xaDataSource.getXAConnection());
 62  
     }
 63  
 
 64  
     public Connection getConnection(String username, String password) throws SQLException
 65  
     {
 66  0
         return new ConnectionWrapper(xaDataSource.getXAConnection(username, password));    
 67  
     }
 68  
 
 69  
     /**
 70  
      * @return Returns the underlying XADataSource.
 71  
      */
 72  
     public XADataSource getXaDataSource()
 73  
     {
 74  0
         return xaDataSource;
 75  
     }
 76  
 
 77  
     /**
 78  
      * @param xads The XADataSource to set.
 79  
      */
 80  
     public void setXaDataSource(XADataSource xads)
 81  
     {
 82  0
         this.xaDataSource = xads;
 83  0
     }
 84  
 
 85  
 }