|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rhi.architecture.db.DataSourceFactory
Factory for creating DataSources that pool database connections. Encapsulates creation of DataSource so that user deals w/ DataSource objects in an entirely standard way. The DataSource returned is a 100% compliant DataSource that pool DB connections for the user. In addition, the factory provides a static reference to the DataSources so that only 1 will be created per JVM. Multiple DBs can be connected to by providing different ResourceBundle filenames to the getBundle() method. The filename makes the bundle unique.
Field Summary | |
static java.lang.String |
DB_URL_KEY
the config key for the DB url. |
static java.lang.String |
DEFAULT_DATA_SOURCE_NAME
the default datasource name prefix. |
static java.lang.String |
DRIVER_KEY
the config key for the jdbc driver name. |
static java.lang.String |
INIT_SIZE_KEY
the initial size of the connection pool. |
static java.lang.String |
INIT_SQL_KEY
config key for optional sql string to be run upon new Connection checkout. |
static java.lang.String |
KEY
the configuration key used by the ResourceContext to look for & return the configured DataSourceFactory |
static java.lang.String |
MAX_IDLE_KEY
the max idle time for a connection in the pool before it is closed. |
static java.lang.String |
MAX_SIZE_KEY
the max size of the connection pool |
static java.lang.String |
MAX_STMTS_KEY
max number of Statements to be stored per connection. |
static java.lang.String |
MAX_WAIT_KEY
the max wait for a connection before timing out & throwing an exception |
static java.lang.String |
PASSWORD_KEY
the config key for the db password. |
static java.lang.String |
USERNAME_KEY
the config key for the db user name. |
Constructor Summary | |
DataSourceFactory()
Default Constructor |
Method Summary | |
void |
close()
Cleanup the object pool that provides the connections. |
javax.sql.DataSource |
getDataSource()
Retrieve the default datasource. |
javax.sql.DataSource |
getDataSource(java.lang.String dsName)
retrieve a datsource by name. |
void |
init(java.util.Properties p)
No initialization required. |
void |
setAction(byte action)
Sets the action to be used when the pool is exhausted. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String KEY
public static final java.lang.String INIT_SQL_KEY
public static final java.lang.String MAX_SIZE_KEY
public static final java.lang.String MAX_WAIT_KEY
public static final java.lang.String MAX_IDLE_KEY
public static final java.lang.String INIT_SIZE_KEY
public static final java.lang.String MAX_STMTS_KEY
public static final java.lang.String DEFAULT_DATA_SOURCE_NAME
public static final java.lang.String DB_URL_KEY
public static final java.lang.String DRIVER_KEY
public static final java.lang.String USERNAME_KEY
public static final java.lang.String PASSWORD_KEY
Constructor Detail |
public DataSourceFactory()
Method Detail |
public void init(java.util.Properties p)
init
in interface Resource
p
- public javax.sql.DataSource getDataSource(java.lang.String dsName)
dsName
-
public javax.sql.DataSource getDataSource()
public void close()
close
in interface Resource
public void setAction(byte action)
action
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |