Package org.jclouds.blobstore

Examples of org.jclouds.blobstore.BlobStore


   }

   private void uploadInputSupplier(String container, String name, String contentDisposition,
         InputSupplier<? extends InputStream> supplier) throws IOException {
      BlobStore blobStore = view.getBlobStore();
      blobStore.putBlob(container, blobStore.blobBuilder(name)
            .payload(new InputStreamSupplierPayload(supplier))
            .contentType("text/plain")
            .contentMD5(md5Supplier(supplier))
            .contentLength(ByteStreams.length(supplier))
            .contentDisposition(contentDisposition)
View Full Code Here


   }

   @Test(groups = { "integration", "live" })
   public void testCreateBlobWithExpiry() throws InterruptedException {
      String container = getContainerName();
      BlobStore blobStore = view.getBlobStore();
      try {
         final String blobName = "hello";
         final Date expires = new Date((System.currentTimeMillis() / 1000) * 1000 + 60 * 1000);

         blobStore.putBlob(container, blobStore.blobBuilder(blobName).payload(TEST_STRING).expires(expires).build());

         assertConsistencyAwareBlobExpiryMetadata(container, blobName, expires);

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

      }
   }

   private void putBlobWithMd5(byte[] payload, HashCode contentMD5) throws InterruptedException, IOException {
      String container = getContainerName();
      BlobStore blobStore = view.getBlobStore();
      try {
         String blobName = "putBlobWithMd5-" + new Random().nextLong();
         Blob blob = blobStore
            .blobBuilder(blobName)
            .payload(payload)
            .contentMD5(contentMD5.asBytes())
            .build();
         blobStore.putBlob(container, blob);
      } finally {
         returnContainer(container);
      }
   }
View Full Code Here

   
   @Test(groups = { "integration", "live" })
   public void testMultipartChunkedFileStream() throws IOException, InterruptedException {
      String containerName = getContainerName();
      try {
         BlobStore blobStore = view.getBlobStore();
         long countBefore = blobStore.countBlobs(containerName);

         addMultipartBlobToContainer(containerName, "const.txt");

         long countAfter = blobStore.countBlobs(containerName);
         assertNotEquals(countBefore, countAfter,
                         "No blob was created");
         assertTrue(countAfter - countBefore > 1,
                    "A multipart blob wasn't actually created - " +
                    "there was only 1 extra blob but there should be one manifest blob and multiple chunk blobs");
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

    @EndpointInject(uri = "mock:result-bar")
    protected MockEndpoint resultBar;

    @BeforeClass
    public static void setUpClass() throws Exception {
        BlobStore blobStore = ContextBuilder.newBuilder("transient").credentials("id", "credential").buildView(BlobStoreContext.class).getBlobStore();
        blobStore.createContainerInLocation(null, "foo");
        blobStore.createContainerInLocation(null, "bar");
    }
View Full Code Here

        }

        if (JcloudsConstants.BLOBSTORE.endsWith(endpointType)) {
            if (uriParts != null && uriParts.length >= 2) {
                String provider = uriParts[1];
                BlobStore blobStore = getBlobStore(provider);
                endpoint = new JcloudsBlobStoreEndpoint(uri, this, blobStore);
            } else {
                throw new IllegalArgumentException("Invalid Endpoint URI: " + uri + ". It should contains a valid provider name");
            }
        } else if (JcloudsConstants.COMPUTE.endsWith(endpointType)) {
View Full Code Here

    /**
     * Strategy to perform any pre setup, before {@link org.apache.camel.CamelContext} is created
     */
    @Override
    protected void doPreSetup() throws Exception {
        BlobStore blobStore = ContextBuilder.newBuilder("transient").credentials("identity", "credential").buildView(BlobStoreContext.class).getBlobStore();
        blobStore.createContainerInLocation(null, TEST_CONTAINER);
        blobStore.clearContainer(TEST_CONTAINER);
    }
View Full Code Here

    /**
     * Strategy to perform any pre setup, before {@link org.apache.camel.CamelContext} is created
     */
    @Override
    protected void doPreSetup() throws Exception {
        BlobStore blobStore = ContextBuilder.newBuilder("transient").credentials("identity", "credential").buildView(BlobStoreContext.class).getBlobStore();
        blobStore.createContainerInLocation(null, TEST_CONTAINER);
        blobStore.clearContainer(TEST_CONTAINER);
    }
View Full Code Here

    return null;
  }

  @Override
  public void save(Cluster cluster) throws IOException {
    BlobStore store = context.getBlobStore();

    Blob blob = store.newBlob(blobName);
    blob.setPayload(serialize(cluster));
    store.putBlob(container, blob);

    LOG.info("Saved cluster state to '{}' ", context.getSigner()
      .signGetBlob(container, blobName).getEndpoint().toString());
  }
View Full Code Here

TOP

Related Classes of org.jclouds.blobstore.BlobStore

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.