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 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 Path |
saveCurrentFilesToDirectory(Backupable backupable,
String identifier)
Helper method to save all current files of the provided backupable entity, using
default behavior.
|
static Path |
saveFilesToDirectory(Path rootDirectory,
ListIterator<Path> files,
String targetBasePath,
String identifier)
Helper method to move all provided files in a target directory created from
provided target base path, keeping relative path information relative to
root directory.
|
public BackupManager(String backendID)
backendID
- The ID of the backend instance for which a backup manager is
required.public void createBackup(Backupable backupable, BackupConfig backupConfig) throws DirectoryException
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.DirectoryException
- If a Directory Server error occurs.public void restoreBackup(Backupable backupable, RestoreConfig restoreConfig) throws DirectoryException
backupable
- The underlying entity (storage, backend) to be backed up.restoreConfig
- The configuration to use when performing the restore.DirectoryException
- If a Directory Server error occurs.public void removeBackup(BackupDirectory backupDir, String backupID) throws DirectoryException
backupDir
- The backup directory structure with which the
specified backup is associated.backupID
- The backup ID for the backup to be removed.DirectoryException
- 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 DirectoryException
directory
- The directory containing files to backup.filter
- The filter to select files to backup.identifier
- Identifier of the backed-up entitynull
DirectoryException
- if an error occurs.public static Path saveCurrentFilesToDirectory(Backupable backupable, String identifier) throws DirectoryException
backupable
- The entity to backup.identifier
- Identifier of the backupDirectoryException
- If a problem occurs.public static Path saveFilesToDirectory(Path rootDirectory, ListIterator<Path> files, String targetBasePath, String identifier) throws DirectoryException
rootDirectory
- A directory which is an ancestor of all provided files.files
- The files to move.targetBasePath
- Base path of the target directory. Actual directory is built by
adding ".save" and a number, always ensuring that the directory is new.identifier
- Identifier of the backupDirectoryException
- If a problem occurs.Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.