Package org.jclouds.blobstore.domain

Examples of org.jclouds.blobstore.domain.StorageMetadata


        }

        private void loadElements(PageSet<? extends StorageMetadata> set) {
            Iterator<? extends StorageMetadata> iter = set.iterator();
            while (iter.hasNext()) {
                StorageMetadata metadata = iter.next();
                if ((maxLastModifiedTime == 0 || maxLastModifiedTime == -1) ||
                        (metadata.getLastModified().getTime() <= maxLastModifiedTime)) {
                    queue.add(metadata.getName());
                } else {
                    queue.add(metadata.getName());
                }
            }
        }
View Full Code Here


      String marker = null;
      if (options != null) {
         if (options.getMarker() != null) {
            final String finalMarker = options.getMarker();
            StorageMetadata lastMarkerMetadata = find(contents, new Predicate<StorageMetadata>() {
               public boolean apply(StorageMetadata metadata) {
                  return metadata.getName().compareTo(finalMarker) > 0;
               }
            });
            contents = contents.tailSet(lastMarkerMetadata);
         }

         final String prefix = options.getDir();
         if (prefix != null) {
            contents = newTreeSet(filter(contents, new Predicate<StorageMetadata>() {
               public boolean apply(StorageMetadata o) {
                  return o != null && o.getName().startsWith(prefix) && !o.getName().equals(prefix);
               }
            }));
         }

         int maxResults = options.getMaxResults() != null ? options.getMaxResults() : 1000;
         if (!contents.isEmpty()) {
            StorageMetadata lastElement = contents.last();
            contents = newTreeSet(Iterables.limit(contents, maxResults));
            if (!contents.contains(lastElement)) {
               // Partial listing
               marker = contents.last().getName();
            }
View Full Code Here

    * http://code.google.com/p/jclouds/issues/detail?id=992
    */
   public void testUseBucketWithUpperCaseName() throws Exception {
      String bucketName = CONTAINER_PREFIX + "-TestBucket";
      String blobName = "TestBlob.txt";
      StorageMetadata container = null;
      BlobStore store = view.getBlobStore();

      // Create and use a valid bucket name with uppercase characters in the bucket name (US regions only)
      try {
         store.createContainerInLocation(null, bucketName);
View Full Code Here

   protected void assertConsistencyAwareContainerInLocation(final String containerName, final Location loc)
            throws InterruptedException {
      assertConsistencyAware(new Runnable() {
         public void run() {
            try {
               StorageMetadata container = Iterables.find(view.getBlobStore().list(), new Predicate<StorageMetadata>() {

                  @Override
                  public boolean apply(@Nullable StorageMetadata input) {
                     return input.getName().equals(containerName);
                  }

               });
               Location actualLoc = container.getLocation();

               assert loc.equals(actualLoc) : String.format("blob %s, in location %s instead of %s", containerName,
                        actualLoc, loc);
            } catch (Exception e) {
               Throwables.propagate(e);
View Full Code Here

      String marker = null;
      if (options != null) {
         if (options.getMarker() != null) {
            final String finalMarker = options.getMarker();
            StorageMetadata lastMarkerMetadata = find(contents, new Predicate<StorageMetadata>() {
               public boolean apply(StorageMetadata metadata) {
                  return metadata.getName().compareTo(finalMarker) > 0;
               }
            });
            contents = contents.tailSet(lastMarkerMetadata);
         }

         final String prefix = options.getDir();
         if (prefix != null) {
            contents = newTreeSet(filter(contents, new Predicate<StorageMetadata>() {
               public boolean apply(StorageMetadata o) {
                  return o != null && o.getName().startsWith(prefix) && !o.getName().equals(prefix);
               }
            }));
         }

         int maxResults = options.getMaxResults() != null ? options.getMaxResults() : 1000;
         if (!contents.isEmpty()) {
            StorageMetadata lastElement = contents.last();
            contents = newTreeSet(Iterables.limit(contents, maxResults));
            if (!contents.contains(lastElement)) {
               // Partial listing
               marker = contents.last().getName();
            }
View Full Code Here

   protected void assertConsistencyAwareContainerInLocation(final String containerName, final Location loc)
            throws InterruptedException {
      assertConsistencyAware(new Runnable() {
         public void run() {
            try {
               StorageMetadata container = Iterables.find(view.getBlobStore().list(), new Predicate<StorageMetadata>() {

                  @Override
                  public boolean apply(@Nullable StorageMetadata input) {
                     return input.getName().equals(containerName);
                  }

               });
               Location actualLoc = container.getLocation();

               assert loc.equals(actualLoc) : String.format("blob %s, in location %s instead of %s", containerName,
                        actualLoc, loc);
            } catch (Exception e) {
               Throwables.propagate(e);
View Full Code Here

      String marker = null;
      if (options != null) {
         if (options.getMarker() != null) {
            final String finalMarker = options.getMarker();
            StorageMetadata lastMarkerMetadata = find(contents, new Predicate<StorageMetadata>() {
               public boolean apply(StorageMetadata metadata) {
                  return metadata.getName().compareTo(finalMarker) > 0;
               }
            });
            contents = contents.tailSet(lastMarkerMetadata);
         }

         final String prefix = options.getDir();
         if (prefix != null) {
            contents = newTreeSet(filter(contents, new Predicate<StorageMetadata>() {
               public boolean apply(StorageMetadata o) {
                  return o != null && o.getName().startsWith(prefix) && !o.getName().equals(prefix);
               }
            }));
         }

         int maxResults = options.getMaxResults() != null ? options.getMaxResults() : 1000;
         if (!contents.isEmpty()) {
            StorageMetadata lastElement = contents.last();
            contents = newTreeSet(Iterables.limit(contents, maxResults));
            if (!contents.contains(lastElement)) {
               // Partial listing
               marker = contents.last().getName();
            }
View Full Code Here

    @Test
    public void testBucketsInEURegion() throws Exception {
        BlobStore store = awsClient.getBlobStoreContext().getBlobStore();
        LocationBuilder lb = new LocationBuilder();
        String bucketName = "euregiontest" + new Date().getTime();
        StorageMetadata bucket = null;

        try {
            lb.id(Region.EU_WEST_1)
              .scope(LocationScope.REGION)
              .description("Superfluous description to appease jclouds.");
View Full Code Here

    * http://code.google.com/p/jclouds/issues/detail?id=992
    */
   public void testUseBucketWithUpperCaseName() throws Exception {
      String bucketName = CONTAINER_PREFIX + "-TestBucket";
      String blobName = "TestBlob.txt";
      StorageMetadata container = null;
      BlobStore store = view.getBlobStore();

      // Create and use a valid bucket name with uppercase characters in the bucket name (US regions only)
      try {
         store.createContainerInLocation(null, bucketName);
View Full Code Here

   @Test
   public void testNoNameChange() {
      MutableBlobMetadata md = blobMetadataProvider.get();
      md.setName("dir");
      md.setId("dir");
      StorageMetadata rd = parser.apply(md);
      assertEquals(rd.getName(), "dir");
      assertEquals(rd.getProviderId(), "dir");
      assertEquals(rd.getType(), StorageType.RELATIVE_PATH);
   }
View Full Code Here

TOP

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

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.