|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--test.tester.model.DatabaseBroker
Every query and connection come from here.
DatabaseBroker broker = DatabaseBroker.getBroker();
Query q = broker.getQuery("select.all.tableX");
q.execute();
...
The name of the query is associated with a Prepared Statement string, which is inside
of a properties file, called [vendor].sql, where the vendor is specified inside of
Database.properties.init() call. You must init it before using the Broker.In the near future, it will also manages the connection pool.
DatabaseBroker is for now a singleton.
| Constructor Summary | |
protected |
DatabaseBroker(java.lang.String configFile)
Protected constructor that loads the driver and set the configuration from the properties file. |
| Method Summary | |
static DatabaseBroker |
getBroker()
Gets the DatabaseBroker singleton instance. |
java.sql.Connection |
getConnection()
Gets a connection to the database. |
Query |
getQuery(java.lang.String queryName)
Returns a new query, getting it from the queries config file. |
static void |
init(java.lang.String configFile)
Inits DatabaseBroker with a config file that will be used to load the driver configuration and queries. |
void |
releaseConnection(java.sql.Connection conn)
Releases a connection, making it available to the pool. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected DatabaseBroker(java.lang.String configFile)
throws DAOException
| Method Detail |
public static void init(java.lang.String configFile)
throws DAOException
DAOException
public static DatabaseBroker getBroker()
throws DAOException
DAOException
public Query getQuery(java.lang.String queryName)
throws DAOException
query, getting it from the queries config file.
DAOException
public java.sql.Connection getConnection()
throws DAOException
DAOException
public void releaseConnection(java.sql.Connection conn)
throws DAOException
DAOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||