FileDocCategorySizeDatePackage
ConnectionWrapper.javaAPI DocExample7969Thu Jun 28 16:14:16 BST 2001com.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
1.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 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 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.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 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 voidrollback()
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.rollback();
    
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 voidsetReadOnly(boolean readOnly)
Calls the corresponding method on the wrapped Connection.

        if (isClosed) {
            throw new SQLException("Pooled connection is closed");
        }
        realConn.setReadOnly(readOnly);
    
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);