class JdbcDataSource
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
batch
Flag indicating whether data source supports batch operations
|
private javax.sql.DataSource |
dataSource
Delegate data source
|
(package private) static java.util.logging.Logger |
log
Logger
|
private static java.util.Map<Database,JdbcDataSource> |
sources
Concurrent map of instances, keyed by database
|
Modifier | Constructor and Description |
---|---|
private |
JdbcDataSource(javax.sql.DataSource dataSource)
Private constructor; all access is via static methods.
|
Modifier and Type | Method and Description |
---|---|
(package private) static java.sql.Connection |
getConnection(Database database)
Get a JDBC connection from the pool, creating it if necessary.
|
private static JdbcDataSource |
getDataSource(Database database)
Get the JDBC data source for the given database.
|
(package private) static boolean |
supportsBatch(Database database)
Indicate whether the data source represented by the given database object supports batch
operations.
|
static final java.util.logging.Logger log
private static java.util.Map<Database,JdbcDataSource> sources
private final javax.sql.DataSource dataSource
private final boolean batch
private JdbcDataSource(javax.sql.DataSource dataSource) throws PersistenceException
dataSource
- The data source. Note that only the database name is used directly to configure the data
source; all other information is read from the directory or is derived, based on the database
type.PersistenceException
- if there is an error configuring or obtaining the data source.static java.sql.Connection getConnection(Database database) throws PersistenceException
database
- Database with which the connection must be established.PersistenceException
- if there is an error configuring or obtaining the data source or connection.static boolean supportsBatch(Database database) throws PersistenceException
database
- Database for which batch support information is needed.true
if batch operations are supported, else false
.PersistenceException
- if database metadata needs to be queried and there is an error doing so.private static JdbcDataSource getDataSource(Database database) throws PersistenceException
database
- Database object which identifies the data source.PersistenceException
- if there is an error configuring or obtaining the data source.