class JdbcDataSource
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
JdbcDataSource.DatabaseKey
Class that handles a database key for the
sources map. |
| 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 CentralLogger |
log
Logger
|
private static java.util.Map<JdbcDataSource.DatabaseKey,JdbcDataSource> |
sources
Concurrent map of instances, keyed by database keys.
|
| 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,
DatabaseConfig cfg,
java.lang.String tenantId)
Get a JDBC connection from the pool, creating it if necessary.
|
private static JdbcDataSource |
getDataSource(Database database,
DatabaseConfig cfg,
java.lang.String tenantId)
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 CentralLogger log
private static java.util.Map<JdbcDataSource.DatabaseKey,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, DatabaseConfig cfg, java.lang.String tenantId) throws PersistenceException
database - Database with which the connection must be established.cfg - The configuration of the given database.tenantId - The id of the tenant.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, DatabaseConfig cfg, java.lang.String tenantId) throws PersistenceException
database - Database object which identifies the data source.cfg - The configuration of the given database.tenantId - The id of the tenant.PersistenceException - if there is an error configuring or obtaining the data source.