Package org.jclouds.blobstore

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()


     */
    public String pushToS3(OutboundConfiguration outboundConfiguration, String payloadIdentifier, byte[] payload)
            throws InvalidCredentialsException {
        BlobStore s3BlobStore = getBlobStoreContext().getBlobStore();
        String bucketName = createBucket(outboundConfiguration);
        Blob blob = s3BlobStore.blobBuilder(payloadIdentifier).payload(payload).build();
        return s3BlobStore.putBlob(bucketName,blob);
    }

    /**
     * Extracts a bucket name from an OutboundConfiguration.  If the OutboundConfiguration's namespace property is non-null
View Full Code Here


                        @Override
                        public void close()
                        throws IOException
                        {
                            super.close();
                            Blob blob = blobStore.blobBuilder( ref.identity() )
                                .payload( ByteSource.wrap( toString().getBytes( UTF_8 ) ) )
                                .build();
                            blobStore.putBlob( container, blob );
                        }
                    };
View Full Code Here

                        @Override
                        public void close()
                        throws IOException
                        {
                            super.close();
                            Blob blob = blobStore.blobBuilder( ref.identity() )
                                .payload( ByteSource.wrap( toString().getBytes( UTF_8 ) ) )
                                .build();
                            blobStore.putBlob( container, blob );
                        }
                    };
View Full Code Here

      String containerName = getContainerName();
     
      try {
         BlobStore blobStore = view.getBlobStore();
         blobStore.createContainerInLocation(null, containerName);
         Blob blob = blobStore.blobBuilder("const.txt").payload(file).build();
         blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());

      } finally {
         returnContainer(containerName);
      }
View Full Code Here

      try {
         String blobName = "test-rrs";
         BlobStore blobStore = view.getBlobStore();
         blobStore.createContainerInLocation(null, containerName);

         Blob blob = blobStore.blobBuilder(blobName).payload("something").build();
         blobStore.putBlob(containerName, blob,
            storageClass(StorageClass.REDUCED_REDUNDANCY));

         S3Client s3Client = S3Client.class.cast(view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi());
         ListBucketResponse response = s3Client.listBucket(containerName, withPrefix(blobName));
View Full Code Here

            }
         }

         assertNotNull(container);

         store.putBlob(bucketName, store.blobBuilder(blobName)
                                          .payload("This is a test!")
                                          .contentType("text/plain")
                                          .build());

         assertNotNull(store.getBlob(bucketName, blobName));
View Full Code Here

         File inFile = createFileBiggerThan(PART_SIZE);
         File outFile = new File("target/lots-of-const-readback.txt");

         InputStream contentToUpload = new FileInputStream(inFile);
         Blob write = blobStore.blobBuilder("const.txt").payload(contentToUpload).contentLength(inFile.length()).build();
         blobStore.putBlob(container, write, PutOptions.Builder.multipart());

         Blob read = blobStore.getBlob(container, "const.txt");
         read.getPayload().writeTo(new FileOutputStream(outFile));
View Full Code Here

   protected void addMultipartBlobToContainer(String containerName, String key) throws IOException {
      File fileToUpload = createFileBiggerThan(PART_SIZE);

      BlobStore blobStore = view.getBlobStore();
      blobStore.createContainerInLocation(null, containerName);
      Blob blob = blobStore.blobBuilder(key)
         .payload(fileToUpload)
         .build();
      blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
   }
View Full Code Here

   }

   @Test
   public void testSignPutBlobWithTime() throws Exception {
      BlobStore signPutBloblWithTime = requestsSendResponses(init());
      Blob blob = signPutBloblWithTime.blobBuilder(name).payload(text).contentType("text/plain").build();
      HttpRequest compare = putBlobWithTime();
      compare.setPayload(blob.getPayload());
      assertEquals(signPutBloblWithTime.getContext().getSigner().signPutBlob(container, blob, 3l /* seconds */),
         compare);
   }
View Full Code Here

      String containerName = getContainerName();

      try {
         BlobStore blobStore = view.getBlobStore();
         blobStore.createContainerInLocation(null, containerName);
         Blob blob = blobStore.blobBuilder("const.txt").payload(file).build();
         String expected = blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
         String etag = blobStore.blobMetadata(containerName, "const.txt").getETag();
         assertEquals(etag, expected);
      } finally {
         returnContainer(containerName);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.