private List<CloudBlob> getBlobList(String archiveName) throws IOException { return getBlobs(archiveName).collect(Collectors.toList()); }
@Override public boolean exists(String archiveName) { try { return getBlobs(archiveName).findAny().isPresent(); } catch (IOException e) { log.error("Can't check the existence of {}", archiveName, e); return false; } }
@Override public boolean exists(String archiveName) { try { return getBlobs(archiveName).findAny().isPresent(); } catch (IOException e) { log.error("Can't check the existence of {}", archiveName, e); return false; } }
private List<CloudBlob> getBlobList(String archiveName) throws IOException { return getBlobs(archiveName).collect(Collectors.toList()); }
@Override public boolean delete(String archiveName) { try { getBlobs(archiveName) .forEach(cloudBlob -> { try { cloudBlob.delete(); } catch (StorageException e) { log.error("Can't delete segment {}", cloudBlob.getUri().getPath(), e); } }); return true; } catch (IOException e) { log.error("Can't delete archive {}", archiveName, e); return false; } }
@Override public boolean delete(String archiveName) { try { getBlobs(archiveName) .forEach(cloudBlob -> { try { cloudBlob.delete(); } catch (StorageException e) { log.error("Can't delete segment {}", cloudBlob.getUri().getPath(), e); } }); return true; } catch (IOException e) { log.error("Can't delete archive {}", archiveName, e); return false; } }
@Override public void copyFile(String from, String to) throws IOException { CloudBlobDirectory targetDirectory = getDirectory(to); getBlobs(from) .forEach(cloudBlob -> { try { copyBlob(cloudBlob, targetDirectory); } catch (IOException e) { log.error("Can't copy segment {}", cloudBlob.getUri().getPath(), e); } }); }
@Override public void copyFile(String from, String to) throws IOException { CloudBlobDirectory targetDirectory = getDirectory(to); getBlobs(from) .forEach(cloudBlob -> { try { copyBlob(cloudBlob, targetDirectory); } catch (IOException e) { log.error("Can't copy segment {}", cloudBlob.getUri().getPath(), e); } }); }
@Override public boolean renameTo(String from, String to) { try { CloudBlobDirectory targetDirectory = getDirectory(to); getBlobs(from) .forEach(cloudBlob -> { try { renameBlob(cloudBlob, targetDirectory); } catch (IOException e) { log.error("Can't rename segment {}", cloudBlob.getUri().getPath(), e); } }); return true; } catch (IOException e) { log.error("Can't rename archive {} to {}", from, to, e); return false; } }
@Override public boolean renameTo(String from, String to) { try { CloudBlobDirectory targetDirectory = getDirectory(to); getBlobs(from) .forEach(cloudBlob -> { try { renameBlob(cloudBlob, targetDirectory); } catch (IOException e) { log.error("Can't rename segment {}", cloudBlob.getUri().getPath(), e); } }); return true; } catch (IOException e) { log.error("Can't rename archive {} to {}", from, to, e); return false; } }