Added event table and added ignored table to DB upgrade

Former-commit-id: 9237a2457630ac5fa1e41c7e6b16214ca24cba08
This commit is contained in:
Ziver Koc 2016-01-04 19:21:26 +01:00
parent 1f781f0c8d
commit 2c59ae5693
3 changed files with 7 additions and 5 deletions

Binary file not shown.

View file

@ -79,6 +79,7 @@ public class HalContext {
logger.fine(String.format("Upgrading DB (from: v%s, to: v%s)...", dbVersion, defaultDBVersion));
final DBUpgradeHandler handler = new DBUpgradeHandler(referenceDB);
handler.addIgnoredTable("db_version_history");
handler.setTargetDB(db);
//read upgrade path preferences from the reference database
@ -110,9 +111,6 @@ public class HalContext {
handler.upgrade();
//remove table from target database. this table is supposed to only be put in the reference db.
db.exec("DROP TABLE db_version_history");
logger.info("DB upgrade done");
dbConf.setProperty(PROPERTY_DB_VERSION, defaultDBConf.getProperty(PROPERTY_DB_VERSION));
storeProperties();

View file

@ -28,10 +28,10 @@ import java.util.logging.Level;
*/
public class PowerChallenge {
private static HalDaemon[] daemons;
private static HalHttpPage[] pages;
public static void main(String[] args) throws Exception {
// init logging
CompactLogFormatter formatter = new CompactLogFormatter();
@ -41,11 +41,12 @@ public class PowerChallenge {
LogUtil.setFormatter("zutil", formatter);
LogUtil.setGlobalFormatter(formatter);
// init DB and other configurations
HalContext.initialize();
DBConnection db = HalContext.getDB();
// Init sensors and controllers
// Init sensors,events and controllers
ControllerManager.initialize();
for(Sensor sensor : Sensor.getLocalSensors(db)){
ControllerManager.getInstance().register(sensor);
@ -54,6 +55,7 @@ public class PowerChallenge {
ControllerManager.getInstance().register(event);
}
// init daemons
daemons = new HalDaemon[]{
new DataAggregatorDaemon(),
@ -67,6 +69,8 @@ public class PowerChallenge {
daemon.initiate(executor);
}
// init http server
pages = new HalHttpPage[]{
new PCOverviewHttpPage(),
new PCHeatMapHttpPage(),