Package org.opends.server.tools.dsbackup
Class PurgeRunner
java.lang.Object
org.opends.server.tools.dsbackup.PurgeRunner
This class implements the business logic for the dsbackup purge sub-command,
whether offline or online.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbackendNames
(Set<String> backendNames) Configures the purge runner to purge only backups of the given backend names.Sets a list of backup IDs to purge.protected PurgeRunner
backupManagerFactory
(org.opends.server.tools.dsbackup.BackupRunner.BackupManagerFactory backupManagerFactory) Sets the backup manager factory.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.interruptWith
(Cancellable cancellable) Sets the cancellable for interrupting purge operations.Configures the purge process with a keep count value: purge will save only thekeepCount
latest backups of each backend.Configures the purge runner with a "remove older than" threshold: purge will delete all the backups older than this threshold.void
run()
Runs the purge command.serverContext
(ServerContext serverContext) Sets the server context.Register the backup location and the properties for the backup storage.
-
Constructor Details
-
PurgeRunner
public PurgeRunner()
-
-
Method Details
-
serverContext
Sets the server context.- Parameters:
serverContext
- The server context.- Returns:
- A reference to this runner.
-
backupManagerFactory
protected PurgeRunner backupManagerFactory(org.opends.server.tools.dsbackup.BackupRunner.BackupManagerFactory backupManagerFactory) Sets the backup manager factory.- Parameters:
backupManagerFactory
- The factory to get a backup manager.- Returns:
- A reference to this 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 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 runner.
-
interruptWith
Sets the cancellable for interrupting purge operations.- Parameters:
cancellable
- The cancellable.- Returns:
- A reference to this runner.
-
backendNames
Configures the purge runner to purge only backups of the given backend names. This filter can be combined with the other filters (keepCount
,olderThan
)- Parameters:
backendNames
- The backend names of the backups to purge.- Returns:
- A reference to this runner.
-
backupIds
Sets a list of backup IDs to purge.- Parameters:
backupIds
- The list of backup IDs to purge.- Returns:
- A reference to this runner.
- Throws:
com.forgerock.opendj.cli.ClientException
- if any backup id is invalid
-
keepCount
Configures the purge process with a keep count value: purge will save only thekeepCount
latest backups of each backend.- Parameters:
keepCount
- The number of backups to keep.- Returns:
- A reference to this runner.
-
olderThan
Configures the purge runner with a "remove older than" threshold: purge will delete all the backups older than this threshold. Depending on the value offorceRemove
, the latest backup can be kept even if it is older than the specified threshold.- Parameters:
olderThan
- The threshold to purge the backups.forceRemove
- Indicates whether to remove all the backups if the threshold applies for all the backups. If set tofalse
, then the latest backup is kept even if it is older than the specified threshold- Returns:
- A reference to this runner.
-
run
public void run() throws com.forgerock.opendj.cli.ClientExceptionRuns the purge command. Depending on user arguments, this will purge one or more backups. This method continues on errors and will throw an exception if at least one backup purge has failed.- Throws:
com.forgerock.opendj.cli.ClientException
- If not all backups cannot be purged.
-