public class BackupManager extends Object
Backupable
Constructor and Description |
---|
BackupManager(String backendID)
Construct a backup manager for a backend.
|
Modifier and Type | Method and Description |
---|---|
void |
createBackup(Backupable backupable,
BackupConfig backupConfig)
Creates a backup of the provided backupable entity.
|
static void |
createBackup(File directory,
FileFilter fileFilter,
BackupConfig backupConfig,
String backendId)
Performs a backup according to the provided
BackupConfig . |
static List<Path> |
getFiles(File directory,
FileFilter filter,
String identifier)
Helper method to build a list of files to backup, in the simple case where all files are located under the
provided directory.
|
void |
removeBackup(BackupDirectory backupDir,
String backupID)
Removes the specified backup if it is possible to do so.
|
void |
restoreBackup(Backupable backupable,
RestoreConfig restoreConfig)
Restores a backupable entity from its backup, or verify the backup.
|
static void |
restoreBackup(File targetDirectory,
FileFilter fileFilter,
RestoreConfig restoreConfig,
String backendId)
Performs a direct restore or verifies the backup according to the provided
RestoreConfig . |
static Path |
saveCurrentFilesToDirectory(Backupable backupable,
String identifier)
Helper method to save all current files of the provided backupable entity, using default behavior.
|
public BackupManager(String backendID)
backendID
- The ID of the backend instance for which a backup manager is required.public static void createBackup(File directory, FileFilter fileFilter, BackupConfig backupConfig, String backendId) throws LdapException
BackupConfig
.directory
- The directory containing all the files to be backed-up.fileFilter
- The file filter for selecting the files to be backed-up within the directory.backupConfig
- The backup configuration.backendId
- The id of the backend being backed-up, only used for logging.LdapException
- If a Directory Server error occurs.public static void restoreBackup(File targetDirectory, FileFilter fileFilter, RestoreConfig restoreConfig, String backendId) throws LdapException
RestoreConfig
.targetDirectory
- The directory where the backup should be restored.fileFilter
- The file filter for selecting the files that should be temporarilly backed-up within the targetDirectory
during the restore process.restoreConfig
- The restore configurationbackendId
- The id of the backend being restored, only used for logging.LdapException
- If a Directory Server error occurs.public void createBackup(Backupable backupable, BackupConfig backupConfig) throws LdapException
The backup is stored in a single zip file in the backup directory.
If the backup is incremental, then the first entry in the zip is a text file containing a list of all the log files that are unchanged since the previous backup. The remaining zip entries are the log files themselves, which, for an incremental, only include those files that have changed.
backupable
- The underlying entity (storage, backend) to be backed up.backupConfig
- The configuration to use when performing the backup.LdapException
- If a Directory Server error occurs.public void restoreBackup(Backupable backupable, RestoreConfig restoreConfig) throws LdapException
backupable
- The underlying entity (storage, backend) to be backed up.restoreConfig
- The configuration to use when performing the restore.LdapException
- If a Directory Server error occurs.public void removeBackup(BackupDirectory backupDir, String backupID) throws LdapException
backupDir
- The backup directory structure with which the specified backup is associated.backupID
- The backup ID for the backup to be removed.LdapException
- If it is not possible to remove the specified backup for some reason (e.g., no such backup exists or
there are other backups that are dependent upon it).public static List<Path> getFiles(File directory, FileFilter filter, String identifier) throws LdapException
directory
- The directory containing files to backup.filter
- The filter to select files to backup.identifier
- Identifier of the backed-up entitynull
LdapException
- if an error occurs.public static Path saveCurrentFilesToDirectory(Backupable backupable, String identifier) throws LdapException
backupable
- The entity to backup.identifier
- Identifier of the backupLdapException
- If a problem occurs.Copyright 2010-2022 ForgeRock AS.