public String completeMultipartUpload()

in blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java [831:895]


   public String completeMultipartUpload(MultipartUpload mpu, List<MultipartPart> parts) {
      ImmutableList.Builder<BlobMetadata> metas = ImmutableList.builder();
      long contentLength = 0;
      Hasher md5Hasher = Hashing.md5().newHasher();

      for (MultipartPart part : parts) {
         BlobMetadata meta = blobMetadata(mpu.containerName(), MULTIPART_PREFIX + mpu.id() + "-" + mpu.blobName() + "-" + part.partNumber());
         contentLength += meta.getContentMetadata().getContentLength();
         metas.add(meta);
         if (meta.getETag() != null) {
            md5Hasher.putBytes(BaseEncoding.base16().lowerCase().decode(meta.getETag()));
         }
      }
      String mpuETag = new StringBuilder("\"")
         .append(md5Hasher.hash())
         .append("-")
         .append(parts.size())
         .append("\"")
         .toString();
      PayloadBlobBuilder blobBuilder = blobBuilder(mpu.blobName())
            .userMetadata(mpu.blobMetadata().getUserMetadata())
            .payload(new MultiBlobInputStream(this, metas.build()))
            .contentLength(contentLength)
            .eTag(mpuETag);
      String cacheControl = mpu.blobMetadata().getContentMetadata().getCacheControl();
      if (cacheControl != null) {
         blobBuilder.cacheControl(cacheControl);
      }
      String contentDisposition = mpu.blobMetadata().getContentMetadata().getContentDisposition();
      if (contentDisposition != null) {
         blobBuilder.contentDisposition(contentDisposition);
      }
      String contentEncoding = mpu.blobMetadata().getContentMetadata().getContentEncoding();
      if (contentEncoding != null) {
         blobBuilder.contentEncoding(contentEncoding);
      }
      String contentLanguage = mpu.blobMetadata().getContentMetadata().getContentLanguage();
      if (contentLanguage != null) {
         blobBuilder.contentLanguage(contentLanguage);
      }
      // intentionally not copying MD5
      String contentType = mpu.blobMetadata().getContentMetadata().getContentType();
      if (contentType != null) {
         blobBuilder.contentType(contentType);
      }
      Date expires = mpu.blobMetadata().getContentMetadata().getExpires();
      if (expires != null) {
         blobBuilder.expires(expires);
      }
      Tier tier = mpu.blobMetadata().getTier();
      if (tier != null) {
          blobBuilder.tier(tier);
      }

      putBlob(mpu.containerName(), blobBuilder.build());

      for (MultipartPart part : parts) {
         removeBlob(mpu.containerName(), MULTIPART_PREFIX + mpu.id() + "-" + mpu.blobName() + "-" + part.partNumber());
      }
      removeBlob(mpu.containerName(), MULTIPART_PREFIX + mpu.id() + "-" + mpu.blobName() + "-stub");

      setBlobAccess(mpu.containerName(), mpu.blobName(), mpu.putOptions().getBlobAccess());

      return mpuETag;
   }