Examples of BlobMetadata


Examples of org.jclouds.blobstore.domain.BlobMetadata

   @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

Examples of org.jclouds.blobstore.domain.BlobMetadata

   @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

Examples of org.jclouds.blobstore.domain.BlobMetadata

   @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

Examples of org.jclouds.blobstore.domain.BlobMetadata

                .payload(byteSource)
                .contentLength(byteSource.size())
                .build();
        s3BlobStore.putBlob(containerName, blob1);

        BlobMetadata metadata = s3BlobStore.blobMetadata(containerName,
                blobName);
        assertThat(metadata.getName()).isEqualTo(blobName);
        assertThat(metadata.getContentMetadata().getContentLength())
                .isEqualTo(byteSource.size());

        assertThat(s3BlobStore.blobMetadata(containerName,
                "fake-blob")).isNull();
    }
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

        }
    }

    private void handleBlobMetadata(HttpServletResponse response,
            String containerName, String blobName) throws IOException {
        BlobMetadata metadata;
        try {
            metadata = blobStore.blobMetadata(containerName, blobName);
        } catch (ContainerNotFoundException cnfe) {
            sendSimpleErrorResponse(response, S3ErrorCode.NO_SUCH_BUCKET);
            return;
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

   /**
    * parses the http response headers to create a new {@link MutableBlobProperties} object.
    */
   public MutableBlobProperties apply(HttpResponse from) {
      BlobMetadata base = blobMetadataParser.apply(from);
      MutableBlobProperties to = blobToBlobProperties.apply(base);
      to.setContainer(container);
      return to;
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

    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

Examples of org.jclouds.blobstore.domain.BlobMetadata

   /**
    * 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("Etag");
      if (eTagHeader != null) {
         to.setHash(base16().lowerCase().decode(eTagHeader));
      }
      return to;
View Full Code Here

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

Examples of org.sonatype.nexus.blobstore.file.BlobMetadata

    return results;
  }

  @Test
  public void stateTracking() throws Exception {
    BlobMetadata md = new BlobMetadata(BlobState.CREATING, ImmutableMap.of("foo", "bar"));
    BlobId id = underTest.add(md);
    log("Added: {} -> {}", id, md);

    // states should only contain CREATING
    assertThat(findWithState(BlobState.CREATING), contains(id));
    assertThat(findWithState(BlobState.ALIVE), emptyIterable());
    assertThat(findWithState(BlobState.MARKED_FOR_DELETION), emptyIterable());

    md.setBlobState(BlobState.ALIVE);
    underTest.update(id, md);
    log("Updated: {} -> {}", id, md);

    // states should only contain ALIVE
    assertThat(findWithState(BlobState.CREATING), emptyIterable());
    assertThat(findWithState(BlobState.ALIVE), contains(id));
    assertThat(findWithState(BlobState.MARKED_FOR_DELETION), emptyIterable());

    md.setBlobState(BlobState.MARKED_FOR_DELETION);
    underTest.update(id, md);
    log("Updated: {} -> {}", id, md);

    // states should only contain marked for MARKED_FOR_DELETION
    assertThat(findWithState(BlobState.CREATING), emptyIterable());
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.