Search in sources :

Example 1 with BackupUploadException

use of nl.knaw.huygens.timbuctoo.v5.backupforstaging.exceptions.BackupUploadException in project timbuctoo by HuygensING.

the class DatabaseBackupper method makeBackup.

public void makeBackup() throws BackupUploadException {
    try {
        final File tempFile = File.createTempFile("stagingBackup", "zip");
        try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(tempFile.getAbsolutePath()))) {
            backupFolder(neo4jPath, zos);
            backupFolder(dataSetPath, zos);
        }
        uploader.storeBackup(tempFile);
    } catch (IOException e) {
        throw new BackupUploadException(e);
    }
}
Also used : BackupUploadException(nl.knaw.huygens.timbuctoo.v5.backupforstaging.exceptions.BackupUploadException) ZipOutputStream(java.util.zip.ZipOutputStream) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File)

Example 2 with BackupUploadException

use of nl.knaw.huygens.timbuctoo.v5.backupforstaging.exceptions.BackupUploadException in project timbuctoo by HuygensING.

the class AzureBlobBackupUploader method storeBackup.

@Override
public void storeBackup(File zipfile) throws BackupUploadException {
    try {
        final CloudBlockBlob blob = container.getBlockBlobReference(blobname);
        blob.upload(new FileInputStream(zipfile), zipfile.length());
    } catch (URISyntaxException | StorageException | IOException e) {
        throw new BackupUploadException(e);
    }
}
Also used : BackupUploadException(nl.knaw.huygens.timbuctoo.v5.backupforstaging.exceptions.BackupUploadException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) CloudBlockBlob(com.microsoft.azure.storage.blob.CloudBlockBlob) StorageException(com.microsoft.azure.storage.StorageException) FileInputStream(java.io.FileInputStream)

Aggregations

IOException (java.io.IOException)2 BackupUploadException (nl.knaw.huygens.timbuctoo.v5.backupforstaging.exceptions.BackupUploadException)2 StorageException (com.microsoft.azure.storage.StorageException)1 CloudBlockBlob (com.microsoft.azure.storage.blob.CloudBlockBlob)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 URISyntaxException (java.net.URISyntaxException)1 ZipOutputStream (java.util.zip.ZipOutputStream)1