Ejemplo n.º 1
0
  /** Stop the backup service. */
  private void stopImpl() {
    logger.logInfo("Stopping backup service .");
    try {
      eventHandler.stop();

      final WorkspaceModel workspaceModel = WorkspaceModel.getInstance();
      workspaceModel.close(workspace);

      logger.logInfo("Backup service stopped.");
    } catch (final Throwable t) {
      throw new BackupException(t, "Failed to stop backup service.");
    }
  }
Ejemplo n.º 2
0
  /** Start the backup service. This involves opening the backup workspace. */
  private void startImpl() {
    logger.logInfo("Starting backup service.");
    try {
      environment = readBackupEnvironment();
      workspace = readBackupWorkspace();
      Assert.assertNotNull(environment, "Backup environment not yet initialized.");
      Assert.assertNotNull(workspace, "Backup workspace not yet initialized.");
      final WorkspaceModel workspaceModel = WorkspaceModel.getInstance();
      if (!workspaceModel.isInitialized(workspace)) {
        workspaceModel.initialize(
            new ProcessAdapter() {
              @Override
              public void beginProcess() {}

              @Override
              public void beginStep(final Step step, final Object data) {}

              @Override
              public void determineSteps(final Integer steps) {}

              @Override
              public void endProcess() {}

              @Override
              public void endStep(final Step step) {}
            },
            new InitializeMediator() {
              public Boolean confirmRestorePremium() {
                return null;
              }

              public Boolean confirmRestoreStandard() {
                return null;
              }
            },
            workspace,
            null);
      }
      eventHandler.start(getModelFactory());
      logger.logInfo("Backup service started.");
    } catch (final Throwable t) {
      throw new BackupException(t, "Failed to start backup service.");
    }
  }
Ejemplo n.º 3
0
 /**
  * Read the backup workspace.
  *
  * @return The backup <code>Workspace</code>.
  */
 private Workspace readBackupWorkspace() {
   Assert.assertNotNull(environment, "Backup environment not yet initialized.");
   Assert.assertNotNull(fileSystem, "Backup file system not yet initialized.");
   final WorkspaceModel workspaceModel = WorkspaceModel.getInstance();
   return workspaceModel.getWorkspace(fileSystem.getRoot());
 }