Added event table and added ignored table to DB upgrade
Former-commit-id: 9237a2457630ac5fa1e41c7e6b16214ca24cba08
This commit is contained in:
parent
1f781f0c8d
commit
2c59ae5693
3 changed files with 7 additions and 5 deletions
BIN
hal-default.db
BIN
hal-default.db
Binary file not shown.
|
|
@ -79,6 +79,7 @@ public class HalContext {
|
||||||
|
|
||||||
logger.fine(String.format("Upgrading DB (from: v%s, to: v%s)...", dbVersion, defaultDBVersion));
|
logger.fine(String.format("Upgrading DB (from: v%s, to: v%s)...", dbVersion, defaultDBVersion));
|
||||||
final DBUpgradeHandler handler = new DBUpgradeHandler(referenceDB);
|
final DBUpgradeHandler handler = new DBUpgradeHandler(referenceDB);
|
||||||
|
handler.addIgnoredTable("db_version_history");
|
||||||
handler.setTargetDB(db);
|
handler.setTargetDB(db);
|
||||||
|
|
||||||
//read upgrade path preferences from the reference database
|
//read upgrade path preferences from the reference database
|
||||||
|
|
@ -109,9 +110,6 @@ public class HalContext {
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.upgrade();
|
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");
|
logger.info("DB upgrade done");
|
||||||
dbConf.setProperty(PROPERTY_DB_VERSION, defaultDBConf.getProperty(PROPERTY_DB_VERSION));
|
dbConf.setProperty(PROPERTY_DB_VERSION, defaultDBConf.getProperty(PROPERTY_DB_VERSION));
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,11 @@ import java.util.logging.Level;
|
||||||
* Created by Ziver on 2015-12-03.
|
* Created by Ziver on 2015-12-03.
|
||||||
*/
|
*/
|
||||||
public class PowerChallenge {
|
public class PowerChallenge {
|
||||||
|
|
||||||
|
|
||||||
private static HalDaemon[] daemons;
|
private static HalDaemon[] daemons;
|
||||||
private static HalHttpPage[] pages;
|
private static HalHttpPage[] pages;
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
// init logging
|
// init logging
|
||||||
CompactLogFormatter formatter = new CompactLogFormatter();
|
CompactLogFormatter formatter = new CompactLogFormatter();
|
||||||
|
|
@ -41,11 +41,12 @@ public class PowerChallenge {
|
||||||
LogUtil.setFormatter("zutil", formatter);
|
LogUtil.setFormatter("zutil", formatter);
|
||||||
LogUtil.setGlobalFormatter(formatter);
|
LogUtil.setGlobalFormatter(formatter);
|
||||||
|
|
||||||
|
|
||||||
// init DB and other configurations
|
// init DB and other configurations
|
||||||
HalContext.initialize();
|
HalContext.initialize();
|
||||||
DBConnection db = HalContext.getDB();
|
DBConnection db = HalContext.getDB();
|
||||||
|
|
||||||
// Init sensors and controllers
|
// Init sensors,events and controllers
|
||||||
ControllerManager.initialize();
|
ControllerManager.initialize();
|
||||||
for(Sensor sensor : Sensor.getLocalSensors(db)){
|
for(Sensor sensor : Sensor.getLocalSensors(db)){
|
||||||
ControllerManager.getInstance().register(sensor);
|
ControllerManager.getInstance().register(sensor);
|
||||||
|
|
@ -54,6 +55,7 @@ public class PowerChallenge {
|
||||||
ControllerManager.getInstance().register(event);
|
ControllerManager.getInstance().register(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// init daemons
|
// init daemons
|
||||||
daemons = new HalDaemon[]{
|
daemons = new HalDaemon[]{
|
||||||
new DataAggregatorDaemon(),
|
new DataAggregatorDaemon(),
|
||||||
|
|
@ -67,6 +69,8 @@ public class PowerChallenge {
|
||||||
daemon.initiate(executor);
|
daemon.initiate(executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// init http server
|
||||||
pages = new HalHttpPage[]{
|
pages = new HalHttpPage[]{
|
||||||
new PCOverviewHttpPage(),
|
new PCOverviewHttpPage(),
|
||||||
new PCHeatMapHttpPage(),
|
new PCHeatMapHttpPage(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue