net.java.ao.db
Class ProxoolPoolProvider

java.lang.Object
  extended by net.java.ao.DatabaseProvider
      extended by net.java.ao.PoolProvider
          extended by net.java.ao.db.ProxoolPoolProvider

public class ProxoolPoolProvider
extends PoolProvider

Author:
Daniel Spiewak

Constructor Summary
ProxoolPoolProvider(DatabaseProvider delegate)
           
ProxoolPoolProvider(DatabaseProvider delegate, String alias)
           
 
Method Summary
 void dispose()
          Should release all resources held by the pool.
protected  Connection getConnectionImpl()
          Creates a new connection to the database prepresented by the provider instance.
 Class<? extends Driver> getDriverClass()
          Returns the JDBC Driver class which corresponds to the database being abstracted.
static boolean isAvailable()
           
 
Methods inherited from class net.java.ao.PoolProvider
getDelegate, getTables, insertReturningKey, parseValue, putNull, renderAction, renderAutoIncrement, renderQuery, setPostConnectionProperties, setQueryResultSetProperties, setQueryStatementProperties
 
Methods inherited from class net.java.ao.DatabaseProvider
considerPrecision, convertTypeToString, executeInsertReturningKey, getConnection, getDateFormat, getFunctionNameForField, getInstance, getInstance, getPassword, getTriggerNameForField, getURI, getUsername, isNumericType, renderAlterTableAddColumn, renderAlterTableAddKey, renderAlterTableChangeColumn, renderAlterTableChangeColumnStatement, renderAlterTableDropColumn, renderAlterTableDropKey, renderAppend, renderCalendar, renderConstraintsForTable, renderCreateIndex, renderDropFunctions, renderDropIndex, renderDropSequences, renderDropTable, renderDropTriggers, renderField, renderFieldPrecision, renderFieldType, renderForeignKey, renderFunction, renderFunctionForField, renderFunctions, renderOnUpdate, renderQueryGroupBy, renderQueryJoins, renderQueryLimit, renderQueryOrderBy, renderQuerySelect, renderQueryWhere, renderSequences, renderTable, renderTriggerForField, renderTriggers, renderUnique, renderValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxoolPoolProvider

public ProxoolPoolProvider(DatabaseProvider delegate)
                    throws org.logicalcobwebs.proxool.ProxoolException
Throws:
org.logicalcobwebs.proxool.ProxoolException

ProxoolPoolProvider

public ProxoolPoolProvider(DatabaseProvider delegate,
                           String alias)
                    throws org.logicalcobwebs.proxool.ProxoolException
Throws:
org.logicalcobwebs.proxool.ProxoolException
Method Detail

getDriverClass

public Class<? extends Driver> getDriverClass()
                                       throws ClassNotFoundException
Description copied from class: DatabaseProvider

Returns the JDBC Driver class which corresponds to the database being abstracted. This should be implemented in such a way as to initialize and register the driver with JDBC. For most drivers, this requires code in the following form:

public Class<? extends Driver> getDriverClass() {
     return (Class<? extends Driver>) Class.forName("com.mysql.jdbc.Driver");
 }

The following does not fire the driver's static initializer and thus will (usually) not work:

public Class<? extends Driver> getDriverClass() {
     return com.mysql.jdbc.Driver.class;
 }

If the driver is not on the classpath, a ClassNotFoundException can and should be thrown (certain auto-magic configuration sections of ActiveObjects depend upon this under certain circumstances).

Overrides:
getDriverClass in class PoolProvider
Returns:
null
Throws:
ClassNotFoundException

getConnectionImpl

protected Connection getConnectionImpl()
                                throws SQLException
Description copied from class: DatabaseProvider

Creates a new connection to the database prepresented by the provider instance. This method should not attempt to do any caching of any kind (unless implemented by a connection pool library). Prior to creating the database connection, this method makes a call to DatabaseProvider.getDriverClass() to ensure that the JDBC driver has been loaded. The return value is not checked for validity.

This method is never called directly. Instead, the DatabaseProvider.getConnection() method should be used.

Overrides:
getConnectionImpl in class DatabaseProvider
Returns:
A new connection to the database or null if the driver could not be loaded.
Throws:
SQLException

dispose

public void dispose()
Description copied from class: PoolProvider

Should release all resources held by the pool. This is especially important to implement for pool providers, as conection pools may have connections which are being held (potentially) indefinitely. It is important for developers to call this method to free resources, as well as it is important for custom implementation authors to implement the method to perform such a function.

Implementations should take the following form:

public void dispose() {
     connectionPool.freeAllConnections();
     
     super.dispose();
 }

This method additionally delegates its call to the delegate provider instance, ensuring that (for databases which require it) database resources are appropriately freed.

Overrides:
dispose in class PoolProvider
See Also:
DatabaseProvider.dispose()

isAvailable

public static boolean isAvailable()