|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javatools.db.DbManager
A class to manage all the other DbDatabases. Usually there will be only one DbManager object, thus you should use singleton() to access it.
e.g. DbDatabase db = DbManager.singleton().getDatabase("foo");
Field Summary | |
(package private) java.util.Map |
databaseNameMap
|
(package private) java.util.Map |
nameDatabaseMap
|
(package private) Props |
props
|
(package private) static DbManager |
single
|
Constructor Summary | |
DbManager()
|
Method Summary | |
void |
close()
Close ALL connections associated with this database. |
void |
commit()
Perform a commit on ALL connections associated with this database. |
void |
commitClose()
Commit and close ALL connections associated with this database. |
DbDatabase |
getDatabase(java.lang.String name)
Return the database associated with this name. |
DbDatabase |
getDatabase(java.lang.String name,
java.lang.String driver,
java.lang.String connectString,
java.lang.String userName,
java.lang.String password)
Return the database object associated with this name or parameters. |
java.util.Map |
getDatabaseNameMap()
Return a Map that maps DbDatabases to names. |
java.util.Map |
getNameDatabaseMap()
Return a Map that maps names to DbDatabases. |
Props |
getProps()
Return a properties object for the db subsystem. |
void |
rollback()
Perform a rollback on ALL connections associated with this database. |
void |
rollbackClose()
Rollback and close ALL connections associated with this database. |
static DbManager |
singleton()
Return THE DbManager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static DbManager single
java.util.Map nameDatabaseMap
java.util.Map databaseNameMap
Props props
Constructor Detail |
public DbManager()
Method Detail |
public static DbManager singleton()
public java.util.Map getNameDatabaseMap()
public java.util.Map getDatabaseNameMap()
public Props getProps() throws java.io.IOException
java.io.IOException
- Description of Exceptionpublic DbDatabase getDatabase(java.lang.String name, java.lang.String driver, java.lang.String connectString, java.lang.String userName, java.lang.String password) throws DbException
name
- An arbitrary name used to identify this DbDatabase.driver
- The Java JDBC driver class name.connectString
- The JDBC connect string.userName
- The database connect user name.password
- The database connect password.
DbException
- Description of Exceptionpublic DbDatabase getDatabase(java.lang.String name) throws DbException
foo.driver = oracle.jdbc.driver.OracleDriver foo.connect = jdbc:oracle:thin:@dbdev01:1521:devu02 foo.userId = foouserid foo.password = foopasswordIn terms of where the db.properties file will be located, that is determined by the javatools.util.Props class.
name
- The name in the cache and/or in the db.properties
file.
DbException
- Description of ExceptionProps
public void commitClose() throws DbException
DbException
- Description of Exceptionpublic void rollbackClose() throws DbException
DbException
- Description of Exceptionpublic void commit() throws DbException
DbException
- Description of Exceptionpublic void rollback() throws DbException
DbException
- Description of Exceptionpublic void close() throws DbException
DbException
- Description of Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |