diff --git a/build.gradle b/build.gradle index 0726e36e..e40bc15a 100644 --- a/build.gradle +++ b/build.gradle @@ -56,7 +56,6 @@ distributions { main { contents { from 'hal.conf.example' - from 'hal-default.db' from 'logging.properties' from "${buildDir}/resources" diff --git a/hal-core/src/se/hal/HalContext.java b/hal-core/src/se/hal/HalContext.java index ab3c9e93..3c77bb0e 100644 --- a/hal-core/src/se/hal/HalContext.java +++ b/hal-core/src/se/hal/HalContext.java @@ -25,7 +25,6 @@ public class HalContext { private static final Logger logger = LogUtil.getLogger(); // Constants - public static final String PROPERTY_DB_VERSION = "hal.db_version"; public static final String PROPERTY_HTTP_PORT = "hal.http_port"; public static final String PROPERTY_MAP_BACKGROUND_IMAGE = "hal.map_bgimage"; @@ -41,9 +40,8 @@ public class HalContext { public static final String RESOURCE_WEB_ROOT = HalContext.RESOURCE_ROOT + "/resource/web"; - private static final String CONF_FILE = "hal.conf"; - static final String DB_FILE = "hal.db"; - private static final String DEFAULT_DB_FILE = HalContext.RESOURCE_ROOT + "/resource/hal-default.db"; + private static final String CONF_FILE = "hal.conf"; + static final String DB_FILE = "hal.db"; // Variables private static DBConnection db; // TODO: Should probably be a db pool as we have multiple threads accessing the DB @@ -70,17 +68,13 @@ public class HalContext { logger.info("No hal.conf file found"); } - if (FileUtil.find(DEFAULT_DB_FILE) == null){ - logger.severe("Unable to find default DB: " + DEFAULT_DB_FILE); - System.exit(1); - } - // Init DB File dbFile = FileUtil.find(DB_FILE); db = new DBConnection(DBConnection.DBMS.SQLite, DB_FILE); if (dbFile == null){ - logger.info("No database file found, creating new DB..."); + logger.severe("Unable to find Hal DB: " + DB_FILE); + System.exit(1); } else { dbConf = db.exec("SELECT * FROM conf", new PropertiesSQLResult()); } diff --git a/hal-core/test/se/hal/daemon/SensorDataAggregationDaemonTest.java b/hal-core/test/se/hal/daemon/SensorDataAggregationDaemonTest.java index 65c55d43..06128a46 100644 --- a/hal-core/test/se/hal/daemon/SensorDataAggregationDaemonTest.java +++ b/hal-core/test/se/hal/daemon/SensorDataAggregationDaemonTest.java @@ -11,7 +11,7 @@ import zutil.log.LogUtil; import java.sql.PreparedStatement; public class SensorDataAggregationDaemonTest { - private static final String DEFAULT_DB_FILE = "resource/resource/hal-default.db"; + private static final String DEFAULT_DB_FILE = "resource/resource/hal-core-reference.db"; private static DBConnection db; diff --git a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigbeeHalDatabaseUpgrade.java b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigbeeHalDatabaseUpgrade.java index 2cc8f79f..3c5f630b 100644 --- a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigbeeHalDatabaseUpgrade.java +++ b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigbeeHalDatabaseUpgrade.java @@ -8,7 +8,7 @@ import java.sql.SQLException; import java.util.logging.Logger; /** - * The DB upgrade class for Hal-Core + * The DB upgrade class for Hal-Zigbee plugin */ public class ZigbeeHalDatabaseUpgrade extends HalDatabaseUpgrade { private static final int REFERENCE_DB_VERSION = 1;