Package org.opends.server.tools.dsbackup
Class PurgeRunner
- java.lang.Object
-
- org.opends.server.tools.dsbackup.PurgeRunner
-
public final class PurgeRunner extends Object
This class implements the business logic for the dsbackup purge sub-command, whether offline or online.
-
-
Constructor Summary
Constructors Constructor Description PurgeRunner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PurgeRunner
backendNames(Set<String> backendNames)
Configures the purge runner to purge only backups of the given backend names.PurgeRunner
backupIds(Set<String> backupIds)
Sets a list of backup IDs to purge.protected PurgeRunner
backupManagerFactory(org.opends.server.tools.dsbackup.BackupRunner.BackupManagerFactory backupManagerFactory)
Sets the backup manager factory.PurgeRunner
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.PurgeRunner
interruptWith(Cancellable cancellable)
Sets the cancellable for interrupting purge operations.PurgeRunner
keepCount(Integer keepCount)
Configures the purge process with a keep count value: purge will save only thekeepCount
latest backups of each backend.PurgeRunner
olderThan(Duration olderThan, boolean forceRemove)
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.PurgeRunner
serverContext(ServerContext serverContext)
Sets the server context.PurgeRunner
storage(String backupLocation, Map<String,String> properties)
Register the backup location and the properties for the backup storage.
-
-
-
Method Detail
-
serverContext
public PurgeRunner serverContext(ServerContext 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
public PurgeRunner 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 runner.
-
storage
public PurgeRunner 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 runner.
-
interruptWith
public PurgeRunner interruptWith(Cancellable cancellable)
Sets the cancellable for interrupting purge operations.- Parameters:
cancellable
- The cancellable.- Returns:
- A reference to this runner.
-
backendNames
public PurgeRunner backendNames(Set<String> 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
public PurgeRunner backupIds(Set<String> backupIds) throws com.forgerock.opendj.cli.ClientException
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
public PurgeRunner keepCount(Integer 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
public PurgeRunner olderThan(Duration olderThan, boolean forceRemove)
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.ClientException
Runs 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.
-
-