Package net.solarnetwork.node.backup
Interface BackupManager
- All Superinterfaces:
net.solarnetwork.settings.SettingSpecifierProvider
- All Known Implementing Classes:
DefaultBackupManager
public interface BackupManager
extends net.solarnetwork.settings.SettingSpecifierProvider
Manager API for node-level backups.
- Version:
- 2.0
- Author:
- matt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA property key aBackupkeyvalue.static final StringA property key for a comma-delimited list ofBackupResourceProvider.getKey()values to limit the backup operation to. -
Method Summary
Modifier and TypeMethodDescriptionGet the activeBackupService.Create a new Backup, using the active backup service, in the background.createAsynchronousBackup(Map<String, String> props) Create a new Backup, using the active backup service, in the background.Create a new Backup, using the active backup service.createBackup(Map<String, String> props) Create a new Backup, using the active backup service.voidexportBackupArchive(String backupKey, OutputStream out) Export a backup zip archive.voidexportBackupArchive(String backupKey, OutputStream out, Map<String, String> props) Export a backup zip archive.importBackupArchive(InputStream archive) Import a backup archive into the active backup service.importBackupArchive(InputStream archive, Map<String, String> props) Import a backup archive with properties.infoForBackup(String key, Locale locale) Get metadata about a particular backup.Get aIteratorofBackupResourceneeding to be backed up.voidrestoreBackup(Backup backup) Restore all resources from a given backup.voidrestoreBackup(Backup backup, Map<String, String> props) Restore all resources from a given backup.Methods inherited from interface net.solarnetwork.settings.SettingSpecifierProvider
getDisplayName, getMessageSource, getSettingSpecifiers, getSettingUid, templateSettingSpecifiers
-
Field Details
-
RESOURCE_PROVIDER_FILTER
A property key for a comma-delimited list ofBackupResourceProvider.getKey()values to limit the backup operation to. If not specified, all providers are included.- Since:
- 1.1
- See Also:
-
BACKUP_KEY
A property key aBackupkeyvalue.- Since:
- 1.2
- See Also:
-
-
Method Details
-
activeBackupService
BackupService activeBackupService()Get the activeBackupService.- Returns:
- the BackupService, or null if none configured
-
resourcesForBackup
Iterable<BackupResource> resourcesForBackup()Get aIteratorofBackupResourceneeding to be backed up.- Returns:
- the backup resources
-
createBackup
Backup createBackup()Create a new Backup, using the active backup service.- Returns:
- the backup, or null if none could be created
-
createBackup
Create a new Backup, using the active backup service.- Parameters:
props- An optional set of properties to customize the backup with.- Returns:
- the backup, or null if none could be created
- Since:
- 1.1
-
createAsynchronousBackup
Create a new Backup, using the active backup service, in the background. This method will immediately return a Future where you can track the status of the background backup, if desired.- Returns:
- the backup, or null if none could be created
-
createAsynchronousBackup
Create a new Backup, using the active backup service, in the background. This method will immediately return a Future where you can track the status of the background backup, if desired.- Parameters:
props- An optional set of properties to customize the backup with.- Returns:
- the backup, or null if none could be created
- Since:
- 1.1
-
restoreBackup
Restore all resources from a given backup.- Parameters:
backup- the backup to restore
-
restoreBackup
Restore all resources from a given backup.- Parameters:
backup- the backup to restoreprops- An optional set of properties to customize the backup with.- Since:
- 1.1
-
exportBackupArchive
Export a backup zip archive.- Parameters:
backupKey- the backup to exportout- the output stream to export to- Throws:
IOException- if any IO error occurs
-
exportBackupArchive
void exportBackupArchive(String backupKey, OutputStream out, Map<String, String> props) throws IOExceptionExport a backup zip archive.- Parameters:
backupKey- the backup to exportout- the output stream to export toprops- An optional set of properties to customize the backup with.- Throws:
IOException- if any IO error occurs- Since:
- 1.1
-
importBackupArchive
Import a backup archive into the active backup service. This method can import an archive exported viaexportBackupArchive(String, OutputStream). Once imported, the backup will appear as a new backup in the active backup service.- Parameters:
archive- the archive input stream to import- Returns:
- the backup future
- Throws:
IOException- if any IO error occurs
-
importBackupArchive
Future<Backup> importBackupArchive(InputStream archive, Map<String, String> props) throws IOExceptionImport a backup archive with properties. This method can import an archive exported viaexportBackupArchive(String, OutputStream). TheRESOURCE_PROVIDER_FILTERproperty can be used to filter which provider resources are included in the imported backup. TheBACKUP_KEYcan be used to provide a hint of the original backup key (and possibly date). Once imported, the backup will appear as a new backup in the active backup service.- Parameters:
archive- the archive input stream to importprops- An optional set of properties to customize the backup with.- Returns:
- the backup future
- Throws:
IOException- if any IO error occurs- Since:
- 1.1
-
infoForBackup
Get metadata about a particular backup.- Parameters:
key- The key of the backup to get the information for.locale- The desired locale of the information, or null for the system locale.- Returns:
- The backup info, or null if no backup is available for the given key.
- Since:
- 1.2
-