Package org.jclouds.blobstore.domain

Examples of org.jclouds.blobstore.domain.BlobMetadata


         addBlobToContainer(containerName, object);
         validateContent(containerName, key);

         PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1));

         BlobMetadata metadata = (BlobMetadata) Iterables.getOnlyElement(container);
         // transient container should be lenient and not return metadata on
         // undetailed listing.

         assertEquals(metadata.getUserMetadata().size(), 0);

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


   /**
    * parses the http response headers to create a new
    * {@link org.jclouds.s3.domain.internal.MutableObjectMetadata} object.
    */
   public MutableObjectMetadata apply(HttpResponse from) {
      BlobMetadata base = blobMetadataParser.apply(from);
      MutableObjectMetadata to = blobToObjectMetadata.apply(base);

      addETagTo(from, to);
      if (to.getContentMetadata().getContentMD5() == null && to.getETag() != null) {
         Matcher md5Matcher = MD5_FROM_ETAG.matcher(to.getETag());
View Full Code Here

         addBlobToContainer(containerName, object);
         validateContent(containerName, key);

         PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1));

         BlobMetadata metadata = (BlobMetadata) Iterables.getOnlyElement(container);
         // transient container should be lenient and not return metadata on
         // undetailed listing.

         assertEquals(metadata.getUserMetadata().size(), 0);

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

    public void testBlobMetadata_withDefaultMetadata() throws IOException {
        String BLOB_KEY = TestUtils.createRandomBlobKey(null, null);
        // create the blob
        TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY);

        BlobMetadata metadata = blobStore.blobMetadata(CONTAINER_NAME, BLOB_KEY);
        assertNotNull(metadata, "Metadata null");

        assertEquals(metadata.getName(), BLOB_KEY, "Wrong blob name");
        assertEquals(metadata.getType(), StorageType.BLOB, "Wrong blob type");
        assertEquals(metadata.getContentMetadata().getContentType(), "application/unknown", "Wrong blob content-type");
        assertEquals(base16().lowerCase().encode(metadata.getContentMetadata().getContentMD5()), metadata.getETag(),
                "Wrong blob MD5");
        assertEquals(metadata.getLocation(), null, "Wrong blob location");
        assertEquals(metadata.getProviderId(), null, "Wrong blob provider id");
        assertEquals(metadata.getUri(), null, "Wrong blob URI");
        assertNotNull(metadata.getUserMetadata(), "No blob UserMetadata");
        assertEquals(metadata.getUserMetadata().size(), 0, "Wrong blob UserMetadata");
        // metadata.getLastModified()
        File file = new File(TARGET_CONTAINER_NAME, BLOB_KEY);
        assertEquals(metadata.getContentMetadata().getContentLength(), Long.valueOf(file.length()), "Wrong blob size");
    }
View Full Code Here

   /**
    * parses the http response headers to create a new
    * {@link org.jclouds.s3.domain.internal.MutableObjectMetadata} object.
    */
   public MutableObjectMetadata apply(HttpResponse from) {
      BlobMetadata base = blobMetadataParser.apply(from);
      MutableObjectMetadata to = blobToObjectMetadata.apply(base);

      addETagTo(from, to);
      if (to.getContentMetadata().getContentMD5() == null && to.getETag() != null) {
         Matcher md5Matcher = MD5_FROM_ETAG.matcher(to.getETag());
View Full Code Here

         assertNull(view.getBlobStore().blobMetadata(container, "powderpuff"));

         addBlobToContainer(container, blob);
         Blob newObject = validateContent(container, name);

         BlobMetadata metadata = newObject.getMetadata();

         validateMetadata(metadata);
         validateMetadata(metadata, container, name);
         validateMetadata(view.getBlobStore().blobMetadata(container, name));
View Full Code Here

            {
                LOG.warn(provider + " may not be properly supported for tarball transfer.");
            }

            // resolve the full URI of the blob (see http://code.google.com/p/jclouds/issues/detail?id=431)
            BlobMetadata blob = context.getBlobStore().blobMetadata(container, blobName);
            URI uri = context.getProviderSpecificContext().getEndpoint().resolve("/" + container + "/" + blob.getName());
            return new Pair<BlobMetadata, URI>(blob, uri);
        }
        finally
        {
            context.close();
View Full Code Here

   /**
    * parses the http response headers to create a new {@link MutableObjectInfoWithMetadata} object.
    */
   public MutableObjectInfoWithMetadata apply(HttpResponse from) {
      BlobMetadata base = blobMetadataParser.apply(from);
      MutableObjectInfoWithMetadata to = blobToObjectInfo.apply(base);
      to.setBytes(attemptToParseSizeAndRangeFromHeaders(from));
      to.setContainer(container);
      to.setUri(base.getUri());
      String eTagHeader = from.getFirstHeaderOrNull(HttpHeaders.ETAG);
      if (eTagHeader != null) {
         to.setHash(ETagUtils.convertHexETagToByteArray(eTagHeader));
      }
      to.setObjectManifest(from.getFirstHeaderOrNull("X-Object-Manifest"));
View Full Code Here

   @Override
   protected Object doExecute() throws Exception {
      BlobStore blobStore = getBlobStore();

      for (String blobName : blobNames) {
         BlobMetadata blobMetadata = blobStore.blobMetadata(containerName, blobName);
         if (blobMetadata == null) {
            throw new KeyNotFoundException(containerName, blobName, "while getting metadata");
         }

         ContentMetadata contentMetdata = blobMetadata.getContentMetadata();
         out.println(blobName + ":");

         printMetadata("Content-Disposition", contentMetdata.getContentDisposition());
         printMetadata("Content-Encoding", contentMetdata.getContentEncoding());
         printMetadata("Content-Language", contentMetdata.getContentLanguage());
View Full Code Here

   @Override
   public SwiftObject apply(StorageMetadata in) {
      if (!(in instanceof BlobMetadata)) {
         return null;
      }
      BlobMetadata from = BlobMetadata.class.cast(in);
      Builder to = SwiftObject.builder();
      to.name(from.getName());
      to.etag(from.getETag());
      to.lastModified(from.getLastModified());
      long bytes = from.getContentMetadata().getContentLength();
      String contentType = from.getContentMetadata().getContentType();
      to.payload(payload(bytes, contentType));
      to.metadata(from.getUserMetadata());
      return to.build();
   }
View Full Code Here

TOP

Related Classes of org.jclouds.blobstore.domain.BlobMetadata

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.