public Blob apply(S3Object from) { if (from == null) return null; Blob blob = blobFactory.create(object2BlobMd.apply(from.getMetadata())); blob.setPayload(checkNotNull(from.getPayload(), "payload: " + from)); blob.setAllHeaders(from.getAllHeaders()); return blob; } }
public void bindToRequest(HttpRequest request, Object payload) { S3Object s3Object = (S3Object) payload; checkArgument(s3Object.getPayload().getContentMetadata().getContentLength() != null, "contentLength must be set, streaming not supported"); checkArgument(s3Object.getPayload().getContentMetadata().getContentLength() <= 5l * 1024 * 1024 * 1024, "maximum size for put object is 5GB"); blobBinder.bindToRequest(request, object2Blob.apply(s3Object)); if (s3Object.getMetadata().getCacheControl() != null) { request.getHeaders().put(HttpHeaders.CACHE_CONTROL, s3Object.getMetadata().getCacheControl()); } } }
public S3Object apply(HttpResponse from) { MutableObjectMetadata metadata = metadataParser.apply(from); S3Object object = objectProvider.create(metadata); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); return object; }
public S3Object apply(Blob from) { if (from == null) return null; S3Object object = objectProvider.create(blob2ObjectMd.apply(from.getMetadata())); object.setPayload(checkNotNull(from.getPayload(), "payload: " + from)); object.setAllHeaders(from.getAllHeaders()); return object; } }
public String apply(Object from) { return ((S3Object) from).getMetadata().getKey(); }
/** * {@inheritDoc} */ @Override public int compareTo(S3Object o) { if (getMetadata().getKey() == null) return -1; return (this == o) ? 0 : getMetadata().getKey().compareTo(o.getMetadata().getKey()); }