|
|||||||||
| Home >> All >> javatools >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javatools.db
Class DbManager

java.lang.Objectjavatools.db.DbManager
- public class DbManager
- extends java.lang.Object
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");
- Version:
- 0.7
| Field Summary | |
(package private) java.util.Map |
databaseNameMap
A map for matching DBMSs to names. |
(package private) java.util.Map |
nameDatabaseMap
A map for matching names to DBMSs. |
(package private) javatools.util.Props |
props
The complete properties. |
(package private) static DbManager |
single
The one and only DbManager. |
| 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. |
javatools.util.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 |
single
static DbManager single
- The one and only DbManager.
nameDatabaseMap
java.util.Map nameDatabaseMap
- A map for matching names to DBMSs.
databaseNameMap
java.util.Map databaseNameMap
- A map for matching DBMSs to names.
props
javatools.util.Props props
- The complete properties.
| Constructor Detail |
DbManager
public DbManager()
| Method Detail |
singleton
public static DbManager singleton()
- Return THE DbManager.
getNameDatabaseMap
public java.util.Map getNameDatabaseMap()
- Return a Map that maps names to DbDatabases.
getDatabaseNameMap
public java.util.Map getDatabaseNameMap()
- Return a Map that maps DbDatabases to names.
getProps
public javatools.util.Props getProps() throws java.io.IOException
- Return a properties object for the db subsystem. Currently we always use a
"db.properties" that is found on the classpath.
getDatabase
public DbDatabase getDatabase(java.lang.String name, java.lang.String driver, java.lang.String connectString, java.lang.String userName, java.lang.String password) throws DbException
- Return the database object associated with this name or parameters. If you
don't give a name DbManager won't be able to cache DbDatabase objects, so
giving a name is recommended. Usually the name will be just something which
identifies this application. Once a DbDatabase is in the cache you can use
the getDatabase(name) with one argument. Alternatively you can always use
the one argument version and the parameters will come from the
db.properties file.
getDatabase
public DbDatabase getDatabase(java.lang.String name) throws DbException
- Return the database associated with this name. If the database is already
in the cache we return that, otherwise we attempt to read a db properties
file and get a connect configuration from that with
. . For example, you could have a notional database called "foo". Then in your db.properties file you might have a setup like: foo.driver = oracle.jdbc.driver.OracleDriver foo.connect = jdbc:oracle:thin:@dbdev01:1521:devu02 foo.userId = foouserid foo.password = foopassword
In terms of where the db.properties file will be located, that is determined by the javatools.util.Props class.
commitClose
public void commitClose()
throws DbException
- Commit and close ALL connections associated with this database.
rollbackClose
public void rollbackClose()
throws DbException
- Rollback and close ALL connections associated with this database.
commit
public void commit()
throws DbException
- Perform a commit on ALL connections associated with this database.
rollback
public void rollback()
throws DbException
- Perform a rollback on ALL connections associated with this database.
close
public void close()
throws DbException
- Close ALL connections associated with this database.
|
|||||||||
| Home >> All >> javatools >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
javatools.db.DbManager