Package com.im.commons.db.datasource
Class DataSourceFactory
- java.lang.Object
-
- com.im.commons.db.datasource.DataSourceFactory
-
public abstract class DataSourceFactory extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DATABASE_CATALOG
Database catalog (some DBs don't use that).static java.lang.String
DATABASE_DRIVER
Database driver.static java.lang.String
DATABASE_PASSWORD
Database connection password.static java.lang.String
DATABASE_SCHEMA
Database schema (some DBs don't use that).static java.lang.String
DATABASE_URL
Database URL.static java.lang.String
DATABASE_USERNAME
Database connection username.static java.lang.String
ENCRYPT_ALGORITHM
type of encrypting algorithm.static java.lang.String
PREFIX
-
Constructor Summary
Constructors Modifier Constructor Description protected
DataSourceFactory(DBType dbType, java.lang.String driverClass, java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BaseDataSource
createDataSource(java.util.Properties initProps)
protected abstract BaseDataSource
doCreateDataSource(java.util.Properties initProps)
static DataSourceFactory
findDataSourceFactory(java.util.Properties initProps)
DBType
getDBType()
java.lang.String
getDriverClass()
java.lang.String
getName()
-
-
-
Field Detail
-
PREFIX
public static final java.lang.String PREFIX
- See Also:
- Constant Field Values
-
DATABASE_URL
public static final java.lang.String DATABASE_URL
Database URL.- See Also:
- Constant Field Values
-
DATABASE_DRIVER
public static final java.lang.String DATABASE_DRIVER
Database driver.- See Also:
- Constant Field Values
-
DATABASE_USERNAME
public static final java.lang.String DATABASE_USERNAME
Database connection username.- See Also:
- Constant Field Values
-
DATABASE_PASSWORD
public static final java.lang.String DATABASE_PASSWORD
Database connection password.- See Also:
- Constant Field Values
-
DATABASE_SCHEMA
public static final java.lang.String DATABASE_SCHEMA
Database schema (some DBs don't use that).- See Also:
- Constant Field Values
-
DATABASE_CATALOG
public static final java.lang.String DATABASE_CATALOG
Database catalog (some DBs don't use that).- See Also:
- Constant Field Values
-
ENCRYPT_ALGORITHM
public static final java.lang.String ENCRYPT_ALGORITHM
type of encrypting algorithm.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DataSourceFactory
protected DataSourceFactory(DBType dbType, java.lang.String driverClass, java.lang.String name)
-
-
Method Detail
-
getDBType
public final DBType getDBType()
-
getDriverClass
public final java.lang.String getDriverClass()
-
getName
public final java.lang.String getName()
-
createDataSource
public final BaseDataSource createDataSource(java.util.Properties initProps)
-
doCreateDataSource
protected abstract BaseDataSource doCreateDataSource(java.util.Properties initProps)
-
findDataSourceFactory
public static DataSourceFactory findDataSourceFactory(java.util.Properties initProps)
- Parameters:
initProps
- properties which determine requested DB type ofDataSourceFactory
.- Returns:
DataSourceFactory
for DB type found ininitProps
. Might benull
if there is no registered factory for given database type.
-
-