|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gcube.messaging.common.consumer.db.DBManager
public abstract class DBManager
Nested Class Summary | |
---|---|
static interface |
DBManager.BaseConsumer
|
Constructor Summary | |
---|---|
DBManager()
Constructor for SQLDBManager |
Method Summary | |
---|---|
void |
backup()
checkpoint the db and create a backup |
void |
close()
Shutdown the db and close the connection to the db. |
abstract void |
open()
Load the HSQL Database Engine JDBC driver and open the connection to the db. |
java.sql.ResultSet |
query(java.lang.String expression)
Executes SQL command SELECT and invokes the given consumer. |
void |
queryAndConsume(java.lang.String expression,
DBManager.BaseConsumer consumer)
Executes SQL command SELECT and invokes the given consumer. |
java.lang.String |
queryDBRS(java.lang.String query)
Executes a query an populates a RS |
java.lang.String |
queryJSON(java.lang.String expression)
Executes SQL command SELECT and invokes the given consumer, giging back JSON formatetted output. |
static java.lang.String |
toJSon(java.sql.ResultSet resultSet)
|
void |
update(java.lang.String expression)
Executes SQL commands CREATE, DROP, INSERT and UPDATE. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBManager()
Method Detail |
---|
public abstract void open() throws java.lang.ClassNotFoundException, java.sql.SQLException, java.lang.Exception
java.lang.ClassNotFoundException
- if the HSQL Database Engine JDBC driver is not loaded
java.sql.SQLException
- if the connection to the db fails
java.lang.Exception
- if the tables creation failspublic void close() throws java.lang.Exception
java.lang.Exception
public void backup() throws java.sql.SQLException, java.lang.Exception
java.sql.SQLException
- if the CHECKPOINT query fails
java.lang.Exception
public java.lang.String queryDBRS(java.lang.String query) throws ResultSetPool.PoolNotInitializedException, java.lang.Exception
query
- the SQL Query
java.lang.Exception
ResultSetPool.PoolNotInitializedException
public void queryAndConsume(java.lang.String expression, DBManager.BaseConsumer consumer) throws java.sql.SQLException, java.lang.Exception
expression
- the SQL expression to evaluateconsumer
- the resultset consumer to invoke
java.sql.SQLException
- if the query fails
java.lang.Exception
- if the given resultset consumer failspublic java.sql.ResultSet query(java.lang.String expression) throws java.sql.SQLException, java.lang.Exception
expression
- the SQL expression to evaluate
java.sql.SQLException
- if the query fails
java.lang.Exception
- if the given resultset consumer failspublic java.lang.String queryJSON(java.lang.String expression) throws java.sql.SQLException, java.lang.Exception
expression
- the SQL expression to evaluate
java.sql.SQLException
- if the query fails
java.lang.Exception
- if the given resultset consumer failspublic void update(java.lang.String expression) throws java.lang.Exception
expression
- the SQL expression to modify the db
java.lang.Exception
public static java.lang.String toJSon(java.sql.ResultSet resultSet) throws java.sql.SQLException
resultSet
-
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |