FileDocCategorySizeDatePackage
Jdbc40ObjectsFactory.javaAPI DocGlassfish v2 API5874Fri May 04 22:36:06 BST 2007com.sun.gjc.spi.jdbc40

Jdbc40ObjectsFactory

public class Jdbc40ObjectsFactory extends com.sun.gjc.spi.JdbcObjectsFactory
Factory to create jdbc40 connection & datasource

Fields Summary
private boolean
jdbc30Connection
private boolean
initJDBC30Connection
protected static final Logger
_logger
Constructors Summary
Methods Summary
public voiddetectJDBC30Connection(java.sql.Connection con, com.sun.gjc.spi.ManagedConnection mcObject)


        String dataSourceProperty = mcObject.getManagedConnectionFactory().getJdbc30DataSource();
        if (dataSourceProperty != null) {
            setJdbc30Connection(Boolean.valueOf(dataSourceProperty));
            initJDBC30Connection = true;
        } else {
            try {
                Class paramClasses[] = new Class[]{Class.class};

                Method isWrapperMethod = con.getClass().getMethod("isWrapperFor", paramClasses);
                int modifiers = isWrapperMethod.getModifiers();
                setJdbc30Connection(Modifier.isAbstract(modifiers));
            } catch (NoSuchMethodException e) {
                setJdbc30Connection(true);
            } catch (AbstractMethodError e) {
                setJdbc30Connection(true);
            } catch (Throwable t) {
                setJdbc30Connection(true);
                _logger.log(Level.WARNING, "jdbc.unexpected_exception_on_detecting_jdbc_version", t);
            } finally {
                initJDBC30Connection = true;
            }
        }
    
public com.sun.gjc.spi.base.ConnectionHoldergetConnection(java.sql.Connection conObject, com.sun.gjc.spi.ManagedConnection mcObject, javax.resource.spi.ConnectionRequestInfo criObject, boolean statementWrapping)
To get an instance of ConnectionHolder40.
Will return a ConnectionHolder40 with or without wrapper

param
conObject Connection
param
mcObject ManagedConnection
param
criObject Connection Request Info
param
statementWrapping Whether to wrap statement objects or not.
return
ConnectionHolder

        _logger = LogDomains.getLogger(LogDomains.RSR_LOGGER);
    
        ConnectionHolder connection = null;
        if (!initJDBC30Connection) {
            detectJDBC30Connection(conObject, mcObject);
        }
        if (statementWrapping) {
            connection = new ConnectionWrapper40(conObject, mcObject, criObject, jdbc30Connection);
        } else {
            connection = new ConnectionHolder40(conObject, mcObject, criObject, jdbc30Connection);
        }
        return connection;
    
public javax.sql.DataSourcegetDataSourceInstance(com.sun.gjc.spi.ManagedConnectionFactory mcfObject, javax.resource.spi.ConnectionManager cmObject)
Returns a DataSource instance for JDBC 4.0

param
mcfObject Managed Connection Factory
param
cmObject Connection Manager
return
DataSource

        return new DataSource40(mcfObject, cmObject);
    
public booleanisJDBC30ConnectionDetected()

        return initJDBC30Connection;
    
public booleanisJdbc30Connection()

        return jdbc30Connection;
    
public voidsetJdbc30Connection(boolean jdbc30Connection)

        this.jdbc30Connection = jdbc30Connection;