@Override public Blob build() { Blob blob = new BlobImpl(new MutableBlobMetadataImpl()); checkState(name != null, "name"); blob.getMetadata().setName(name); if (payload != null) blob.setPayload(payload); blob.getMetadata().setUserMetadata(userMetadata); blob.getMetadata().setType(type); blob.getMetadata().setTier(tier); return blob; }
@Override public Blob build() { Blob blob = new BlobImpl(new MutableBlobMetadataImpl()); checkState(name != null, "name"); blob.getMetadata().setName(name); if (payload != null) blob.setPayload(payload); blob.getMetadata().setUserMetadata(userMetadata); blob.getMetadata().setType(type); blob.getMetadata().setTier(tier); blob.getMetadata().setETag(eTag); return blob; }
private MutableBlobMetadata toBlobMetadata(String container, B2Object b2Object) { MutableBlobMetadata metadata = new MutableBlobMetadataImpl(); metadata.setContainer(container); metadata.setETag(b2Object.contentSha1()); // B2 does not support ETag, fake it with SHA-1 metadata.setLastModified(b2Object.uploadTimestamp()); metadata.setName(b2Object.fileName()); metadata.setSize(b2Object.contentLength()); MutableContentMetadata contentMetadata = new BaseMutableContentMetadata(); contentMetadata.setContentLength(b2Object.contentLength()); contentMetadata.setContentType(b2Object.contentType()); metadata.setContentMetadata(contentMetadata); metadata.setUserMetadata(b2Object.fileInfo()); metadata.setTier(Tier.STANDARD); try { metadata.setPublicUri(URI.create(auth.get().downloadUrl() + "/file/" + container + "/" + URLEncoder.encode(b2Object.fileName(), "UTF-8"))); } catch (UnsupportedEncodingException uee) { throw new RuntimeException(uee); } return metadata; } }
private MutableBlobMetadata toBlobMetadata(String container, B2Object b2Object) { MutableBlobMetadata metadata = new MutableBlobMetadataImpl(); metadata.setContainer(container); metadata.setETag(b2Object.contentSha1()); // B2 does not support ETag, fake it with SHA-1 metadata.setLastModified(b2Object.uploadTimestamp()); metadata.setName(b2Object.fileName()); metadata.setSize(b2Object.contentLength()); MutableContentMetadata contentMetadata = new BaseMutableContentMetadata(); contentMetadata.setContentLength(b2Object.contentLength()); contentMetadata.setContentType(b2Object.contentType()); metadata.setContentMetadata(contentMetadata); metadata.setUserMetadata(b2Object.fileInfo()); metadata.setTier(Tier.STANDARD); try { metadata.setPublicUri(URI.create(auth.get().downloadUrl() + "/file/" + container + "/" + URLEncoder.encode(b2Object.fileName(), "UTF-8"))); } catch (UnsupportedEncodingException uee) { throw new RuntimeException(uee); } return metadata; } }
to.setTier(Tier.STANDARD); to.setETag(from.getSystemMetadata().getObjectID()); to.getContentMetadata().setContentMD5(from.getSystemMetadata().getContentMD5());
to.setTier(Tier.STANDARD); to.setETag(from.getSystemMetadata().getObjectID()); to.getContentMetadata().setContentMD5(from.getSystemMetadata().getContentMD5());
public MutableBlobMetadata apply(ObjectMetadata from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setUri(from.getUri()); to.setContainer(from.getBucket()); to.setETag(from.getETag()); to.setName(from.getKey()); to.setLastModified(from.getLastModified()); to.setUserMetadata(from.getUserMetadata()); to.setLocation(locationOfBucket.apply(from.getBucket())); to.setType(StorageType.BLOB); to.setSize(from.getContentMetadata().getContentLength()); to.setTier((from.getStorageClass() == null ? ObjectMetadata.StorageClass.STANDARD : from.getStorageClass()).toTier()); return to; } }
public MutableBlobMetadata apply(ObjectMetadata from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setUri(from.getUri()); to.setContainer(from.getBucket()); to.setETag(from.getETag()); to.setName(from.getKey()); to.setLastModified(from.getLastModified()); to.setUserMetadata(from.getUserMetadata()); to.setLocation(locationOfBucket.apply(from.getBucket())); to.setType(StorageType.BLOB); to.setSize(from.getContentMetadata().getContentLength()); to.setTier((from.getStorageClass() == null ? ObjectMetadata.StorageClass.STANDARD : from.getStorageClass()).toTier()); return to; } }
to.setTier((tier != null ? tier : AccessTier.HOT).toTier()); return to;
@Override public MutableBlobMetadata apply(SwiftObject from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); to.setContainer(container.getName()); if (container.getAnybodyRead().isPresent()) { to.setPublicUri(from.getUri()); } String eTag = from.getETag(); to.setUri(from.getUri()); to.setETag(eTag); to.setName(from.getName()); to.setLastModified(from.getLastModified()); to.setContentMetadata(from.getPayload().getContentMetadata()); to.getContentMetadata().setContentMD5(from.getPayload().getContentMetadata().getContentMD5AsHashCode()); to.getContentMetadata().setExpires(from.getPayload().getContentMetadata().getExpires()); to.setUserMetadata(from.getMetadata()); if (eTag != null && eTag.equals(ParseObjectListFromResponse.SUBDIR_ETAG)) { to.setType(StorageType.FOLDER); } else { to.setType(StorageType.BLOB); } to.setSize(from.getPayload().getContentMetadata().getContentLength()); to.setTier(Tier.STANDARD); return to; }
@Override public MutableBlobMetadata apply(SwiftObject from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); to.setContainer(container.getName()); if (container.getAnybodyRead().isPresent()) { to.setPublicUri(from.getUri()); } String eTag = from.getETag(); to.setUri(from.getUri()); to.setETag(eTag); to.setName(from.getName()); to.setLastModified(from.getLastModified()); to.setContentMetadata(from.getPayload().getContentMetadata()); to.getContentMetadata().setContentMD5(from.getPayload().getContentMetadata().getContentMD5AsHashCode()); to.getContentMetadata().setExpires(from.getPayload().getContentMetadata().getExpires()); to.setUserMetadata(from.getMetadata()); if (eTag != null && eTag.equals(ParseObjectListFromResponse.SUBDIR_ETAG)) { to.setType(StorageType.FOLDER); } else { to.setType(StorageType.BLOB); } to.setSize(from.getPayload().getContentMetadata().getContentLength()); to.setTier(Tier.STANDARD); return to; }
public MutableBlobMetadata apply(GoogleCloudStorageObject from) { if (from == null) { return null; } MutableBlobMetadata to = new MutableBlobMetadataImpl(); to.getContentMetadata().setContentMD5(toHashCode(from.md5Hash())); to.getContentMetadata().setContentType(from.contentType()); to.getContentMetadata().setContentDisposition(from.contentDisposition()); to.getContentMetadata().setContentEncoding(from.contentEncoding()); to.getContentMetadata().setContentLanguage(from.contentLanguage()); to.getContentMetadata().setContentLength(from.size()); to.setLastModified(from.updated()); to.setContainer(from.bucket()); to.setUserMetadata(from.metadata()); to.setETag(from.etag()); to.setName(from.name()); to.setUri(from.selfLink()); to.setId(from.id()); to.setPublicUri(from.mediaLink()); to.setType(StorageType.BLOB); to.setSize(from.size()); to.setTier(from.storageClass().toTier()); return to; }
public MutableBlobMetadata apply(GoogleCloudStorageObject from) { if (from == null) { return null; } MutableBlobMetadata to = new MutableBlobMetadataImpl(); to.getContentMetadata().setContentMD5(toHashCode(from.md5Hash())); to.getContentMetadata().setContentType(from.contentType()); to.getContentMetadata().setContentDisposition(from.contentDisposition()); to.getContentMetadata().setContentEncoding(from.contentEncoding()); to.getContentMetadata().setContentLanguage(from.contentLanguage()); to.getContentMetadata().setContentLength(from.size()); to.setLastModified(from.updated()); to.setContainer(from.bucket()); to.setUserMetadata(from.metadata()); to.setETag(from.etag()); to.setName(from.name()); to.setUri(from.selfLink()); to.setId(from.id()); to.setPublicUri(from.mediaLink()); to.setType(StorageType.BLOB); to.setSize(from.size()); to.setTier(from.storageClass().toTier()); return to; }