Package org.opends.server.tools.dsbackup
Class RestoreRunner
java.lang.Object
org.opends.server.tools.dsbackup.RestoreRunner
This class implements all the business logic for the dsbackup restore sub-command, whether offline or
online.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbackendNames
(Set<String> backendNames) Sets the backendName argument values.Sets the backupId argument values.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.enabledBackends
(Collection<LocalBackend<?>> enabledBackends) Sets the collection of backends that are currently enabled in the Directory Server.interruptWith
(Cancellable cancellable) Sets the cancellable for interrupting restore operations.listeners
(Consumer<LocalBackend<?>> restoreStartListener, Consumer<LocalBackend<?>> restoreEndListener) Sets the listeners that should be called before and after each backend has been restored.void
run()
Runs the restore command.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.serverContext
(ServerContext serverContext) Sets the server context.Register the backup location and the properties for the backup storage.
-
Constructor Details
-
RestoreRunner
public RestoreRunner()
-
-
Method Details
-
serverContext
Sets the server context.- Parameters:
serverContext
- The server context.- Returns:
- A reference to this restore runner.
-
backupIds
Sets the backupId argument values.- Parameters:
backupIds
- The backup IDs.- Returns:
- A reference to this restore runner.
-
backendNames
Sets the backendName argument values.- Parameters:
backendNames
- The backend names.- Returns:
- A reference to this restore runner.
-
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
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
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
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
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.ClientExceptionRuns 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.
-