@Override public void uploadMetadata(OperationContext opContext) throws StorageException { container.uploadMetadata(AccessCondition.generateEmptyCondition(), null, opContext); }
@Override public boolean exists(OperationContext opContext) throws StorageException { return container.exists(AccessCondition.generateEmptyCondition(), null, opContext); }
@Override public void downloadAttributes(OperationContext opContext) throws StorageException { container.downloadAttributes(AccessCondition.generateEmptyCondition(), null, opContext); }
@Override public void downloadAttributes(OperationContext opContext) throws StorageException { container.downloadAttributes(AccessCondition.generateEmptyCondition(), null, opContext); }
@Override public boolean exists(OperationContext opContext) throws StorageException { return container.exists(AccessCondition.generateEmptyCondition(), null, opContext); }
@Override public void uploadMetadata(OperationContext opContext) throws StorageException { container.uploadMetadata(AccessCondition.generateEmptyCondition(), null, opContext); }
/** * Free the lease and stop the keep-alive thread. * @throws StorageException Thrown when fail to free the lease. */ public void free() throws StorageException { AccessCondition accessCondition = AccessCondition.generateEmptyCondition(); accessCondition.setLeaseID(leaseID); try { blobWrapper.getBlob().releaseLease(accessCondition); } catch (StorageException e) { if ("BlobNotFound".equals(e.getErrorCode())) { // Don't do anything -- it's okay to free a lease // on a deleted file. The delete freed the lease // implicitly. } else { // This error is not anticipated, so re-throw it. LOG.warn("Unanticipated exception when trying to free lease " + leaseID + " on " + blobWrapper.getStorageUri()); throw(e); } } finally { // Even if releasing the lease fails (e.g. because the file was deleted), // make sure to record that we freed the lease, to terminate the // keep-alive thread. leaseFreed = true; LOG.debug("Freed lease " + leaseID + " on " + blobWrapper.getUri() + " managed by thread " + renewer.getName()); } }
LOG.debug("Starting lease keep-alive thread."); AccessCondition accessCondition = AccessCondition.generateEmptyCondition(); accessCondition.setLeaseID(leaseID);
final CloudBlobContainer container = session.getClient().getContainerReference(containerService.getContainer(file).getName()); container.setMetadata(new HashMap<String, String>(metadata)); container.uploadMetadata(AccessCondition.generateEmptyCondition(), options, context); blob.uploadMetadata(AccessCondition.generateEmptyCondition(), options, context); blob.uploadProperties();
List<BlockEntry> blocks = blob.downloadBlockList( BlockListingFilter.UNCOMMITTED, AccessCondition.generateEmptyCondition(), null, null);
blob.create(scriptLength); ByteArrayInputStream stream = new ByteArrayInputStream(scriptText.getBytes(StandardCharsets.UTF_8)); blob.upload(stream, scriptText.length(), AccessCondition.generateEmptyCondition(), null, null); return blob.getUri().toString(); } catch (Exception e) {
if(status.isAppend()) { options.setStoreBlobContentMD5(false); out = blob.openWriteExisting(AccessCondition.generateEmptyCondition(), options, context); out = blob.openWriteNew(AccessCondition.generateEmptyCondition(), options, context);
session.getClient().getContainerReference(containerService.getContainer(file).getName()) .getBlockBlobReference(containerService.getKey(file)).delete( DeleteSnapshotsOption.INCLUDE_SNAPSHOTS, AccessCondition.generateEmptyCondition(), options, context); final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()).delete( AccessCondition.generateEmptyCondition(), options, context);
@Override public Path copy(final Path source, final Path copy, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { try { final CloudBlob target = session.getClient().getContainerReference(containerService.getContainer(copy).getName()) .getAppendBlobReference(containerService.getKey(copy)); final CloudBlob blob = session.getClient().getContainerReference(containerService.getContainer(source).getName()) .getBlobReferenceFromServer(containerService.getKey(source)); final BlobRequestOptions options = new BlobRequestOptions(); options.setStoreBlobContentMD5(PreferencesFactory.get().getBoolean("azure.upload.md5")); final URI s = session.getHost().getCredentials().isTokenAuthentication() ? URI.create(blob.getUri().toString() + session.getHost().getCredentials().getToken()) : blob.getUri(); final String id = target.startCopy(s, AccessCondition.generateEmptyCondition(), AccessCondition.generateEmptyCondition(), options, context); if(log.isDebugEnabled()) { log.debug(String.format("Started copy for %s with copy operation ID %s", copy, id)); } // Copy original file attributes return new Path(copy.getParent(), copy.getName(), copy.getType(), new PathAttributes(source.attributes())); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot copy {0}", e, source); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } }
.getBlobReferenceFromServer(containerService.getKey(file)); final BlobRequestOptions options = new BlobRequestOptions(); blob.downloadAttributes(AccessCondition.generateEmptyCondition(), options, context); final BlobProperties properties = blob.getProperties(); final PathAttributes attributes = new PathAttributes();
} finally { assertTrue(differentLeaseID != null); AccessCondition accessCondition = AccessCondition.generateEmptyCondition(); accessCondition.setLeaseID(differentLeaseID); blob.releaseLease(accessCondition);
} finally { assertTrue(differentLeaseID != null); AccessCondition accessCondition = AccessCondition.generateEmptyCondition(); accessCondition.setLeaseID(differentLeaseID); blob.releaseLease(accessCondition);
final BlobRequestOptions options = new BlobRequestOptions(); options.setConcurrentRequestCount(1); final BlobInputStream in = blob.openInputStream(AccessCondition.generateEmptyCondition(), options, context); if(status.isAppend()) { try {