Package org.jclouds.blobstore.domain

Examples of org.jclouds.blobstore.domain.Blob$Factory


      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
      BindUserMetadataToHeadersWithPrefix binder = new BindUserMetadataToHeadersWithPrefix(
            new BindMapToHeadersWithPrefix("prefix:"));

      Blob blob = ContextBuilder.newBuilder("transient").buildInjector().getInstance(Blob.Factory.class).create(null);

      blob.getMetadata().setUserMetadata(ImmutableMap.of("imageName", "foo", "serverId", "2"));

      assertEquals(
            binder.bindToRequest(request, blob),
            HttpRequest.builder().method("GET").endpoint("http://momma")
                       .addHeader("prefix:imagename", "foo")
View Full Code Here


      return payload(newPayload(checkNotNull(data, "data")));
   }

   @Override
   public Blob build() {
      Blob blob = new BlobImpl(new MutableBlobMetadataImpl());
      checkState(name != null, "name");
      blob.getMetadata().setName(name);
      if (payload != null)
         blob.setPayload(payload);
      blob.getMetadata().setUserMetadata(userMetadata);
      blob.getMetadata().setType(type);
      return blob;
   }
View Full Code Here

   protected String addBlobToContainer(String sourceContainer, String key) {
      return addBlobToContainer(sourceContainer, key, TEST_STRING, MediaType.TEXT_XML);
   }

   protected String addBlobToContainer(String sourceContainer, String key, String payload, String contentType) {
      Blob sourceObject = view.getBlobStore().blobBuilder(key).payload(payload).contentType(contentType).build();
      return addBlobToContainer(sourceContainer, sourceObject);
   }
View Full Code Here

      return addBlobToContainer(sourceContainer, sourceObject);
   }

   protected void add5BlobsUnderPathAnd5UnderRootToContainer(String sourceContainer) {
      for (Entry<String, String> entry : Iterables.concat(fiveStrings.entrySet(), fiveStringsUnderPath.entrySet())) {
         Blob sourceObject = view.getBlobStore().blobBuilder(entry.getKey()).payload(entry.getValue())
               .contentType("text/xml").build();
         addBlobToContainer(sourceContainer, sourceObject);
      }
   }
View Full Code Here

      return md;
   }

   protected Blob validateContent(String container, String name) throws InterruptedException {
      assertConsistencyAwareContainerSize(container, 1);
      Blob newObject = view.getBlobStore().getBlob(container, name);
      assert newObject != null;
      validateMetadata(newObject.getMetadata(), container, name);
      try {
         assertEquals(getContentAsStringOrNullAndClose(newObject), TEST_STRING);
      } catch (IOException e) {
         throw new RuntimeException(e);
      }
View Full Code Here

   }

   @Override
   public InputStream get(Object o) {
      String realKey = prefixer.apply(o.toString());
      Blob blob = blobstore.getBlob(containerName, realKey);
      return getInputStreamOrNull(blob);
   }
View Full Code Here

            }));
   }

   @VisibleForTesting
   Blob newBlobWithMD5(String name, Object value) {
      Blob blob = blobstore.blobBuilder(prefixer.apply(name)).payload(newPayload(value)).build();
      try {
         Payloads.calculateMD5(blob);
      } catch (IOException e) {
         Throwables.propagate(e);
      }
View Full Code Here

   protected void assertConsistencyAwareBlobExpiryMetadata(final String containerName, final String blobName,
            final Date expectedExpires) throws InterruptedException {
      assertConsistencyAware(new Runnable() {
         public void run() {
            try {
               Blob blob = view.getBlobStore().getBlob(containerName, blobName);
               Date actualExpires = blob.getPayload().getContentMetadata().getExpires();
               assert expectedExpires.equals(actualExpires) : "expires=" + actualExpires + "; expected="
                        + expectedExpires;
            } catch (Exception e) {
               Throwables.propagateIfPossible(e);
            }
View Full Code Here

    * @see S3Client#put(String, Blob)
    */
   @VisibleForTesting
   InputStream putInternal(String name, Payload payload) {
      InputStream returnVal = containsKey(name) ? get(name) : null;
      Blob blob = newBlobWithMD5(name, payload);
      blobstore.putBlob(containerName, blob);
      return returnVal;
   }
View Full Code Here

   private void assertConsistencyAwareContentEquals(final Map<String, Blob> map, final String key, final String blob)
         throws InterruptedException {
      assertConsistencyAware(new Runnable() {
         public void run() {
            Blob old = map.remove(key);
            try {
               assertEquals(getContentAsStringOrNullAndClose(old), blob);
            } catch (IOException e) {
               throw new RuntimeException(e);
            }
View Full Code Here

TOP

Related Classes of org.jclouds.blobstore.domain.Blob$Factory

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.