FileDocCategorySizeDatePackage
ConnectionWrapper.javaAPI DocExample12303Tue Feb 28 11:34:06 GMT 2006com.ora.jsp.sql

ConnectionWrapper

public class ConnectionWrapper extends Object implements Connection
This class is a wrapper around a Connection, overriding the close method to just inform the DataSourceWrapper that it's available for reuse again, and the isClosed method to return the state of the wrapper instead of the Connection.
author
Hans Bergsten, Gefion software
version
2.0

Fields Summary
private Connection
realConn
private DataSourceWrapper
dsw
private boolean
isClosed
Constructors Summary
public ConnectionWrapper(Connection realConn, DataSourceWrapper dsw)


         
        this.realConn = realConn;
        this.dsw = dsw;
    
Methods Summary
public voidclearWarnings()

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.clearWarnings();
    
public voidclose()
Inform the DataSourceWrapper that the ConnectionWrapper is closed.

        isClosed = true;
        dsw.returnConnection(realConn);
    
public voidcommit()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.commit();
    
public java.sql.StatementcreateStatement()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.createStatement();
    
public java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.createStatement(resultSetType, resultSetConcurrency);
    
public java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.createStatement(resultSetType, resultSetConcurrency,
	    resultSetHoldability);
    
public booleangetAutoCommit()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.getAutoCommit();
    
public java.lang.StringgetCatalog()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.getCatalog();
    
public intgetHoldability()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.getHoldability();
    
public java.sql.DatabaseMetaDatagetMetaData()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.getMetaData();
    
public intgetTransactionIsolation()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.getTransactionIsolation();
    
public java.util.MapgetTypeMap()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.getTypeMap();
    
public java.sql.SQLWarninggetWarnings()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.getWarnings();
    
public booleanisClosed()
Returns true if the ConnectionWrapper is closed, false otherwise.

        return isClosed;
    
public booleanisReadOnly()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.isReadOnly();
    
public java.lang.StringnativeSQL(java.lang.String sql)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.nativeSQL(sql);
    
public java.sql.CallableStatementprepareCall(java.lang.String sql)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.prepareCall(sql);
    
public java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.prepareCall(sql, resultSetType, resultSetConcurrency);
    
public java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.prepareCall(sql, resultSetType, resultSetConcurrency,
            resultSetHoldability);
    
public java.sql.PreparedStatementprepareStatement(java.lang.String sql)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.prepareStatement(sql);
    
public java.sql.PreparedStatementprepareStatement(java.lang.String sql, int autoGeneratedKeys)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.prepareStatement(sql, autoGeneratedKeys);
    
public java.sql.PreparedStatementprepareStatement(java.lang.String sql, int[] columnIndexes)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.prepareStatement(sql, columnIndexes);
    
public java.sql.PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] columnNames)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.prepareStatement(sql, columnNames);
    
public java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.prepareStatement(sql, resultSetType, 
	    resultSetConcurrency);
    
public java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.prepareStatement(sql, resultSetType, 
	    resultSetConcurrency, resultSetHoldability);
    
public voidreleaseSavepoint(java.sql.Savepoint savepoint)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.releaseSavepoint(savepoint);
    
public voidrollback()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.rollback();
    
public voidrollback(java.sql.Savepoint savepoint)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.rollback(savepoint);
    
public voidsetAutoCommit(boolean autoCommit)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.setAutoCommit(autoCommit);
    
public voidsetCatalog(java.lang.String catalog)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.setCatalog(catalog);
    
public voidsetHoldability(int holdability)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.setHoldability(holdability);
    
public voidsetReadOnly(boolean readOnly)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.setReadOnly(readOnly);
    
public java.sql.SavepointsetSavepoint()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.setSavepoint();
    
public java.sql.SavepointsetSavepoint(java.lang.String name)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        return realConn.setSavepoint(name);
    
public voidsetTransactionIsolation(int level)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.setTransactionIsolation(level);
    
public voidsetTypeMap(java.util.Map map)

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.setTypeMap(map);