private static void convertUserMetadataKeysToLowercase(MutableBlobMetadata metadata) { Map<String, String> lowerCaseUserMetadata = Maps.newHashMap(); for (Map.Entry<String, String> entry : metadata.getUserMetadata().entrySet()) { lowerCaseUserMetadata.put(entry.getKey().toLowerCase(), entry.getValue()); } metadata.setUserMetadata(lowerCaseUserMetadata); } }
private static void convertUserMetadataKeysToLowercase(MutableBlobMetadata metadata) { Map<String, String> lowerCaseUserMetadata = Maps.newHashMap(); for (Map.Entry<String, String> entry : metadata.getUserMetadata().entrySet()) { lowerCaseUserMetadata.put(entry.getKey().toLowerCase(), entry.getValue()); } metadata.setUserMetadata(lowerCaseUserMetadata); } }
private static void convertUserMetadataKeysToLowercase(MutableBlobMetadata metadata) { Map<String, String> lowerCaseUserMetadata = Maps.newHashMap(); for (Map.Entry<String, String> entry : metadata.getUserMetadata().entrySet()) { lowerCaseUserMetadata.put(entry.getKey().toLowerCase(), entry.getValue()); } metadata.setUserMetadata(lowerCaseUserMetadata); } }
private static void convertUserMetadataKeysToLowercase(MutableBlobMetadata metadata) { Map<String, String> lowerCaseUserMetadata = Maps.newHashMap(); for (Map.Entry<String, String> entry : metadata.getUserMetadata().entrySet()) { lowerCaseUserMetadata.put(entry.getKey().toLowerCase(), entry.getValue()); } metadata.setUserMetadata(lowerCaseUserMetadata); } }
private static void convertUserMetadataKeysToLowercase(MutableBlobMetadata metadata) { Map<String, String> lowerCaseUserMetadata = Maps.newHashMap(); for (Map.Entry<String, String> entry : metadata.getUserMetadata().entrySet()) { lowerCaseUserMetadata.put(entry.getKey().toLowerCase(), entry.getValue()); } metadata.setUserMetadata(lowerCaseUserMetadata); } }
private static void convertUserMetadataKeysToLowercase(MutableBlobMetadata metadata) { Map<String, String> lowerCaseUserMetadata = Maps.newHashMap(); for (Map.Entry<String, String> entry : metadata.getUserMetadata().entrySet()) { lowerCaseUserMetadata.put(entry.getKey().toLowerCase(), entry.getValue()); } metadata.setUserMetadata(lowerCaseUserMetadata); } }
private static void convertUserMetadataKeysToLowercase(MutableBlobMetadata metadata) { Map<String, String> lowerCaseUserMetadata = Maps.newHashMap(); for (Map.Entry<String, String> entry : metadata.getUserMetadata().entrySet()) { lowerCaseUserMetadata.put(entry.getKey().toLowerCase(), entry.getValue()); } metadata.setUserMetadata(lowerCaseUserMetadata); } }
@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; }
@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; }
@Test public void testCorrect() throws SecurityException, NoSuchMethodException { HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build(); BindUserMetadataToHeadersWithPrefix binder = new BindUserMetadataToHeadersWithPrefix( new BindMapToHeadersWithPrefix("prefix:")); Blob blob = ContextBuilder.newBuilder("transient").buildInjector().getInstance(Blob.Factory.class).create(null); blob.getMetadata().setUserMetadata(ImmutableMap.of("imageName", "foo", "serverId", "2")); assertEquals( binder.bindToRequest(request, blob), HttpRequest.builder().method("GET").endpoint("http://momma") .addHeader("prefix:imagename", "foo") .addHeader("prefix:serverid", "2").build()); }
@Test public void testCorrect() throws SecurityException, NoSuchMethodException { HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build(); BindUserMetadataToHeadersWithPrefix binder = new BindUserMetadataToHeadersWithPrefix( new BindMapToHeadersWithPrefix("prefix:")); Blob blob = ContextBuilder.newBuilder("transient").buildInjector().getInstance(Blob.Factory.class).create(null); blob.getMetadata().setUserMetadata(ImmutableMap.of("imageName", "foo", "serverId", "2")); assertEquals( binder.bindToRequest(request, blob), HttpRequest.builder().method("GET").endpoint("http://momma") .addHeader("prefix:imagename", "foo") .addHeader("prefix:serverid", "2").build()); }
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(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; } }
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; } }