Class RestoreRunner


  • public final class RestoreRunner
    extends Object
    This class implements all the business logic for the dsbackup restore sub-command, whether offline or online.
    • Constructor Detail

      • RestoreRunner

        public RestoreRunner()
    • Method Detail

      • serverContext

        public RestoreRunner serverContext​(ServerContext serverContext)
        Sets the server context.
        Parameters:
        serverContext - The server context.
        Returns:
        A reference to this restore runner.
      • backupIds

        public RestoreRunner backupIds​(Set<BackupId> backupIds)
        Sets the backupId argument values.
        Parameters:
        backupIds - The backup IDs.
        Returns:
        A reference to this restore runner.
      • backendNames

        public RestoreRunner backendNames​(Set<String> backendNames)
        Sets the backendName argument values.
        Parameters:
        backendNames - The backend names.
        Returns:
        A reference to this restore runner.
      • enabledBackends

        public RestoreRunner 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 restore runner.
      • baseDirectory

        public RestoreRunner 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 restore runner.
      • storage

        public RestoreRunner 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 restore runner.
      • runOnline

        public RestoreRunner runOnline​(BackendConfigManager backendConfigManager)
        Indicates that restore will happen online and that backends being restored should be disabled and enabled with the provided backend config manager.
        Parameters:
        backendConfigManager - The backend config manager.
        Returns:
        A reference to this restore runner.
      • interruptWith

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

        public RestoreRunner listeners​(Consumer<LocalBackend<?>> restoreStartListener,
                                       Consumer<LocalBackend<?>> restoreEndListener)
        Sets the listeners that should be called before and after each backend has been restored.
        Parameters:
        restoreStartListener - The listener that should be called before a backend will be restored.
        restoreEndListener - The listener that should be called after a backend has been restored, regardless of whether restore failed.
        Returns:
        A reference to this restore runner.
      • run

        public void run()
                 throws com.forgerock.opendj.cli.ClientException
        Runs the restore command. This attempts to restore the backup taken from hte backupId argument and will fail if the backup cannot be found or the corresponding backend does not exist or is not enabled. When running online, this method will fail if the corresponding backend does not support online restore.
        Throws:
        com.forgerock.opendj.cli.ClientException - If the backup cannot be restored.