@Provides final AtmosObject provideAtmosObject(AtmosObject.Factory factory) { return factory.create((MutableContentMetadata) null); }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); object.getContentMetadata().setContentMD5(object.getSystemMetadata().getContentMD5()); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); object.getContentMetadata().setContentMD5(object.getSystemMetadata().getContentMD5()); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }
@Provides final AtmosObject provideAtmosObject(AtmosObject.Factory factory) { return factory.create((MutableContentMetadata) null); }
@Provides AtmosObject provideAtmosObject(AtmosObject.Factory factory) { return factory.create((MutableContentMetadata) null); }
@Provides final AtmosObject provideAtmosObject(AtmosObject.Factory factory) { return factory.create((MutableContentMetadata) null); }
@Test public void testCorrectSystemMetadataObjectName() throws SecurityException, NoSuchMethodException { AtmosObject blob = BLOB_FACTORY.create(new SystemMetadata(null, null, null, null, null, null, 0, null, "foo", null, 0, null, null), new UserMetadata()); assertEquals(fn.apply(blob), "foo"); }
@Test public void testCorrectContentMetadataName() throws SecurityException, NoSuchMethodException { AtmosObject blob = BLOB_FACTORY.create(null); blob.getContentMetadata().setName("foo"); assertEquals(fn.apply(blob), "foo"); }
@Provides AtmosObject provideAtmosObject(AtmosObject.Factory factory) { return factory.create((MutableContentMetadata) null); }
@Provides final AtmosObject provideAtmosObject(AtmosObject.Factory factory) { return factory.create((MutableContentMetadata) null); }
@Provides AtmosObject provideAtmosObject(AtmosObject.Factory factory) { return factory.create((MutableContentMetadata) null); }
public AtmosObject apply(BlobMetadata from) { if (from == null) return null; UserMetadata userMd = new UserMetadata(); if (from.getUserMetadata() != null) { for (Entry<String, String> entry : from.getUserMetadata().entrySet()) userMd.getMetadata().put(entry.getKey().toLowerCase(), entry.getValue()); } return factory.create(blob2ContentMd.apply(from), blob2SysMd.apply(from), userMd); }
@Test(expectedExceptions = NullPointerException.class) public void testNullPayloadIsBad() { AtmosObject object = injector.getInstance(AtmosObject.Factory.class).create(null); HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://localhost").build(); binder.bindToRequest(request, object); }
public AtmosObject apply(BlobMetadata from) { if (from == null) return null; UserMetadata userMd = new UserMetadata(); if (from.getUserMetadata() != null) { for (Entry<String, String> entry : from.getUserMetadata().entrySet()) userMd.getMetadata().put(entry.getKey().toLowerCase(), entry.getValue()); } return factory.create(blob2ContentMd.apply(from), blob2SysMd.apply(from), userMd); }
public AtmosObject apply(BlobMetadata from) { if (from == null) return null; UserMetadata userMd = new UserMetadata(); if (from.getUserMetadata() != null) { for (Entry<String, String> entry : from.getUserMetadata().entrySet()) userMd.getMetadata().put(entry.getKey().toLowerCase(), entry.getValue()); } return factory.create(blob2ContentMd.apply(from), blob2SysMd.apply(from), userMd); }