com.caucho.sql
Class DriverConfig

java.lang.Object
  extended by com.caucho.sql.DriverConfig

public class DriverConfig
extends java.lang.Object

Configures the database driver.


Field Summary
protected static java.util.logging.Logger log
           
static java.lang.String PROPERTY_PASSWORD
          The key used to look into the properties passed to the connect method to find the password.
static java.lang.String PROPERTY_USER
          The key used to look into the properties passed to the connect method to find the username.
 
Constructor Summary
DriverConfig(DBPoolImpl pool)
          Null constructor for the Driver interface; called by the JNDI configuration.
 
Method Summary
 void addBuilderProgram(ConfigProgram program)
          Adds to the builder program.
 ProfilerPointConfig createProfilerPoint()
          Configure a ProfilerPointConfig, used to create a ProfilerPoint that is then passed to setProfiler().
protected  java.lang.String findDriverByUrl(java.lang.String url)
           
 JdbcDriverMXBean getAdmin()
          Returns the driver admin.
 long getConnectionCountTotal()
          Returns the total number of connections made.
 long getConnectionFailCountTotal()
          Returns the total number of failing connections
 DBPoolImpl getDBPool()
          Returns the DBPool.
 java.sql.Driver getDriver()
          Returns the driver object.
 java.lang.Class<?> getDriverClass()
          Returns the JDBC driver class for the pooled object.
 int getIndex()
           
 java.util.Properties getInfo()
          Returns the properties.
 long getLastFailTime()
          Returns the time of the last connection
 ManagedConnectionFactory getManagedConnectionFactory()
          Returns the managed connection factory.
 java.lang.String getPassword()
          Returns the connection's password
 javax.sql.ConnectionPoolDataSource getPoolDataSource()
          Returns the driver pool.
 java.lang.String getType()
           
 java.lang.String getURL()
          Returns the connection's JDBC url.
 java.lang.String getUser()
          Returns the connection's user.
 javax.sql.XADataSource getXADataSource()
          Returns any XADataSource.
 void init()
           
 void initDriver()
          Initializes the JDBC driver.
 boolean isLocalTransaction()
          Returns true if the driver is XA enabled.
 boolean isXATransaction()
          Returns true if the driver is XA enabled.
 void setDataSource(java.lang.Object dataSource)
          Sets the driver as data source.
 void setDriver(java.sql.Driver driver)
          Sets the driver object.
 void setDriverObject(java.lang.Object driverObject)
           
 void setDriverType(java.lang.String type)
          Sets the driver as data source.
 void setIndex(int index)
           
 void setInitParam(InitParam initParam)
          Sets a property from the underlying driver.
 void setInitParam(java.lang.String key, java.lang.String value)
          Sets a property from the underlying driver.
 void setPassword(java.lang.String password)
          Sets the connection's password
 void setPoolDataSource(javax.sql.ConnectionPoolDataSource pDataSource)
          Sets the pooled data source driver.
 void setProfilerPoint(ProfilerPoint profilerPoint)
          Enables profiling for this driver.
 void setProperty(java.lang.String name, java.lang.Object value)
           
 void setType(java.lang.Class<?> driverClass)
          Sets the JDBC driver class underlying the pooled object.
 void setURL(java.lang.String url)
          Sets the connection's JDBC url.
 void setUser(java.lang.String user)
          Sets the connection's user.
 void setXADataSource(javax.sql.XADataSource xaDataSource)
          Sets the xa data source driver.
 java.lang.String toString()
          Returns a string description of the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final java.util.logging.Logger log

PROPERTY_USER

public static final java.lang.String PROPERTY_USER
The key used to look into the properties passed to the connect method to find the username.

See Also:
Constant Field Values

PROPERTY_PASSWORD

public static final java.lang.String PROPERTY_PASSWORD
The key used to look into the properties passed to the connect method to find the password.

See Also:
Constant Field Values
Constructor Detail

DriverConfig

public DriverConfig(DBPoolImpl pool)
Null constructor for the Driver interface; called by the JNDI configuration. Applications should not call this directly.

Method Detail

getDBPool

public DBPoolImpl getDBPool()
Returns the DBPool.


setDriverType

public void setDriverType(java.lang.String type)
                   throws ConfigException
Sets the driver as data source.

Throws:
ConfigException

setDataSource

public void setDataSource(java.lang.Object dataSource)
                   throws ConfigException
Sets the driver as data source.

Throws:
ConfigException

getDriverClass

public java.lang.Class<?> getDriverClass()
Returns the JDBC driver class for the pooled object.


setType

public void setType(java.lang.Class<?> driverClass)
             throws ConfigException
Sets the JDBC driver class underlying the pooled object.

Throws:
ConfigException

getType

public java.lang.String getType()

getURL

public java.lang.String getURL()
Returns the connection's JDBC url.


setURL

public void setURL(java.lang.String url)
Sets the connection's JDBC url.


addBuilderProgram

public void addBuilderProgram(ConfigProgram program)
Adds to the builder program.


setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)

getUser

public java.lang.String getUser()
Returns the connection's user.


setUser

public void setUser(java.lang.String user)
Sets the connection's user.


getPassword

public java.lang.String getPassword()
Returns the connection's password


setPassword

public void setPassword(java.lang.String password)
Sets the connection's password


setInitParam

public void setInitParam(InitParam initParam)
Sets a property from the underlying driver. Used to set driver properties not handled by DBPool.

Parameters:
name - property name for the driver
value - the driver's value of the property name

setInitParam

public void setInitParam(java.lang.String key,
                         java.lang.String value)
Sets a property from the underlying driver. Used to set driver properties not handled by DBPool.

Parameters:
name - property name for the driver
value - the driver's value of the property name

getInfo

public java.util.Properties getInfo()
Returns the properties.


getDriver

public java.sql.Driver getDriver()
                          throws java.sql.SQLException
Returns the driver object.

Throws:
java.sql.SQLException

setDriver

public void setDriver(java.sql.Driver driver)
               throws java.sql.SQLException
Sets the driver object.

Throws:
java.sql.SQLException

setDriverObject

public void setDriverObject(java.lang.Object driverObject)

getPoolDataSource

public javax.sql.ConnectionPoolDataSource getPoolDataSource()
                                                     throws java.sql.SQLException
Returns the driver pool.

Throws:
java.sql.SQLException

setPoolDataSource

public void setPoolDataSource(javax.sql.ConnectionPoolDataSource pDataSource)
                       throws java.sql.SQLException
Sets the pooled data source driver.

Throws:
java.sql.SQLException

getXADataSource

public javax.sql.XADataSource getXADataSource()
Returns any XADataSource.


setXADataSource

public void setXADataSource(javax.sql.XADataSource xaDataSource)
                     throws java.sql.SQLException
Sets the xa data source driver.

Throws:
java.sql.SQLException

getManagedConnectionFactory

public ManagedConnectionFactory getManagedConnectionFactory()
Returns the managed connection factory.


isXATransaction

public boolean isXATransaction()
Returns true if the driver is XA enabled.


isLocalTransaction

public boolean isLocalTransaction()
Returns true if the driver is XA enabled.


createProfilerPoint

public ProfilerPointConfig createProfilerPoint()
Configure a ProfilerPointConfig, used to create a ProfilerPoint that is then passed to setProfiler(). The returned ProfilerPointConfig has a default name set to the URL of this driver,


setProfilerPoint

public void setProfilerPoint(ProfilerPoint profilerPoint)
Enables profiling for this driver.


setIndex

public void setIndex(int index)

getIndex

public int getIndex()

getAdmin

public JdbcDriverMXBean getAdmin()
Returns the driver admin.


init

@PostConstruct
public void init()

initDriver

public void initDriver()
                throws java.sql.SQLException
Initializes the JDBC driver.

Throws:
java.sql.SQLException

findDriverByUrl

protected java.lang.String findDriverByUrl(java.lang.String url)

getConnectionCountTotal

public long getConnectionCountTotal()
Returns the total number of connections made.


getConnectionFailCountTotal

public long getConnectionFailCountTotal()
Returns the total number of failing connections


getLastFailTime

public long getLastFailTime()
Returns the time of the last connection


toString

public java.lang.String toString()
Returns a string description of the pool.

Overrides:
toString in class java.lang.Object