Package org.jclouds.blobstore.options

Examples of org.jclouds.blobstore.options.PutOptions


            payloadBuilder = payloadBuilder.contentMD5(byteSource.hash(Hashing.md5()).asBytes());
         }
         builder = payloadBuilder;
      }

      PutOptions options = multipartUpload ? new PutOptions().multipart(true) : PutOptions.NONE;

      write(blobStore, containerName, blobName, builder.build(), options, signedRequest);

      cacheProvider.getProviderCacheForType("container").put(blobStore.getContext().unwrap().getId(), containerName);
      cacheProvider.getProviderCacheForType("blob").put(blobStore.getContext().unwrap().getId(), blobName);


            payloadBuilder = payloadBuilder.calculateMD5();
         }
         builder = payloadBuilder;
      }

      PutOptions options = multipartUpload ? new PutOptions().multipart(true) : PutOptions.NONE;
      write(blobStore, containerName, blobName, builder.build(), options);

      cacheProvider.getProviderCacheForType("container").put(blobStore.getContext().unwrap().getId(), containerName);
      cacheProvider.getProviderCacheForType("blob").put(blobStore.getContext().unwrap().getId(), blobName);

                     }
                  } else {
                     // Issue 936: don't just call putBlob, as that will see options=multiPart and
                     // recursively call this execute method again; instead mark as not multipart
                     // because it can all fit in one go.
                     PutOptions nonMultipartOptions = PutOptions.Builder.multipart(false);
                     ListenableFuture<String> futureETag = ablobstore.putBlob(container, blob, nonMultipartOptions);
                     return maxTime != null ?
                           futureETag.get(maxTime,TimeUnit.SECONDS) : futureETag.get();
                  }
               }

                     }
                  } else {
                     // Issue 936: don't just call putBlob, as that will see options=multiPart and
                     // recursively call this execute method again; instead mark as not multipart
                     // because it can all fit in one go.
                     PutOptions nonMultipartOptions = PutOptions.Builder.multipart(false);
                     ListenableFuture<String> futureETag = ablobstore.putBlob(container, blob, nonMultipartOptions);
                     return maxTime != null ?
                           futureETag.get(maxTime, TimeUnit.SECONDS) : futureETag.get();
                  }
               }

            payloadBuilder = payloadBuilder.calculateMD5();
         }
         builder = payloadBuilder;
      }

      PutOptions options = multipartUpload ? new PutOptions().multipart(true) : PutOptions.NONE;

      write(blobStore, containerName, blobName, builder.build(), options, signedRequest);

      cacheProvider.getProviderCacheForType("container").put(blobStore.getContext().unwrap().getId(), containerName);
      cacheProvider.getProviderCacheForType("blob").put(blobStore.getContext().unwrap().getId(), blobName);

            }
            if (contentMD5 != null) {
                builder = builder.contentMD5(contentMD5);
            }

            PutOptions options = new PutOptions()
                .multipart(forceMultiPartUpload);
            try {
                String eTag = blobStore.putBlob(containerName, builder.build(),
                        options);
                // S3 quotes ETag while Swift does not

                     }
                  } else {
                     // Issue 936: don't just call putBlob, as that will see options=multiPart and
                     // recursively call this execute method again; instead mark as not multipart
                     // because it can all fit in one go.
                     PutOptions nonMultipartOptions = PutOptions.Builder.multipart(false);
                     ListenableFuture<String> futureETag = ablobstore.putBlob(container, blob, nonMultipartOptions);
                     return maxTime != null ?
                           futureETag.get(maxTime,TimeUnit.SECONDS) : futureETag.get();
                  }
               }

            .payload(payload)
            .contentLength(payload.size())
            .build();

      // Create the PutOptions
      PutOptions options = PutOptions.Builder.multipart(true);

      // Put the blob in the container
      blobstore.putBlob(containerName, blob, options);
      System.out.println("The blob has been uploaded");
   }

                     }
                  } else {
                     // Issue 936: don't just call putBlob, as that will see options=multiPart and
                     // recursively call this execute method again; instead mark as not multipart
                     // because it can all fit in one go.
                     final PutOptions nonMultipartOptions = PutOptions.Builder.multipart(false);
                     ListenableFuture<String> futureETag = executor.submit(new Callable<String>() {
                        @Override public String call() throws Exception {
                           return blobstore.putBlob(container, blob, nonMultipartOptions);
                        }
                     });

TOP

Related Classes of org.jclouds.blobstore.options.PutOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.