use of com.djrapitops.plan.storage.database.SQLiteDB in project Plan by plan-player-analytics.
the class DatabaseCommands method performRestore.
public void performRestore(CMDSender sender, File backupDBFile, Database toDB) {
try {
SQLiteDB fromDB = sqliteFactory.usingFile(backupDBFile);
fromDB.init();
sender.send(locale.getString(CommandLang.DB_WRITE, toDB.getType().getName()));
toDB.executeTransaction(new BackupCopyTransaction(fromDB, toDB)).get();
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (DBOpException | ExecutionException e) {
errorLogger.error(e, ErrorContext.builder().related(backupDBFile, toDB.getType(), toDB.getState()).build());
sender.send(locale.getString(CommandLang.PROGRESS_FAIL, e.getMessage()));
}
}
Aggregations