Package org.eblocker.server.http.backup
Class BackupProvider
java.lang.Object
org.eblocker.server.http.backup.BackupProvider
- Direct Known Subclasses:
AppModulesBackupProvider,DevicesBackupProvider,HttpsKeysBackupProvider,OpenVpnClientBackupProvider,OpenVpnServerBackupProvider,RegistrationBackupProvider,TorConfigBackupProvider
A BackupProvider exports/imports configuration data to/from one or more
files in the configuration JAR file.
A new BackupProvider is created for each export, import and verification action.
It stores any warnings that may have occurred during an action. For example,
if the password was not provided for the import (because the user forgot it),
all providers that restore encrypted data should add a warning that they could
not restore it.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBackupProvider(org.eblocker.crypto.CryptoService cryptoService) Create a backup provider with optional support for @JsonEncrypt annotation. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddWarning(BackupWarning warning) booleanbooleanabstract voidexportConfiguration(JarOutputStream outputStream) Export the configuration to the given JarOutputStream.protected static voidgetNextEntry(JarInputStream jarStream, String name) Read the next entry from a JarInputStream and make sure it has the expected name and is not a directoryabstract voidimportConfiguration(JarInputStream inputStream, int schemaVersion) Import the configuration from the given JarInputStream.abstract voidverifyConfiguration(JarInputStream inputStream, int schemaVersion) Verify the configuration from the given JarInputStream.protected static voidwriteNextEntry(JarOutputStream outputStream, String name, byte[] content) Write the next entry into the given JarOutputStream.
-
Field Details
-
encryptionEnabled
protected boolean encryptionEnabled
-
-
Constructor Details
-
BackupProvider
public BackupProvider() -
BackupProvider
Create a backup provider with optional support for @JsonEncrypt annotation.- Parameters:
cryptoService- if not null, a JsonEncryptionModule is registered in the ObjectMapper
-
-
Method Details
-
exportConfiguration
Export the configuration to the given JarOutputStream.- Throws:
IOException
-
importConfiguration
public abstract void importConfiguration(JarInputStream inputStream, int schemaVersion) throws IOException Import the configuration from the given JarInputStream.- Throws:
IOException
-
verifyConfiguration
public abstract void verifyConfiguration(JarInputStream inputStream, int schemaVersion) throws IOException Verify the configuration from the given JarInputStream.- Throws:
IOException
-
writeNextEntry
protected static void writeNextEntry(JarOutputStream outputStream, String name, byte[] content) throws IOException Write the next entry into the given JarOutputStream.- Parameters:
outputStream- JarOutputStreamname- name of the next entrycontent- content of the next entry- Throws:
IOException
-
getNextEntry
Read the next entry from a JarInputStream and make sure it has the expected name and is not a directory- Parameters:
jarStream- JarInputStreamname- expected name of the next entry. If it does not match, a CorruptedBackupException is thrown.- Throws:
IOException
-
addWarning
-
getWarnings
-
canEncrypt
public boolean canEncrypt() -
canDecrypt
public boolean canDecrypt()
-