public final class PDBStorage extends Object implements Storage, Backupable, ConfigurationChangeListener<PDBBackendCfg>, DiskSpaceMonitorHandler
Storage engine.| Constructor and Description |
|---|
PDBStorage(PDBBackendCfg cfg,
ServerContext serverContext)
Creates a new persistit storage with the provided configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterRestore(Path restoreDirectory,
Path saveDirectory)
Called after the restore operation has finished successfully.
|
ConfigChangeResult |
applyConfigurationChange(PDBBackendCfg cfg)
Applies the configuration changes to this change listener.
|
Path |
beforeRestore()
Called before the restore operation begins.
|
void |
close() |
void |
createBackup(BackupConfig backupConfig)
Creates a backup for this storage.
|
void |
diskFullThresholdReached(File directory,
long thresholdInBytes)
Notifies that the registered "full" threshold have been reached.
|
void |
diskLowThresholdReached(File directory,
long thresholdInBytes)
Notifies that the registered "low" threshold have been reached.
|
void |
diskSpaceRestored(File directory,
long lowThresholdInBytes,
long fullThresholdInBytes)
Notifies that the free disk space is now above both "low" and "full" thresholds.
|
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.
|
StorageStatus |
getStorageStatus()
Returns the current status of the storage.
|
boolean |
isConfigurationChangeAcceptable(PDBBackendCfg newCfg,
List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is
acceptable to this change listener.
|
boolean |
isDirectRestore()
Indicates if restore is done directly in the restore directory.
|
Set<TreeName> |
listTrees()
TODO JNR.
|
void |
open(AccessMode accessMode)
Opens the storage engine to allow executing operations on it.
|
<T> T |
read(ReadOperation<T> operation)
Executes a read operation.
|
void |
removeBackup(BackupDirectory backupDirectory,
String backupID)
Removes a backup for this storage.
|
void |
removeStorageFiles()
Remove all files for a backend of this storage.
|
void |
restoreBackup(RestoreConfig restoreConfig)
Restores a backup for this storage.
|
Importer |
startImport()
Starts the import operation.
|
boolean |
supportsBackupAndRestore()
Returns
true if this storage supports backup and restore. |
void |
write(WriteOperation operation)
Executes a write operation.
|
public PDBStorage(PDBBackendCfg cfg, ServerContext serverContext) throws ConfigException
cfg - The configuration.serverContext - This server instance contextConfigException - if memory cannot be reservedpublic void close()
public void open(AccessMode accessMode) throws ConfigException, StorageRuntimeException
open in interface StorageaccessMode - Specify the access mode to this storage.ConfigExceptionStorageRuntimeExceptionto release all resources once import is finishedpublic <T> T read(ReadOperation<T> operation) throws Exception
public Importer startImport() throws ConfigException, StorageRuntimeException
startImport in interface StorageConfigException - if there is a problem with the configurationStorageRuntimeException - if a problem occurs with the underlying storage engineto release all resources once import is finishedpublic void write(WriteOperation operation) throws Exception
public boolean supportsBackupAndRestore()
Storagetrue if this storage supports backup and restore.supportsBackupAndRestore in interface Storagetrue if this storage supports backup and restore.public File getDirectory()
BackupablegetDirectory in interface Backupablepublic ListIterator<Path> getFilesToBackup() throws DirectoryException
BackupablegetFilesToBackup in interface BackupablenullDirectoryException - If an error occurs.public Path beforeRestore() throws DirectoryException
BackupableIn 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.
beforeRestore in interface Backupablenull
if not applicable.DirectoryException - If an error occurs.public boolean isDirectRestore()
BackupableisDirectRestore in interface Backupabletrue if restore is done directly in the restore directory
provided by getDirectory() method, or false if restore
is done in a temporary directory.public void afterRestore(Path restoreDirectory, Path saveDirectory) throws DirectoryException
BackupableFor 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.
afterRestore in interface BackupablerestoreDirectory - 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.DirectoryException - If an error occurs.public void createBackup(BackupConfig backupConfig) throws DirectoryException
StoragecreateBackup in interface StoragebackupConfig - The configuration to use when performing the backup.DirectoryException - If a Directory Server error occurs.public void removeBackup(BackupDirectory backupDirectory, String backupID) throws DirectoryException
StorageremoveBackup in interface StoragebackupDirectory - 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.public void restoreBackup(RestoreConfig restoreConfig) throws DirectoryException
StoragerestoreBackup in interface StoragerestoreConfig - The configuration to use when performing the restore.DirectoryException - If a Directory Server error occurs.public boolean isConfigurationChangeAcceptable(PDBBackendCfg newCfg, List<LocalizableMessage> unacceptableReasons)
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<PDBBackendCfg>newCfg - The new configuration containing the changes.unacceptableReasons - A list that can be used to hold messages about why the
provided configuration is not acceptable.true if the proposed change is
acceptable, or false if it is not.public ConfigChangeResult applyConfigurationChange(PDBBackendCfg cfg)
applyConfigurationChange in interface ConfigurationChangeListener<PDBBackendCfg>cfg - The new configuration containing the changes.public void removeStorageFiles() throws StorageRuntimeException
StorageremoveStorageFiles in interface StorageStorageRuntimeException - if removal failspublic StorageStatus getStorageStatus()
StoragegetStorageStatus in interface Storagepublic void diskFullThresholdReached(File directory, long thresholdInBytes)
diskFullThresholdReached in interface DiskSpaceMonitorHandlerdirectory - the directory for which the threshold has been triggeredthresholdInBytes - the threshold value in bytespublic void diskLowThresholdReached(File directory, long thresholdInBytes)
diskLowThresholdReached in interface DiskSpaceMonitorHandlerdirectory - the directory for which the threshold has been triggeredthresholdInBytes - the threshold value in bytespublic void diskSpaceRestored(File directory, long lowThresholdInBytes, long fullThresholdInBytes)
diskSpaceRestored in interface DiskSpaceMonitorHandlerdirectory - the directory for which the threshold has been triggeredTODOlowThresholdInBytes - the low threshold value in bytesfullThresholdInBytes - the full threshold value in bytesCopyright © 2010-2015 ForgeRock AS. All Rights Reserved.