com.jpattern.orm.connection.DataSourceWrapper Maven / Gradle / Ivy
package com.jpattern.orm.connection;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
/**
*
* @author Francesco Cina'
*
* Nov 29, 2011
*/
public class DataSourceWrapper implements DataSource {
private final DataSource dataSource;
public Connection getConnection() throws SQLException {
return new ConnectionWrapper(dataSource.getConnection());
}
public Connection getConnection(String username, String password)
throws SQLException {
return new ConnectionWrapper(dataSource.getConnection(username, password));
}
public PrintWriter getLogWriter() throws SQLException {
return dataSource.getLogWriter();
}
public int getLoginTimeout() throws SQLException {
return dataSource.getLoginTimeout();
}
public boolean isWrapperFor(Class> arg0) throws SQLException {
return dataSource.isWrapperFor(arg0);
}
public void setLogWriter(PrintWriter arg0) throws SQLException {
dataSource.setLogWriter(arg0);
}
public void setLoginTimeout(int arg0) throws SQLException {
dataSource.setLoginTimeout(arg0);
}
public T unwrap(Class arg0) throws SQLException {
return dataSource.unwrap(arg0);
}
public DataSourceWrapper(DataSource dataSource) {
this.dataSource = dataSource;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy