GitHub PullRequestReviewCommentEvent at 2014-09-06 17:41:38
Repository: jclouds-labs-google
Actor: andrewgaul
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/comments/17210197","id":17210197,"diff_hunk":"@@ -0,0 +1,106 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License.  You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jclouds.googlecloudstorage.blobstore.strategy.internal;\n+\n+import static com.google.common.base.Preconditions.checkNotNull;\n+\n+import java.util.Set;\n+\n+import javax.annotation.Resource;\n+import javax.inject.Named;\n+import javax.inject.Provider;\n+\n+import org.jclouds.blobstore.domain.Blob;\n+import org.jclouds.blobstore.domain.BlobBuilder;\n+import org.jclouds.blobstore.reference.BlobStoreConstants;\n+import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;\n+import org.jclouds.googlecloudstorage.blobstore.functions.BlobMetadataToObjectTemplate;\n+import org.jclouds.googlecloudstorage.domain.GCSObject;\n+import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;\n+import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;\n+import org.jclouds.io.Payload;\n+import org.jclouds.io.PayloadSlicer;\n+import org.jclouds.logging.Logger;\n+\n+import com.google.common.collect.Sets;\n+import com.google.inject.Inject;\n+\n+public class SequentialMultipartUploadStrategy extends MultipartUploadStrategy {\n+\n+   @Resource\n+   @Named(BlobStoreConstants.BLOBSTORE_LOGGER)\n+   private Logger logger = Logger.NULL;\n+\n+   private final GoogleCloudStorageApi api;\n+   private final Provider<BlobBuilder> blobBuilders;\n+   private final BlobMetadataToObjectTemplate blob2ObjectTemplate;\n+   private final MultipartUploadSlicingAlgorithm algorithm;\n+   private final PayloadSlicer slicer;\n+   private final MultipartNamingStrategy namingStrategy;\n+\n+   @Inject\n+   public SequentialMultipartUploadStrategy(GoogleCloudStorageApi api, Provider<BlobBuilder> blobBuilders,\n+            BlobMetadataToObjectTemplate blob2ObjectTemplate, MultipartUploadSlicingAlgorithm algorithm,\n+            PayloadSlicer slicer, MultipartNamingStrategy namingStrategy) {\n+      this.api = checkNotNull(api, \"api\");\n+      this.blobBuilders = checkNotNull(blobBuilders, \"blobBuilders\");\n+      this.blob2ObjectTemplate = checkNotNull(blob2ObjectTemplate, \"blob2Object\");\n+      this.algorithm = checkNotNull(algorithm, \"algorithm\");\n+      this.slicer = checkNotNull(slicer, \"slicer\");\n+      this.namingStrategy = checkNotNull(namingStrategy, \"namingStrategy\");\n+   }\n+\n+   @Override\n+   public String execute(String container, Blob blob) {\n+\n+      ObjectTemplate destination = blob2ObjectTemplate.apply(blob.getMetadata());\n+      ComposeObjectTemplate template = new ComposeObjectTemplate().destination(destination);\n+\n+      Set<GCSObject> sourceList = Sets.newHashSet();\n+\n+      String key = blob.getMetadata().getName();\n+      Payload payload = blob.getPayload();\n+      Long length = payload.getContentMetadata().getContentLength();\n+      if (length == null) {\n+         length = blob.getMetadata().getContentMetadata().getContentLength();\n+         payload.getContentMetadata().setContentLength(length);\n+      }\n+      checkNotNull(length,","path":"google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/strategy/internal/SequentialMultipartUploadStrategy.java","position":82,"original_position":82,"commit_id":"fd24279f17c392d00529988935d3311c77c7be64","original_commit_id":"fd24279f17c392d00529988935d3311c77c7be64","user":{"login":"andrewgaul","id":848247,"avatar_url":"https://avatars.githubusercontent.com/u/848247?v=2","gravatar_id":"ea6c6f4ca7cbb47a2107508237befb8b","url":"https://api.github.com/users/andrewgaul","html_url":"https://github.com/andrewgaul","followers_url":"https://api.github.com/users/andrewgaul/followers","following_url":"https://api.github.com/users/andrewgaul/following{/other_user}","gists_url":"https://api.github.com/users/andrewgaul/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewgaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewgaul/subscriptions","organizations_url":"https://api.github.com/users/andrewgaul/orgs","repos_url":"https://api.github.com/users/andrewgaul/repos","events_url":"https://api.github.com/users/andrewgaul/events{/privacy}","received_events_url":"https://api.github.com/users/andrewgaul/received_events","type":"User","site_admin":false},"body":"Hoist the precondition closer to the method beginning?  This will allow you to simplify the logic:\r\n\r\n```\r\nlong length = checkNotNull(length, \"please invoke payload.getContentMetadata().setContentLength(length) prior to multipart upload\");\r\npayload.getContentMetadata().setContentLength(length);\r\n```","created_at":"2014-09-06T17:41:38Z","updated_at":"2014-09-06T17:41:38Z","html_url":"https://github.com/jclouds/jclouds-labs-google/pull/48#discussion_r17210197","pull_request_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/comments/17210197"},"html":{"href":"https://github.com/jclouds/jclouds-labs-google/pull/48#discussion_r17210197"},"pull_request":{"href":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/48","id":20649409,"html_url":"https://github.com/jclouds/jclouds-labs-google/pull/48","diff_url":"https://github.com/jclouds/jclouds-labs-google/pull/48.diff","patch_url":"https://github.com/jclouds/jclouds-labs-google/pull/48.patch","issue_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/issues/48","number":48,"state":"open","locked":false,"title":"JCLOUDS-458:Added Blobstore Abstraction","user":{"login":"hsbhathiya","id":4924458,"avatar_url":"https://avatars.githubusercontent.com/u/4924458?v=2","gravatar_id":"6c903c737fa3b83d1b29b2af0041ecf5","url":"https://api.github.com/users/hsbhathiya","html_url":"https://github.com/hsbhathiya","followers_url":"https://api.github.com/users/hsbhathiya/followers","following_url":"https://api.github.com/users/hsbhathiya/following{/other_user}","gists_url":"https://api.github.com/users/hsbhathiya/gists{/gist_id}","starred_url":"https://api.github.com/users/hsbhathiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsbhathiya/subscriptions","organizations_url":"https://api.github.com/users/hsbhathiya/orgs","repos_url":"https://api.github.com/users/hsbhathiya/repos","events_url":"https://api.github.com/users/hsbhathiya/events{/privacy}","received_events_url":"https://api.github.com/users/hsbhathiya/received_events","type":"User","site_admin":false},"body":"JCLOUDS-458:Added Blobstore Abstraction\r\nMinor Changes testCopyUrl","created_at":"2014-09-03T00:25:24Z","updated_at":"2014-09-06T17:41:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9a0f46074336c1347555919077124b987abcf17c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/48/commits","review_comments_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/48/comments","review_comment_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/comments/{number}","comments_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/issues/48/comments","statuses_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/statuses/fd24279f17c392d00529988935d3311c77c7be64","head":{"label":"hsbhathiya:BlobAbStream","ref":"BlobAbStream","sha":"fd24279f17c392d00529988935d3311c77c7be64","user":{"login":"hsbhathiya","id":4924458,"avatar_url":"https://avatars.githubusercontent.com/u/4924458?v=2","gravatar_id":"6c903c737fa3b83d1b29b2af0041ecf5","url":"https://api.github.com/users/hsbhathiya","html_url":"https://github.com/hsbhathiya","followers_url":"https://api.github.com/users/hsbhathiya/followers","following_url":"https://api.github.com/users/hsbhathiya/following{/other_user}","gists_url":"https://api.github.com/users/hsbhathiya/gists{/gist_id}","starred_url":"https://api.github.com/users/hsbhathiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsbhathiya/subscriptions","organizations_url":"https://api.github.com/users/hsbhathiya/orgs","repos_url":"https://api.github.com/users/hsbhathiya/repos","events_url":"https://api.github.com/users/hsbhathiya/events{/privacy}","received_events_url":"https://api.github.com/users/hsbhathiya/received_events","type":"User","site_admin":false},"repo":{"id":19674032,"name":"jclouds-labs-google","full_name":"hsbhathiya/jclouds-labs-google","owner":{"login":"hsbhathiya","id":4924458,"avatar_url":"https://avatars.githubusercontent.com/u/4924458?v=2","gravatar_id":"6c903c737fa3b83d1b29b2af0041ecf5","url":"https://api.github.com/users/hsbhathiya","html_url":"https://github.com/hsbhathiya","followers_url":"https://api.github.com/users/hsbhathiya/followers","following_url":"https://api.github.com/users/hsbhathiya/following{/other_user}","gists_url":"https://api.github.com/users/hsbhathiya/gists{/gist_id}","starred_url":"https://api.github.com/users/hsbhathiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsbhathiya/subscriptions","organizations_url":"https://api.github.com/users/hsbhathiya/orgs","repos_url":"https://api.github.com/users/hsbhathiya/repos","events_url":"https://api.github.com/users/hsbhathiya/events{/privacy}","received_events_url":"https://api.github.com/users/hsbhathiya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hsbhathiya/jclouds-labs-google","description":"Read-only mirror of ASF Git Repo for jclouds labs-google","fork":true,"url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google","forks_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/forks","keys_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/teams","hooks_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/hooks","issue_events_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/issues/events{/number}","events_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/events","assignees_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/assignees{/user}","branches_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/branches{/branch}","tags_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/tags","blobs_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/git/refs{/sha}","trees_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/statuses/{sha}","languages_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/languages","stargazers_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/stargazers","contributors_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/contributors","subscribers_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/subscribers","subscription_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/subscription","commits_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/commits{/sha}","git_commits_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/git/commits{/sha}","comments_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/comments{/number}","issue_comment_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/issues/comments/{number}","contents_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/contents/{+path}","compare_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/merges","archive_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/downloads","issues_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/issues{/number}","pulls_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/pulls{/number}","milestones_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/milestones{/number}","notifications_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/labels{/name}","releases_url":"https://api.github.com/repos/hsbhathiya/jclouds-labs-google/releases{/id}","created_at":"2014-05-11T18:30:57Z","updated_at":"2014-06-24T03:10:17Z","pushed_at":"2014-09-06T08:26:26Z","git_url":"git://github.com/hsbhathiya/jclouds-labs-google.git","ssh_url":"git@github.com:hsbhathiya/jclouds-labs-google.git","clone_url":"https://github.com/hsbhathiya/jclouds-labs-google.git","svn_url":"https://github.com/hsbhathiya/jclouds-labs-google","homepage":null,"size":4379,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jclouds:master","ref":"master","sha":"f82e303d2d7bbd8945e74e34d4ac692006c2abb7","user":{"login":"jclouds","id":108982,"avatar_url":"https://avatars.githubusercontent.com/u/108982?v=2","gravatar_id":"08fdc408ec6d07b292b8fdf46b1e3e1e","url":"https://api.github.com/users/jclouds","html_url":"https://github.com/jclouds","followers_url":"https://api.github.com/users/jclouds/followers","following_url":"https://api.github.com/users/jclouds/following{/other_user}","gists_url":"https://api.github.com/users/jclouds/gists{/gist_id}","starred_url":"https://api.github.com/users/jclouds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jclouds/subscriptions","organizations_url":"https://api.github.com/users/jclouds/orgs","repos_url":"https://api.github.com/users/jclouds/repos","events_url":"https://api.github.com/users/jclouds/events{/privacy}","received_events_url":"https://api.github.com/users/jclouds/received_events","type":"Organization","site_admin":false},"repo":{"id":10040995,"name":"jclouds-labs-google","full_name":"jclouds/jclouds-labs-google","owner":{"login":"jclouds","id":108982,"avatar_url":"https://avatars.githubusercontent.com/u/108982?v=2","gravatar_id":"08fdc408ec6d07b292b8fdf46b1e3e1e","url":"https://api.github.com/users/jclouds","html_url":"https://github.com/jclouds","followers_url":"https://api.github.com/users/jclouds/followers","following_url":"https://api.github.com/users/jclouds/following{/other_user}","gists_url":"https://api.github.com/users/jclouds/gists{/gist_id}","starred_url":"https://api.github.com/users/jclouds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jclouds/subscriptions","organizations_url":"https://api.github.com/users/jclouds/orgs","repos_url":"https://api.github.com/users/jclouds/repos","events_url":"https://api.github.com/users/jclouds/events{/privacy}","received_events_url":"https://api.github.com/users/jclouds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jclouds/jclouds-labs-google","description":"Read-only mirror of ASF Git Repo for jclouds labs-google","fork":false,"url":"https://api.github.com/repos/jclouds/jclouds-labs-google","forks_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/forks","keys_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/teams","hooks_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/hooks","issue_events_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/issues/events{/number}","events_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/events","assignees_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/assignees{/user}","branches_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/branches{/branch}","tags_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/tags","blobs_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/git/refs{/sha}","trees_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/statuses/{sha}","languages_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/languages","stargazers_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/stargazers","contributors_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/contributors","subscribers_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/subscribers","subscription_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/subscription","commits_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/commits{/sha}","git_commits_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/git/commits{/sha}","comments_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/comments{/number}","issue_comment_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/issues/comments/{number}","contents_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/contents/{+path}","compare_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/merges","archive_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/downloads","issues_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/issues{/number}","pulls_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls{/number}","milestones_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/milestones{/number}","notifications_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/labels{/name}","releases_url":"https://api.github.com/repos/jclouds/jclouds-labs-google/releases{/id}","created_at":"2013-05-13T20:48:38Z","updated_at":"2014-08-12T10:48:29Z","pushed_at":"2014-09-01T03:03:23Z","git_url":"git://github.com/jclouds/jclouds-labs-google.git","ssh_url":"git@github.com:jclouds/jclouds-labs-google.git","clone_url":"https://github.com/jclouds/jclouds-labs-google.git","svn_url":"https://github.com/jclouds/jclouds-labs-google","homepage":null,"size":2912,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":24,"mirror_url":null,"open_issues_count":6,"forks":24,"open_issues":6,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/48"},"html":{"href":"https://github.com/jclouds/jclouds-labs-google/pull/48"},"issue":{"href":"https://api.github.com/repos/jclouds/jclouds-labs-google/issues/48"},"comments":{"href":"https://api.github.com/repos/jclouds/jclouds-labs-google/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/jclouds/jclouds-labs-google/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/jclouds/jclouds-labs-google/statuses/fd24279f17c392d00529988935d3311c77c7be64"}}}}