Package org.opends.server.tools.dsbackup
Class BackupRunner
- java.lang.Object
-
- org.opends.server.tools.dsbackup.BackupRunner
-
public final class BackupRunner extends Object
This class implements all the business logic for the dsbackup create sub-command, whether offline or online.
-
-
Constructor Summary
Constructors Constructor Description BackupRunner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BackupRunner
backendNames(Set<String> backendNames)
Sets the backendName argument values.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.BackupRunner
enabledBackends(Collection<LocalBackend<?>> enabledBackends)
Sets the collection of backends that are currently enabled in the Directory Server.BackupRunner
interruptWith(Cancellable cancellable)
Sets the cancellable for interrupting backup operations.BackupRunner
listeners(Consumer<LocalBackend<?>> backupStartListener, Consumer<LocalBackend<?>> backupEndListener)
Sets the listeners that should be called before and after each backend is backed up.void
run()
Runs the backup command, depending on user arguments and what backends are currently enabled, this will backup zero, one or more backends.BackupRunner
serverContext(ServerContext serverContext)
Sets the server context.BackupRunner
storage(String backupLocation, Map<String,String> properties)
Register the backup location and the properties for the backup storage.
-
-
-
Method Detail
-
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.
-
-