Examples of AtmosObject


Examples of org.jclouds.atmos.domain.AtmosObject

      assertEventually(new HeadMatches(getApi(), privateDirectory + "/" + name, metadataValue));
   }

   private static void verifyHeadObject(AtmosClient connection, String path, String metadataValue)
            throws InterruptedException, ExecutionException, TimeoutException, IOException {
      AtmosObject getBlob = connection.headFile(path);
      assertEquals(Strings2.toStringAndClose(getBlob.getPayload().openStream()), "");
      verifyMetadata(metadataValue, getBlob);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      verifyMetadata(metadataValue, getBlob);
   }

   private static void verifyObject(AtmosClient connection, String path, String compare, String metadataValue)
            throws InterruptedException, ExecutionException, TimeoutException, IOException {
      AtmosObject getBlob = connection.readFile(path);
      assertEquals(Strings2.toStringAndClose(getBlob.getPayload().openStream()), compare);
      verifyMetadata(metadataValue, getBlob);
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

   }

   public static String putBlob(final AtmosClient sync, Crypto crypto, BlobToObject blob2Object, String container,
            Blob blob, PutOptions options) {
      final String path = container + "/" + blob.getMetadata().getName();
      final AtmosObject object = blob2Object.apply(blob);
     
      try {
         sync.createFile(container, object, options);
        
      } catch(KeyAlreadyExistsException e) {
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

   }

   public AtmosObject apply(Blob from) {
      if (from == null)
         return null;
      AtmosObject object = blobMd2Object.apply(from.getMetadata());
      object.setPayload(checkNotNull(from.getPayload(), "payload: " + from));
      object.setAllHeaders(from.getAllHeaders());
      return object;
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

    *
    * @throws org.jclouds.http.HttpException
    */
   public AtmosObject apply(HttpResponse from) {
      checkNotNull(from, "http response");
      AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from));
      object.getContentMetadata().setName(object.getSystemMetadata().getObjectName());
      object.getContentMetadata().setPath(path);
      object.getContentMetadata().setUri(uri);
      object.getAllHeaders().putAll(from.getHeaders());
      object.setPayload(from.getPayload());
      object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from));
      return object;
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

public class AtmosObjectName implements Function<Object, String> {
   @Override
   public String apply(Object input) {
      checkArgument(checkNotNull(input, "input") instanceof AtmosObject,
            "this function is only valid for AtmosObjects!");
      AtmosObject object = AtmosObject.class.cast(input);

      return checkNotNull(object.getContentMetadata().getName() != null ? object.getContentMetadata().getName()
            : object.getSystemMetadata().getObjectName(), "objectName");
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(checkNotNull(input, "input") instanceof AtmosObject, "this binder is only valid for AtmosObject!");
      checkNotNull(request, "request");

      AtmosObject object = AtmosObject.class.cast(input);
      checkNotNull(object.getPayload(), "object payload");
      checkArgument(object.getPayload().getContentMetadata().getContentLength() != null,
            "contentLength must be set, streaming not supported");
      return metaBinder.bindToRequest(request, object.getUserMetadata());
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

      for (BlobMetadata md : getAllBlobMetadata.execute(containerName, options)) {
         final ListenableFuture<AtmosObject> future = client.headFile(containerName + "/" + md.getName());
         future.addListener(new Runnable() {
            public void run() {
               try {
                  AtmosObject object = future.get();
                  checkNotNull(object.getSystemMetadata(), object + " has no content metadata");
                  if (object.getSystemMetadata().getContentMD5() != null) {
                     if (Arrays.equals(toSearch, object.getSystemMetadata().getContentMD5())) {
                        queue.put(true);
                     }
                  } else {
                     logger.debug("object %s has no content md5", object.getSystemMetadata().getObjectID());
                  }
               } catch (InterruptedException e) {
                  Throwables.propagate(e);
               } catch (ExecutionException e) {
                  Throwables.propagate(e);
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

   private static final Factory BLOB_FACTORY = Guice.createInjector().getInstance(AtmosObject.Factory.class);

   @Test
   public void testCorrectContentMetadataName() throws SecurityException, NoSuchMethodException {

      AtmosObject blob = BLOB_FACTORY.create(null);
      blob.getContentMetadata().setName("foo");

      assertEquals(fn.apply(blob), "foo");
   }
View Full Code Here

Examples of org.jclouds.atmos.domain.AtmosObject

   }

   @Test
   public void testCorrectSystemMetadataObjectName() throws SecurityException, NoSuchMethodException {

      AtmosObject blob = BLOB_FACTORY.create(new SystemMetadata(null, null, null, null, null, null, 0, null, "foo",
            null, 0, null, null), new UserMetadata());
      assertEquals(fn.apply(blob), "foo");
   }
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.