Search in sources :

Example 6 with BackupInfo

use of com.emc.vipr.model.sys.backup.BackupInfo in project coprhd-controller by CoprHD.

the class BackupDataTable method fetch.

public static List<Backup> fetch(Type type) {
    List<Backup> results = Lists.newArrayList();
    if (type == Type.LOCAL) {
        for (BackupSet backupSet : BackupUtils.getBackups()) {
            Backup backup = new Backup(backupSet);
            BackupInfo backupInfo = BackupUtils.getBackupInfo(backupSet.getName(), true);
            backup.alterLocalBackupInfo(backupInfo);
            results.add(backup);
        }
    } else if (type == Type.REMOTE) {
        try {
            for (String name : BackupUtils.getExternalBackups()) {
                results.add(new Backup(name, true));
            }
        } catch (Exception e) {
            // should trim the error message, otherwise datatable.js#getErrorMessage will fail to parse the response
            throw new RuntimeException(e.getMessage().trim());
        }
    }
    return results;
}
Also used : BackupInfo(com.emc.vipr.model.sys.backup.BackupInfo) BackupSet(com.emc.vipr.model.sys.backup.BackupSets.BackupSet) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Aggregations

BackupInfo (com.emc.vipr.model.sys.backup.BackupInfo)6 BackupException (com.emc.storageos.management.backup.exceptions.BackupException)3 RetryableBackupException (com.emc.storageos.management.backup.exceptions.RetryableBackupException)3 IOException (java.io.IOException)3 BackupRestoreStatus (com.emc.vipr.model.sys.backup.BackupRestoreStatus)2 FileInputStream (java.io.FileInputStream)2 MalformedURLException (java.net.MalformedURLException)2 URISyntaxException (java.net.URISyntaxException)2 UnknownHostException (java.net.UnknownHostException)2 CancellationException (java.util.concurrent.CancellationException)2 ExecutionException (java.util.concurrent.ExecutionException)2 MalformedObjectNameException (javax.management.MalformedObjectNameException)2 KeeperException (org.apache.zookeeper.KeeperException)2 BackupSet (com.emc.vipr.model.sys.backup.BackupSets.BackupSet)1 Restrictions (controllers.deadbolt.Restrictions)1 File (java.io.File)1 FilenameFilter (java.io.FilenameFilter)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ZipEntry (java.util.zip.ZipEntry)1