org.apache.openjpa.jdbc.schema
Class DBCPDriverDataSource

java.lang.Object
  extended by org.apache.openjpa.jdbc.schema.SimpleDriverDataSource
      extended by org.apache.openjpa.jdbc.schema.DBCPDriverDataSource
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource, DriverDataSource, org.apache.openjpa.lib.conf.Configurable, org.apache.openjpa.lib.util.Closeable
Direct Known Subclasses:
AutoDriverDataSource

public class DBCPDriverDataSource
extends SimpleDriverDataSource
implements org.apache.openjpa.lib.conf.Configurable, org.apache.openjpa.lib.util.Closeable

Commons DBCP basic pooling driver data source. The commons-dbcp packages must be on the class path for this plugin to work, as it WILL NOT fall back to non-DBCP mode if they are missing. For automatic usage of Commons DBCP when available, use AutoDriverDataSource instead.


Field Summary
protected  JDBCConfiguration conf
           
 
Fields inherited from class org.apache.openjpa.jdbc.schema.SimpleDriverDataSource
_eloc, _loc
 
Constructor Summary
DBCPDriverDataSource()
           
 
Method Summary
 void close()
           
 void endConfiguration()
           
 Connection getConnection(Properties props)
           
protected  Connection getDBCPConnection(Properties props)
           
protected  DataSource getDBCPDataSource(Properties props)
           
protected  boolean isDBCPDataSource()
          This method should not throw an exception, as it is called by AutoDriverDataSource to determine if user already specified to use Commons DBCP.
protected static boolean isDBCPLoaded(ClassLoader cl)
          This method should not throw an exception, as it is called by AutoDriverDataSource to determine if it should use DBCP or not based on if org.apache.commons.dbcp.BasicDataSource can be loaded.
 void setConfiguration(org.apache.openjpa.lib.conf.Configuration conf)
           
 void startConfiguration()
           
 
Methods inherited from class org.apache.openjpa.jdbc.schema.SimpleDriverDataSource
createConnectionDecorators, getClassLoader, getConnection, getConnection, getConnectionDriverName, getConnectionFactoryProperties, getConnectionPassword, getConnectionProperties, getConnectionURL, getConnectionUserName, getLoginTimeout, getLogWriter, getParentLogger, getSimpleConnection, getSimpleDriver, initDBDictionary, isWrapperFor, setClassLoader, setConnectionDriverName, setConnectionFactoryProperties, setConnectionPassword, setConnectionProperties, setConnectionURL, setConnectionUserName, setLoginTimeout, setLogWriter, unwrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conf

protected JDBCConfiguration conf
Constructor Detail

DBCPDriverDataSource

public DBCPDriverDataSource()
Method Detail

getConnection

public Connection getConnection(Properties props)
                         throws SQLException
Overrides:
getConnection in class SimpleDriverDataSource
Throws:
SQLException

close

public void close()
           throws SQLException
Specified by:
close in interface org.apache.openjpa.lib.util.Closeable
Throws:
SQLException

getDBCPConnection

protected Connection getDBCPConnection(Properties props)
                                throws SQLException
Throws:
SQLException

getDBCPDataSource

protected DataSource getDBCPDataSource(Properties props)

isDBCPDataSource

protected boolean isDBCPDataSource()
This method should not throw an exception, as it is called by AutoDriverDataSource to determine if user already specified to use Commons DBCP.

Returns:
true if ConnectionDriverName contains org.apache.commons.dbcp, otherwise false

isDBCPLoaded

protected static boolean isDBCPLoaded(ClassLoader cl)
This method should not throw an exception, as it is called by AutoDriverDataSource to determine if it should use DBCP or not based on if org.apache.commons.dbcp.BasicDataSource can be loaded.

Returns:
true if Commons DBCP was found on the classpath, otherwise false

setConfiguration

public void setConfiguration(org.apache.openjpa.lib.conf.Configuration conf)
Specified by:
setConfiguration in interface org.apache.openjpa.lib.conf.Configurable

startConfiguration

public void startConfiguration()
Specified by:
startConfiguration in interface org.apache.openjpa.lib.conf.Configurable

endConfiguration

public void endConfiguration()
Specified by:
endConfiguration in interface org.apache.openjpa.lib.conf.Configurable


Copyright © 2006–2017 Apache Software Foundation. All rights reserved.