@Override public List<MultipartUpload> listMultipartUploads(String container) { ImmutableList.Builder<MultipartUpload> builder = ImmutableList.builder(); String marker = null; while (true) { ListBlobsOptions options = new ListBlobsOptions().include(EnumSet.of(ListBlobsInclude.UNCOMMITTEDBLOBS)); if (marker != null) { options.marker(marker); } ListBlobsResponse response = sync.listBlobs(container, options); for (BlobProperties properties : response) { // only uncommitted blobs lack ETags if (properties.getETag() != null) { continue; } // TODO: bogus uploadId String uploadId = UUID.randomUUID().toString(); builder.add(MultipartUpload.create(properties.getContainer(), properties.getName(), uploadId, null, null)); } marker = response.getNextMarker(); if (marker == null) { break; } } return builder.build(); }
@Override public List<MultipartUpload> listMultipartUploads(String container) { ImmutableList.Builder<MultipartUpload> builder = ImmutableList.builder(); String marker = null; while (true) { ListBlobsOptions options = new ListBlobsOptions().include(EnumSet.of(ListBlobsInclude.UNCOMMITTEDBLOBS)); if (marker != null) { options.marker(marker); } ListBlobsResponse response = sync.listBlobs(container, options); for (BlobProperties properties : response) { // only uncommitted blobs lack ETags if (properties.getETag() != null) { continue; } // TODO: bogus uploadId String uploadId = UUID.randomUUID().toString(); builder.add(MultipartUpload.create(properties.getContainer(), properties.getName(), uploadId, null, null)); } marker = response.getNextMarker(); if (marker == null) { break; } } return builder.build(); }
public MutableBlobPropertiesImpl(BlobProperties from) { this.contentMetadata = new BaseMutableContentMetadata(); this.name = from.getName(); this.container = from.getContainer(); this.url = from.getUrl(); this.lastModified = from.getLastModified(); this.eTag = from.getETag(); this.metadata.putAll(from.getMetadata()); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); }
public MutableBlobPropertiesImpl(BlobProperties from) { this.contentMetadata = new BaseMutableContentMetadata(); this.name = from.getName(); this.container = from.getContainer(); this.url = from.getUrl(); this.lastModified = from.getLastModified(); this.eTag = from.getETag(); this.metadata.putAll(from.getMetadata()); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); }
public MutableBlobPropertiesImpl(BlobProperties from) { this.contentMetadata = new BaseMutableContentMetadata(); this.name = from.getName(); this.container = from.getContainer(); this.url = from.getUrl(); this.lastModified = from.getLastModified(); this.eTag = from.getETag(); this.metadata.putAll(from.getMetadata()); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); }
public MutableBlobPropertiesImpl(BlobProperties from) { this.contentMetadata = new BaseMutableContentMetadata(); this.name = from.getName(); this.container = from.getContainer(); this.url = from.getUrl(); this.lastModified = from.getLastModified(); this.eTag = from.getETag(); this.metadata.putAll(from.getMetadata()); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); }
public MutableBlobPropertiesImpl(BlobProperties from) { this.contentMetadata = new BaseMutableContentMetadata(); this.name = from.getName(); this.container = from.getContainer(); this.url = from.getUrl(); this.lastModified = from.getLastModified(); this.eTag = from.getETag(); this.metadata.putAll(from.getMetadata()); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); }
assertEquals(metadata.getETag(), newEtag); assertEquals(metadata.getMetadata().entrySet().size(), 1); assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");
public MutableBlobMetadata apply(BlobProperties from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setUserMetadata(from.getMetadata()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setName(from.getName()); to.setContainer(from.getContainer()); to.setUri(from.getUrl()); if (from.getContainer() != null) try { PublicAccess containerAcl = containerAcls.getUnchecked(from.getContainer()); if (containerAcl != PublicAccess.PRIVATE) to.setPublicUri(from.getUrl()); } catch (CacheLoader.InvalidCacheLoadException e) { // nulls not permitted from cache loader } String directoryName = ifDirectoryReturnName.execute(to); if (directoryName != null) { to.setName(directoryName); to.setType(StorageType.RELATIVE_PATH); } else { to.setType(StorageType.BLOB); } return to; } }
assertEquals(base16().lowerCase().encode(metadata.getContentMetadata().getContentMD5()), base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5())); assertEquals(metadata.getETag(), newEtag); assertEquals(metadata.getMetadata().entrySet().size(), 1); assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");
public MutableBlobMetadata apply(BlobProperties from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setUserMetadata(from.getMetadata()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setName(from.getName()); to.setContainer(from.getContainer()); to.setUri(from.getUrl()); if (from.getContainer() != null) try { PublicAccess containerAcl = containerAcls.getUnchecked(from.getContainer()); if (containerAcl != PublicAccess.PRIVATE) to.setPublicUri(from.getUrl()); } catch (CacheLoader.InvalidCacheLoadException e) { // nulls not permitted from cache loader } if (to.getContentMetadata() != null && to.getContentMetadata().getContentType() != null && to.getContentMetadata().getContentType().equals("application/directory")) { to.setType(StorageType.FOLDER); } else { to.setType(StorageType.BLOB); } to.setSize(from.getContentMetadata().getContentLength()); return to; } }
public MutableBlobMetadata apply(BlobProperties from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setUserMetadata(from.getMetadata()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setName(from.getName()); to.setContainer(from.getContainer()); to.setUri(from.getUrl()); if (from.getContainer() != null) try { PublicAccess containerAcl = containerAcls.getUnchecked(from.getContainer()); if (containerAcl != PublicAccess.PRIVATE) to.setPublicUri(from.getUrl()); } catch (CacheLoader.InvalidCacheLoadException e) { // nulls not permitted from cache loader } String directoryName = ifDirectoryReturnName.execute(to); if (directoryName != null) { to.setName(directoryName); to.setType(StorageType.RELATIVE_PATH); } else { to.setType(StorageType.BLOB); } return to; } }
public MutableBlobMetadata apply(BlobProperties from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setUserMetadata(from.getMetadata()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setName(from.getName()); to.setContainer(from.getContainer()); to.setUri(from.getUrl()); if (from.getContainer() != null) try { PublicAccess containerAcl = containerAcls.getUnchecked(from.getContainer()); if (containerAcl != PublicAccess.PRIVATE) to.setPublicUri(from.getUrl()); } catch (CacheLoader.InvalidCacheLoadException e) { // nulls not permitted from cache loader } String directoryName = ifDirectoryReturnName.execute(to); if (directoryName != null) { to.setName(directoryName); to.setType(StorageType.RELATIVE_PATH); } else { to.setType(StorageType.BLOB); } return to; } }
HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setUserMetadata(from.getMetadata()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setName(from.getName());