public interface Backupable
The files to backup must be located under a root directory given by getDirectory()
method. They can be
located at any depth level in a sub-directory. For example, file1, file2 and file3 can be returned as files to
backup:
+--- rootDirectory | \--- file1 | \--- subDirectory | \--- file2 | \--- file3The
getDirectory()
method is also used to provide the root directory used for the restore of the backup. The
actual restore directory depends on the strategy used for restore, which can be one of these two:
getDirectory()
method. It is
the responsibility of the backupable entity to manage saving of current files before the restore, and to discard them
at the end of a successful restore.getDirectory()
method (suffixed by "restore-[backupID]"). It is the responsibility of the backupable entity
to switch from the temporary directory to the final one.
The restore strategy is given by isDirectRestore()
method: if true
, it is a direct restore, otherwise
it is an indirect restore.
Actions taken before and after the restore should be handled in the beforeRestore()
and
afterRestore(Path, Path)
methods.
BackupManager
Modifier and Type | Method and Description |
---|---|
void |
afterRestore(Path restoreDirectory,
Path saveDirectory)
Called after the restore operation has finished successfully.
|
Path |
beforeRestore()
Called before the restore operation begins.
|
File |
getDirectory()
Returns the directory which acts as the root of all files to backup and restore.
|
ListIterator<Path> |
getFilesToBackup()
Returns the files to backup.
|
boolean |
isDirectRestore()
Indicates if restore is done directly in the restore directory.
|
ListIterator<Path> getFilesToBackup() throws LdapException
null
LdapException
- If an error occurs.File getDirectory()
boolean isDirectRestore()
true
if restore is done directly in the restore directory provided by getDirectory()
method, or false
if restore is done in a temporary directory.Path beforeRestore() throws LdapException
In case of direct restore, the backupable entity should take any action to save a copy of existing data before restore operation. Saving includes removing the existing data and copying it in a save directory.
null
if not applicable.LdapException
- If an error occurs.void afterRestore(Path restoreDirectory, Path saveDirectory) throws LdapException
For direct restore, the backupable entity can safely discard the saved copy. For indirect restore, the backupable entity should switch the restored directory to the final restore directory.
restoreDirectory
- The directory in which files have actually been restored. It is never null
.saveDirectory
- The directory in which current files have been saved. It may be null
if
beforeRestore()
returned null
.LdapException
- If an error occurs.Copyright 2010-2022 ForgeRock AS.