You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Andrew Gaul <no...@github.com> on 2017/02/17 03:01:44 UTC

[jclouds/jclouds] Return lastModified and size when listing S3 parts (#1063)

You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds/pull/1063

-- Commit Summary --

  * Return lastModified and size when listing S3 parts

-- File Changes --

    M apis/s3/src/main/java/org/jclouds/s3/S3Client.java (14)
    A apis/s3/src/main/java/org/jclouds/s3/domain/ListMultipartUploadResponse.java (42)
    M apis/s3/src/main/java/org/jclouds/s3/xml/PartIdsFromHttpResponse.java (3)
    A apis/s3/src/main/java/org/jclouds/s3/xml/PartIdsFromHttpResponseFull.java (79)
    M apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java (7)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/1063.patch
https://github.com/jclouds/jclouds/pull/1063.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1063

Re: [jclouds/jclouds] Return lastModified and size when listing S3 parts (#1063)

Posted by Andrew Gaul <no...@github.com>.
andrewgaul commented on this pull request.



> +import com.google.auto.value.AutoValue;
+import com.google.common.annotations.Beta;
+
+@AutoValue
+@Beta
+public abstract class ListMultipartUploadResponse {
+   public abstract int partNumber();
+   public abstract Date lastModified();
+   public abstract String eTag();
+   public abstract long size();
+
+   public static ListMultipartUploadResponse create(int partNumber, Date lastModified, String eTag, long size) {
+      checkArgument(partNumber > 0, "partNumber must be greater than zero, was: " + partNumber);
+      checkNotNull(eTag, "eTag");
+      lastModified = (Date) checkNotNull(lastModified, "lastModified").clone();
+      checkArgument(size >= 0, "size must be positive, was: " + size);

Done twice.  Some versions of error-prone warn about this but the check was reparented into the Google-only Klippy.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1063#discussion_r104576117

Re: [jclouds/jclouds] Return lastModified and size when listing S3 parts (#1063)

Posted by Andrew Gaul <no...@github.com>.
andrewgaul commented on this pull request.



> + */
+@Beta
+public final class PartIdsFromHttpResponseFull extends ParseSax.HandlerWithResult<Map<Integer, ListMultipartUploadResponse>> {
+   private final StringBuilder currentText = new StringBuilder();
+
+   private final DateService dateParser;
+
+   private int partNumber;
+   private Date lastModfied;
+   private String eTag;
+   private long size;
+
+   private final ImmutableMap.Builder<Integer, ListMultipartUploadResponse> parts = ImmutableMap.builder();
+
+   @Inject
+   public PartIdsFromHttpResponseFull(DateService dateParser) {

Done.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1063#discussion_r104575929

Re: [jclouds/jclouds] Return lastModified and size when listing S3 parts (#1063)

Posted by Ignasi Barrera <no...@github.com>.
nacx approved this pull request.

+1 Thanks @andrewgaul!

> +import com.google.auto.value.AutoValue;
+import com.google.common.annotations.Beta;
+
+@AutoValue
+@Beta
+public abstract class ListMultipartUploadResponse {
+   public abstract int partNumber();
+   public abstract Date lastModified();
+   public abstract String eTag();
+   public abstract long size();
+
+   public static ListMultipartUploadResponse create(int partNumber, Date lastModified, String eTag, long size) {
+      checkArgument(partNumber > 0, "partNumber must be greater than zero, was: " + partNumber);
+      checkNotNull(eTag, "eTag");
+      lastModified = (Date) checkNotNull(lastModified, "lastModified").clone();
+      checkArgument(size >= 0, "size must be positive, was: " + size);

[minor] Use `checkArgument(size >= 0, "size must be positive, was: %s", size);`, to avoid the implicit stringbuilder if the precondition is met.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1063#pullrequestreview-22459974

Re: [jclouds/jclouds] Return lastModified and size when listing S3 parts (#1063)

Posted by Ignasi Barrera <no...@github.com>.
nacx commented on this pull request.



> + */
+@Beta
+public final class PartIdsFromHttpResponseFull extends ParseSax.HandlerWithResult<Map<Integer, ListMultipartUploadResponse>> {
+   private final StringBuilder currentText = new StringBuilder();
+
+   private final DateService dateParser;
+
+   private int partNumber;
+   private Date lastModfied;
+   private String eTag;
+   private long size;
+
+   private final ImmutableMap.Builder<Integer, ListMultipartUploadResponse> parts = ImmutableMap.builder();
+
+   @Inject
+   public PartIdsFromHttpResponseFull(DateService dateParser) {

[minor] According to Guice best practices, it's better to reduce the visibility of the injection constructors. Let's leave it without the `public` modifier, in default scope.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1063#pullrequestreview-22460273

Re: [jclouds/jclouds] Return lastModified and size when listing S3 parts (#1063)

Posted by Andrew Gaul <no...@github.com>.
Pushed to master as ec932321bde5662d8ecbef7cf5428a6017b07dd0 and 2.0.x as d2041667d770bcb865a7bfb451b5910dd9084d91.

-- 
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1063#issuecomment-284622243

Re: [jclouds/jclouds] Return lastModified and size when listing S3 parts (#1063)

Posted by Andrew Gaul <no...@github.com>.
Unfortunately this introduces a new method since we cannot change the `listMultipartParts` return type.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1063#issuecomment-280544153