com.frameworkset.orm.transaction.TXDataSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bboss-persistent Show documentation
Show all versions of bboss-persistent Show documentation
bboss is a j2ee framework include aop/ioc,mvc,persistent,taglib,rpc,event ,bean-xml serializable and so on.http://www.bbossgroups.com
The newest version!
/*
* Copyright 2008 biaoping.yin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.frameworkset.orm.transaction;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;
import javax.sql.DataSource;
import com.frameworkset.common.poolman.util.JDBCPool;
import com.frameworkset.common.poolman.util.SQLUtil;
/**
*
* Title: TXDatasource.java
*
* Description: 获取事务性数据源
*
* Copyright: Copyright (c) 2007
* @Date 2012-4-14 上午08:52:55
* @author biaoping.yin
* @version 1.0
*/
public class TXDataSource implements DataSource{
private DataSource datasource;
private JDBCPool pool;
public TXDataSource(DataSource datasource,JDBCPool pool) {
this.datasource = datasource;
this.pool = pool;
}
public String getDatabaseSchema(DatabaseMetaData databaseMetaData) throws Throwable
{
return this.pool.getDatabaseSchema(databaseMetaData);
}
public Connection getConnection() throws SQLException {
// TODO Auto-generated method stub
return SQLUtil.getConectionFromDatasource(datasource);
}
/**
* 本方法不具备事务性
*/
public Connection getConnection(String username, String password)
throws SQLException {
// TODO Auto-generated method stub
return datasource.getConnection(username, password);
}
public PrintWriter getLogWriter() throws SQLException {
// TODO Auto-generated method stub
return datasource.getLogWriter();
}
public void setLogWriter(PrintWriter out) throws SQLException {
// TODO Auto-generated method stub
}
public void setLoginTimeout(int seconds) throws SQLException {
// TODO Auto-generated method stub
}
public int getLoginTimeout() throws SQLException {
// TODO Auto-generated method stub
return datasource.getLoginTimeout();
}
public DataSource getSRCDataSource()
{
return this.datasource;
}
public T unwrap(Class iface) throws SQLException {
// TODO Auto-generated method stub
return this.datasource.unwrap(iface);
}
public boolean isWrapperFor(Class> iface) throws SQLException {
// TODO Auto-generated method stub
return this.datasource.isWrapperFor(iface);
}
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
// TODO Auto-generated method stub
return this.datasource.getParentLogger();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy