Class BackupRunner

java.lang.Object
org.opends.server.tools.dsbackup.BackupRunner
All Implemented Interfaces:
AlertGenerator

public final class BackupRunner extends Object implements AlertGenerator
This class implements all the business logic for the dsbackup create sub-command, whether offline or online.
  • Constructor Details

    • BackupRunner

      public BackupRunner()
  • Method Details

    • backendNames

      public BackupRunner backendNames(Set<String> backendNames)
      Sets the backendName argument values.
      Parameters:
      backendNames - The backendName argument values.
      Returns:
      A reference to this backup runner.
    • baseDirectory

      public BackupRunner baseDirectory(Path baseDirectory)
      Sets the base directory ie the directory which will be used as the working directory if ever the given backup location is relative local file-system path.
      Parameters:
      baseDirectory - The base directory.
      Returns:
      A reference to this backup runner.
    • storage

      public BackupRunner storage(String backupLocation, Map<String,String> properties)
      Register the backup location and the properties for the backup storage.
      Parameters:
      backupLocation - The location of the backup.
      properties - The properties of the backup storage.
      Returns:
      A reference to this backup runner.
    • serverContext

      public BackupRunner serverContext(ServerContext serverContext)
      Sets the server context.
      Parameters:
      serverContext - The server context.
      Returns:
      A reference to this backup runner.
    • enabledBackends

      public BackupRunner enabledBackends(Collection<LocalBackend<?>> enabledBackends)
      Sets the collection of backends that are currently enabled in the Directory Server.
      Parameters:
      enabledBackends - The enabled backends.
      Returns:
      A reference to this backup runner.
    • interruptWith

      public BackupRunner interruptWith(Cancellable cancellable)
      Sets the cancellable for interrupting backup operations.
      Parameters:
      cancellable - The cancellable.
      Returns:
      A reference to this backup runner.
    • listeners

      public BackupRunner listeners(Consumer<LocalBackend<?>> backupStartListener, Consumer<LocalBackend<?>> backupEndListener)
      Sets the listeners that should be called before and after each backend is backed up.
      Parameters:
      backupStartListener - The listener that will be called before each backend is backed up.
      backupEndListener - The listener that will be called after each backend is backed up, regardless of whether backup failed.
      Returns:
      A reference to this backup runner.
    • run

      public void run() throws com.forgerock.opendj.cli.ClientException
      Runs the backup command, depending on user arguments and what backends are currently enabled, this will backup zero, one or more backends. This method continues on errors and will throw an exception if at least one backup attempt has failed.
      Throws:
      com.forgerock.opendj.cli.ClientException - If at least one backend that should have been backed up could not be backed up.
    • getComponentEntryDN

      public Dn getComponentEntryDN()
      Description copied from interface: AlertGenerator
      Retrieves the DN of the configuration entry with which this alert generator is associated.
      Specified by:
      getComponentEntryDN in interface AlertGenerator
      Returns:
      The DN of the configuration entry with which this alert generator is associated.
    • getAlerts

      public Map<String,String> getAlerts()
      Description copied from interface: AlertGenerator
      Retrieves information about the set of alerts that this generator may produce. The map returned should be between the notification type for a particular notification and the human-readable description for that notification. This alert generator must not generate any alerts with types that are not contained in this list.
      Specified by:
      getAlerts in interface AlertGenerator
      Returns:
      Information about the set of alerts that this generator may produce.