Class PrometheusDataStore
java.lang.Object
io.github.tonywasher.joceanus.prometheus.database.PrometheusDataStore
Class that encapsulates a database connection.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPrometheusDataStore(PrometheusDBConfig pConfig) Construct a new Database class.protectedPrometheusDataStore(String pDatabase, PrometheusDBConfig pConfig) Construct a new Database class. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddTable(PrometheusTableDataItem<?> pTable) Add a table.voidclose()Close the connection to the database rolling back any outstanding transaction.voidcreateDatabase(TethysUIThreadStatusReport pReport, String pDatabase) Create database.voidcreateTables(TethysUIThreadStatusReport pReport) Create tables.(package private) voidexecuteStatement(String pStatement) Execute the statement outside a transaction.protected ConnectiongetConn()Access the connection.protected PrometheusJDBCDriverObtain the Driver.getName()Obtain the database name.voidloadDatabase(TethysUIThreadStatusReport pReport, PrometheusDataSet pData) Load data from the database.voidpurgeTables(TethysUIThreadStatusReport pReport) Purge tables.voidupdateDatabase(TethysUIThreadStatusReport pReport, PrometheusDataSet pData) Update data into database.
-
Constructor Details
-
PrometheusDataStore
Construct a new Database class.- Parameters:
pDatabase- the databasepConfig- the config- Throws:
OceanusException- on error
-
PrometheusDataStore
Construct a new Database class.- Parameters:
pConfig- the config- Throws:
OceanusException- on error
-
-
Method Details
-
getName
Obtain the database name.- Returns:
- the name
-
executeStatement
Execute the statement outside a transaction.- Parameters:
pStatement- the statement- Throws:
OceanusException- on error
-
getDriver
Obtain the Driver.- Returns:
- the driver
-
getConn
Access the connection.- Returns:
- the connection
-
addTable
Add a table.- Parameters:
pTable- the Table to add
-
close
public void close()Close the connection to the database rolling back any outstanding transaction. -
loadDatabase
public void loadDatabase(TethysUIThreadStatusReport pReport, PrometheusDataSet pData) throws OceanusException Load data from the database.- Parameters:
pReport- the reportpData- the new DataSet- Throws:
OceanusException- on error
-
updateDatabase
public void updateDatabase(TethysUIThreadStatusReport pReport, PrometheusDataSet pData) throws OceanusException Update data into database.- Parameters:
pReport- the reportpData- the data- Throws:
OceanusException- on error
-
createDatabase
public void createDatabase(TethysUIThreadStatusReport pReport, String pDatabase) throws OceanusException Create database.- Parameters:
pReport- the reportpDatabase- the database to create- Throws:
OceanusException- on error
-
createTables
Create tables.- Parameters:
pReport- the report- Throws:
OceanusException- on error
-
purgeTables
Purge tables.- Parameters:
pReport- the report- Throws:
OceanusException- on error
-