Package org.apache.openjpa.jdbc.schema
Class DBCPDriverDataSource
- java.lang.Object
-
- org.apache.openjpa.jdbc.schema.SimpleDriverDataSource
-
- org.apache.openjpa.jdbc.schema.DBCPDriverDataSource
-
- All Implemented Interfaces:
java.sql.Wrapper,javax.sql.CommonDataSource,javax.sql.DataSource,DriverDataSource,Configurable,Closeable
- Direct Known Subclasses:
AutoDriverDataSource
public class DBCPDriverDataSource extends SimpleDriverDataSource implements Configurable, 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
Fields Modifier and Type Field Description protected JDBCConfigurationconf-
Fields inherited from class org.apache.openjpa.jdbc.schema.SimpleDriverDataSource
_eloc, _loc
-
-
Constructor Summary
Constructors Constructor Description DBCPDriverDataSource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidendConfiguration()Invoked upon completion of bean property configuration for this object.java.sql.ConnectiongetConnection(java.util.Properties props)protected java.sql.ConnectiongetDBCPConnection(java.util.Properties props)protected javax.sql.DataSourcegetDBCPDataSource(java.util.Properties props)protected booleanisDBCPDataSource()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 booleanisDBCPLoaded(java.lang.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.dbcp2.BasicDataSource can be loaded.voidsetConfiguration(Configuration conf)Invoked prior to setting bean properties.voidstartConfiguration()Invoked before bean property configuration is begun on this object.-
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
-
-
-
-
Field Detail
-
conf
protected JDBCConfiguration conf
-
-
Method Detail
-
getConnection
public java.sql.Connection getConnection(java.util.Properties props) throws java.sql.SQLException- Overrides:
getConnectionin classSimpleDriverDataSource- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLException
-
getDBCPConnection
protected java.sql.Connection getDBCPConnection(java.util.Properties props) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getDBCPDataSource
protected javax.sql.DataSource getDBCPDataSource(java.util.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.dbcp2, otherwise false
-
isDBCPLoaded
protected static boolean isDBCPLoaded(java.lang.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.dbcp2.BasicDataSource can be loaded.- Returns:
- true if Commons DBCP was found on the classpath, otherwise false
-
setConfiguration
public void setConfiguration(Configuration conf)
Description copied from interface:ConfigurableInvoked prior to setting bean properties.- Specified by:
setConfigurationin interfaceConfigurable
-
startConfiguration
public void startConfiguration()
Description copied from interface:ConfigurableInvoked before bean property configuration is begun on this object.- Specified by:
startConfigurationin interfaceConfigurable
-
endConfiguration
public void endConfiguration()
Description copied from interface:ConfigurableInvoked upon completion of bean property configuration for this object.- Specified by:
endConfigurationin interfaceConfigurable
-
-