use of de.janrufmonitor.repository.MacAddressBookProxyDatabaseHandler in project janrufmonitor by tbrandt77.
the class MacAddressBookProxy method start.
public synchronized void start() {
if (this.m_dbh == null) {
String db_path = PathResolver.getInstance(this.getRuntime()).resolve(PathResolver.getInstance(this.getRuntime()).getDataDirectory() + "macab_cache" + File.separator + "macab_mapping.db");
db_path = StringUtils.replaceString(db_path, "\\", "/");
File db = new File(db_path + ".properties");
boolean initialize = false;
if (!db.exists()) {
initialize = true;
db.getParentFile().mkdirs();
try {
File db_raw = new File(db_path);
if (!db_raw.exists()) {
ZipArchive z = new ZipArchive(db_path);
z.open();
z.close();
}
} catch (ZipArchiveException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
}
}
this.m_dbh = new MacAddressBookProxyDatabaseHandler("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:" + db_path, "sa", "", initialize);
try {
this.m_dbh.connect();
} catch (SQLException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
} catch (ClassNotFoundException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
}
}
}
Aggregations