Tabnine Logo
BackupManager
Code IndexAdd Tabnine to your IDE (free)

How to use
BackupManager
in
org.multibit.hd.core.managers

Best Java code snippets using org.multibit.hd.core.managers.BackupManager (Showing top 18 results out of 315)

origin: Multibit-Legacy/multibit-hd

/**
 * Get all the backups available in the local zip backup directory for the wallet id specified.
 */
public List<BackupSummary> getLocalZipBackups(WalletId walletId) {
 createApplicationDataDirectoryIfNotSet();
 // Find the wallet root directory for this wallet id
 File walletRootDirectory = WalletManager.getOrCreateWalletDirectory(applicationDataDirectory, WalletManager.createWalletRoot(walletId));
 if (!walletRootDirectory.exists()) {
  // No directory - no backups
  return Lists.newArrayList();
 }
 // Find the zip-backups directory containing the local backups
 File zipBackupsDirectory = new File(walletRootDirectory.getAbsoluteFile() + File.separator + LOCAL_ZIP_BACKUP_DIRECTORY_NAME);
 return getWalletBackups(walletId, zipBackupsDirectory);
}
origin: Multibit-Legacy/multibit-hd

/**
 * Perform a cloud zip backup
 */
private void performCloudZipBackup() {
 if (rememberedWalletIdForCloudBackup.isPresent() && rememberedPasswordForCloudBackup.isPresent()) {
  log.debug("Performing a cloud zip backup");
  try {
   BackupManager.INSTANCE.createCloudBackup(rememberedWalletIdForCloudBackup.get(), rememberedPasswordForCloudBackup.get());
   // Don't use anything remembered in the past at this point again
   // (This will miss anything newly remembered whilst the backup is taking place
   rememberedWalletIdForCloudBackup = Optional.absent();
   rememberedPasswordForCloudBackup = Optional.absent();
  } catch (IOException ioe) {
   log.error("Failed to perform cloud backup", ioe);
   CoreEvents.fireEnvironmentEvent(EnvironmentSummary.newBackupFailed());
  }
 } else {
  log.debug("Cannot perform cloud backup as no remembered wallet id or password is available");
 }
}
origin: Multibit-Legacy/multibit-hd

/**
 * Perform a local zip backup
 */
private void performLocalZipBackup() {
 if (rememberedWalletIdForLocalBackup.isPresent() && rememberedPasswordForLocalBackup.isPresent()) {
  log.debug("Performing a local zip backup");
  try {
   BackupManager.INSTANCE.createLocalBackup(rememberedWalletIdForLocalBackup.get(), rememberedPasswordForLocalBackup.get());
   // Don't use anything remembered in the past at this point again
   // (This will miss anything newly remembered whilst the backup is taking place
   rememberedWalletIdForLocalBackup = Optional.absent();
   rememberedPasswordForLocalBackup = Optional.absent();
  } catch (IOException ioe) {
   log.error("Failed to perform local backup", ioe);
   // TODO handle exception (which is thrown inside the main runnable)
  }
 }
}
origin: Multibit-Legacy/multibit-hd

/**
 * Load a zip backup file, copying all the backup files to the appropriate wallet root directory
 *
 * @param backupFileToLoad The encrypted backup file to load
 * @param seedPhrase       The seed phrase to use to decrypt the backup file
 */
public WalletId loadZipBackup(File backupFileToLoad, List<String> seedPhrase) throws IOException {
 try {
  SeedPhraseGenerator seedPhraseGenerator = new Bip39SeedPhraseGenerator();
  byte[] seed = seedPhraseGenerator.convertToSeed(seedPhrase);
  KeyParameter seedDerivedAESKey = org.multibit.commons.crypto.AESUtils.createAESKey(seed, WalletManager.scryptSalt());
  return loadZipBackup(backupFileToLoad, seedDerivedAESKey);
 } catch (Exception e) {
  throw new EncryptedFileReaderWriterException("Cannot read and decrypt the backup file '" + backupFileToLoad.getAbsolutePath() + "'", e);
 }
}
origin: Multibit-Legacy/multibit-hd

/**
 * Handles the process of shutting down the current wallet support services
 */
public void shutdownCurrentWallet(ShutdownEvent.ShutdownType shutdownType) {
 log.debug("Shutdown current wallet...");
 if (!shutdownType.equals(ShutdownEvent.ShutdownType.SWITCH)) {
  // Hide the UI if not switching
  shutdownMainView();
 }
 // Provide a graceful shutdown of the relevant core services in the correct order
 CoreServices.shutdownNow(shutdownType);
 // Close the current wallet
 WalletManager.INSTANCE.shutdownNow(shutdownType);
 // Close the backup manager for the wallet
 BackupManager.INSTANCE.shutdownNow();
 // Close the installation manager
 InstallationManager.shutdownNow(shutdownType);
}
origin: Multibit-Legacy/multibit-hd

createApplicationDataDirectoryIfNotSet();
 thinBackupDirectory(walletId, cloudBackupDirectory.get());
origin: Multibit-Legacy/multibit-hd

Preconditions.checkNotNull(walletSummary.getWallet(), "'wallet' must be present");
Preconditions.checkNotNull(walletSummary.getWalletId(), "'walletId' must be present");
createApplicationDataDirectoryIfNotSet();
log.debug("Created rolling-backup AES copy successfully as file:\n'{}'", encryptedAESCopy == null ? "" : encryptedAESCopy.getAbsolutePath());
List<File> rollingBackups = getRollingBackups(walletSummary.getWalletId());
origin: Multibit-Legacy/multibit-hd

/**
 * Get all the backups available in the cloud backup directory for the wallet id specified.
 */
public List<BackupSummary> getCloudBackups(WalletId walletId, File cloudBackupDirectory) {
 return getWalletBackups(walletId, cloudBackupDirectory);
}
origin: Multibit-Legacy/multibit-hd

/**
 * Perform a rolling backup using the last remembered wallet summary and credentials
 */
private void performRollingBackup() {
 if (rememberedWalletSummaryForRollingBackup.isPresent() && rememberedPasswordForRollingBackup.isPresent()) {
  log.debug("Performing a rolling backup");
  try {
   BackupManager.INSTANCE.createRollingBackup(rememberedWalletSummaryForRollingBackup.get(), rememberedPasswordForRollingBackup.get());
   // Don't use anything remembered in the past at this point again
   // (This will miss anything newly remembered whilst the backup is taking place
   rememberedWalletSummaryForRollingBackup = Optional.absent();
   rememberedPasswordForRollingBackup = Optional.absent();
  } catch (IOException ioe) {
   log.error("Failed to perform rolling backup", ioe);
   // TODO handle exception (which is thrown inside the main runnable)
  }
 }
}
origin: Multibit-Legacy/multibit-hd

createApplicationDataDirectoryIfNotSet();
origin: Multibit-Legacy/multibit-hd

/**
 * @return True if backups are present in the cloud backup location given by the user
 */
private boolean isCloudBackupPresent() {
 // Ensure we start from a fresh list
 backupSummaries.clear();
 // Get the cloud backups matching the entered seed
 try {
  // If no walletid is set (done with Trezor wallets) then work it out from the entered seed
  if (!walletId.isPresent()) {
   EnterSeedPhraseModel restoreWalletEnterSeedPhraseModel = getRestoreWalletEnterSeedPhraseModel();
   SeedPhraseGenerator seedGenerator = new Bip39SeedPhraseGenerator();
   byte[] seed = seedGenerator.convertToSeed(restoreWalletEnterSeedPhraseModel.getSeedPhrase());
   walletId = Optional.of(new WalletId(seed));
  }
  backupSummaries = BackupManager.INSTANCE.getCloudBackups(walletId.get(), new File(getRestoreLocation()));
  log.debug("There are {} cloud zip backups available", backupSummaries.size());
  return !backupSummaries.isEmpty();
 } catch (SeedPhraseException spe) {
  log.error("The seed phrase is incorrect.");
  return false;
 }
}
origin: Multibit-Legacy/multibit-hd

/**
 * @return True if backups are present in the local zip backup location
 */
private boolean isLocalZipBackupPresent() {
 // Ensure we start from a fresh list
 backupSummaries.clear();
 // Get the local backups
 try {
  // If no walletid is set (done with Trezor wallets) then work it out from the entered seed
  if (!walletId.isPresent()) {
   EnterSeedPhraseModel restoreWalletEnterSeedPhraseModel = getRestoreWalletEnterSeedPhraseModel();
   if (restoreWalletEnterSeedPhraseModel == null) {
    // Avoid possible NPE
    return false;
   }
   SeedPhraseGenerator seedGenerator = new Bip39SeedPhraseGenerator();
   byte[] seed = seedGenerator.convertToSeed(restoreWalletEnterSeedPhraseModel.getSeedPhrase());
   walletId = Optional.of(new WalletId(seed));
  }
  backupSummaries = BackupManager.INSTANCE.getLocalZipBackups(walletId.get());
  log.debug("There are {} local zip backups available", backupSummaries.size());
  return !backupSummaries.isEmpty();
 } catch (SeedPhraseException spe) {
  log.error("The seed phrase is incorrect.");
  return false;
 }
}
origin: Multibit-Legacy/multibit-hd

List<File> rollingBackupFiles = getRollingBackups(walletId);
origin: Multibit-Legacy/multibit-hd

WalletId loadedWalletId = BackupManager.INSTANCE.loadZipBackup(selectedBackupSummaryModel.getValue().getFile(), backupAESKey);
origin: Multibit-Legacy/multibit-hd

BackupManager.INSTANCE.shutdownNow();
origin: Multibit-Legacy/multibit-hd

createApplicationDataDirectoryIfNotSet();
thinBackupDirectory(walletId, localBackupDirectory);
origin: Multibit-Legacy/multibit-hd

List<BackupSummary> backups = getWalletBackups(walletId, backupDirectory);
origin: Multibit-Legacy/multibit-hd

try {
 WalletId loadedWalletId = BackupManager.INSTANCE.loadZipBackup(selectedBackupSummaryModel.getValue().getFile(), seedPhrase);
org.multibit.hd.core.managersBackupManager

Javadoc

Class to manage creation and reading back of the wallet backups.

Most used methods

  • loadZipBackup
    Load a zip backup file, copying all the backup files to the appropriate wallet root directory
  • shutdownNow
  • createApplicationDataDirectoryIfNotSet
  • createCloudBackup
    Create a cloud backup of the specified wallet id. The wallet manager is interrogated to find the phy
  • createLocalBackup
    Create a local zip backup of the specified wallet id. The wallet manager is interrogated to find the
  • createRollingBackup
    Create a rolling backup of the wallet, specified by the walletId. This is a copy of the supplied wal
  • getCloudBackups
    Get all the backups available in the cloud backup directory for the wallet id specified.
  • getLocalZipBackups
    Get all the backups available in the local zip backup directory for the wallet id specified.
  • getRollingBackups
    Get all the available rolling backups These are ordered in the order of timestamp i.e the oldest one
  • getWalletBackups
    Find the wallet backups in a directory. Wallet backups are called mbhd-[formatted wallet id]-timesta
  • initialise
    Initialise the backup manager to use the specified cloudBackupDirectory. All the cloud backups will
  • loadRollingBackup
    Load a rolling backup file. A BackupWalletLoadedEvent is emitted
  • initialise,
  • loadRollingBackup,
  • setApplicationDataDirectory,
  • setCloudBackupDirectory,
  • thinBackupDirectory

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onCreateOptionsMenu (Activity)
  • compareTo (BigDecimal)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Collectors (java.util.stream)
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now