public StorageMetadata apply(String key) { Blob oldBlob = loadBlob(container, key); checkState(oldBlob != null, "blob " + key + " is not present although it was in the list of " + container); checkState(oldBlob.getMetadata() != null, "blob " + container + "/" + key + " has no metadata"); MutableBlobMetadata md = BlobStoreUtils.copy(oldBlob.getMetadata()); String directoryName = ifDirectoryReturnName.execute(md); if (directoryName != null) { md.setName(directoryName); md.setType(StorageType.RELATIVE_PATH); } return md; } }));
public StorageMetadata apply(String key) { Blob oldBlob = loadBlob(container, key); checkState(oldBlob != null, "blob " + key + " is not present although it was in the list of " + container); checkState(oldBlob.getMetadata() != null, "blob " + container + "/" + key + " has no metadata"); MutableBlobMetadata md = BlobStoreUtils.copy(oldBlob.getMetadata()); String directoryName = ifDirectoryReturnName.execute(md); if (directoryName != null) { md.setName(directoryName); md.setType(StorageType.RELATIVE_PATH); } return md; } }));
public StorageMetadata apply(String key) { if (!storageStrategy.blobExists(container, key)) { // handle directory return new StorageMetadataImpl(StorageType.FOLDER, /*id=*/ null, key, /*location=*/ null, /*uri=*/ null, /*eTag=*/ null, /*creationDate=*/ null, /*lastModified=*/ null, ImmutableMap.<String, String>of()); } Blob oldBlob = loadBlob(container, key); checkState(oldBlob != null, "blob " + key + " is not present although it was in the list of " + container); checkState(oldBlob.getMetadata() != null, "blob " + container + "/" + key + " has no metadata"); MutableBlobMetadata md = BlobStoreUtils.copy(oldBlob.getMetadata()); String directoryName = ifDirectoryReturnName.execute(md); if (directoryName != null) { md.setName(directoryName); md.setType(StorageType.RELATIVE_PATH); } return md; } }));
@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); 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); 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); 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); 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); return blob; }
public MutableBlobMetadata apply(AtmosObject from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); to.setId(from.getSystemMetadata().getObjectID()); to.setLastModified(from.getSystemMetadata().getLastUserDataModification()); HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setName(objectName.apply(from)); to.setUri(from.getContentMetadata().getUri()); to.setContainer(Iterables.get(Splitter.on('/').split(from.getContentMetadata().getPath()),0)); if (from.getAllHeaders().containsEntry("x-emc-groupacl", "other=READ")) to.setPublicUri(shareUrl.apply(from.getContentMetadata().getPath())); if (from.getSystemMetadata().getType() == FileType.DIRECTORY) { to.setType(StorageType.FOLDER); } else { to.setType(StorageType.BLOB); } Map<String, String> lowerKeyMetadata = Maps.newHashMap(); for (Entry<String, String> entry : from.getUserMetadata().getMetadata().entrySet()) { String key = entry.getKey().toLowerCase(); if (!systemMetadata.contains(key)) lowerKeyMetadata.put(key, entry.getValue()); } to.setUserMetadata(lowerKeyMetadata); return to; } }
@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; }
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()); 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(ObjectMetadata from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setETag(from.getETag()); to.setName(from.getKey()); to.setLastModified(from.getLastModified()); to.setUserMetadata(from.getUserMetadata()); String directoryName = ifDirectoryReturnName.execute(to); if (directoryName != null) { to.setName(directoryName); to.setType(StorageType.RELATIVE_PATH); } else { to.setType(StorageType.BLOB); } return to; } }
@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; }
public MutableBlobMetadata apply(ObjectInfo from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); to.getContentMetadata().setContentMD5(from.getHash()); if (from.getContentType() != null) to.getContentMetadata().setContentType(from.getContentType()); if (from.getHash() != null) to.setETag(base16().lowerCase().encode(from.getHash())); to.setName(from.getName()); to.setContainer(from.getContainer()); to.setUri(from.getUri()); to.getContentMetadata().setContentLength(from.getBytes()); if (from.getLastModified() != null) to.setLastModified(from.getLastModified()); if (from instanceof MutableObjectInfoWithMetadata) to.setUserMetadata(((MutableObjectInfoWithMetadata) from).getMetadata()); String directoryName = ifDirectoryReturnName.execute(to); if (directoryName != null) { to.setName(directoryName); to.setType(StorageType.RELATIVE_PATH); } else { to.setType(StorageType.BLOB); } 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()); 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()); 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; } }
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(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; }