Package org.jclouds.atmos.domain

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


   @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

      return stream ? Strings2.toInputStream(in) : in;
   }

   private void createOrReplaceObject(String name, Object data, String metadataValue) throws Exception {
      // Test PUT with string data, ETag hash, and a piece of metadata
      AtmosObject object = getApi().newObject();
      object.getContentMetadata().setName(name);
      object.setPayload(Payloads.newPayload(data));
      object.getContentMetadata().setContentLength(16l);
      Payloads.calculateMD5(object);
      object.getContentMetadata().setContentType("text/plain");
      object.getUserMetadata().getMetadata().put("Metadata", metadataValue);
      replaceObject(object);
   }
View Full Code Here

      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.toString(getBlob.getPayload()), "");
      verifyMetadata(metadataValue, getBlob);
   }
View Full Code Here

      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.toString(getBlob.getPayload()), compare);
      verifyMetadata(metadataValue, getBlob);
   }
View Full Code Here

   }

   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

      return stream ? Strings2.toInputStream(in) : in;
   }

   private void createOrReplaceObject(String name, Object data, String metadataValue) throws Exception {
      // Test PUT with string data, ETag hash, and a piece of metadata
      AtmosObject object = getApi().newObject();
      object.getContentMetadata().setName(name);
      object.setPayload(Payloads.newPayload(data));
      object.getContentMetadata().setContentLength(16l);
      Payloads.calculateMD5(object);
      object.getContentMetadata().setContentType("text/plain");
      object.getUserMetadata().getMetadata().put("Metadata", metadataValue);
      replaceObject(object);
   }
View Full Code Here

      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.toString(getBlob.getPayload()), "");
      verifyMetadata(metadataValue, getBlob);
   }
View Full Code Here

      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.toString(getBlob.getPayload()), compare);
      verifyMetadata(metadataValue, getBlob);
   }
View Full Code Here

      }
   }

   @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testFileOperations" })
   public void testPutZeroLengthBlob() throws Exception {
      AtmosObject object = getApi().newObject();
      object.getContentMetadata().setName("object");
      byte[] payload = new byte[0];
      object.setPayload(Payloads.newPayload(payload));
      object.getContentMetadata().setContentLength(Long.valueOf(payload.length));
      replaceObject(object);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.atmos.domain.AtmosObject

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.