Package org.jclouds.blobstore.domain

Examples of org.jclouds.blobstore.domain.MutableStorageMetadata


public class PrefixToResourceMetadataTest {
   PrefixToResourceMetadata fn = new PrefixToResourceMetadata();

   @Test
   public void testCorrect() throws SecurityException, NoSuchMethodException {
      MutableStorageMetadata expected = new MutableStorageMetadataImpl();
      expected.setType(StorageType.RELATIVE_PATH);
      expected.setName("foo");
      assertEquals(fn.apply("foo"), expected);
   }
View Full Code Here


   ContainerToResourceMetadata(Supplier<Location> defaultLocation) {
      this.defaultLocation = defaultLocation;
   }

   public StorageMetadata apply(ContainerProperties from) {
      MutableStorageMetadata to = new MutableStorageMetadataImpl();
      to.setName(from.getName());
      to.setLocation(defaultLocation.get());
      to.setETag(from.getETag());
      to.setLastModified(from.getLastModified());
      to.setUri(from.getUrl());
      to.setType(StorageType.CONTAINER);
      to.setUserMetadata(from.getMetadata());
      return to;
   }
View Full Code Here

            commonPrefixes.remove(CommonPrefixes.NO_PREFIX);

            contents = newTreeSet(filter(contents, new DelimiterFilter(prefix, delimiter)));

            for (String o : commonPrefixes) {
               MutableStorageMetadata md = new MutableStorageMetadataImpl();
               md.setType(StorageType.RELATIVE_PATH);
               md.setName(o);
               contents.add(md);
            }
         }

         // trim metadata, if the response isn't supposed to be detailed.
         if (!options.isDetailed()) {
            for (StorageMetadata md : contents) {
               md.getUserMetadata().clear();
            }
         }
      }

      return Futures.<PageSet<? extends StorageMetadata>> immediateFuture(new PageSetImpl<StorageMetadata>(contents,
View Full Code Here

      Iterable<String> containers = storageStrategy.getAllContainerNames();

      return Futures.<PageSet<? extends StorageMetadata>> immediateFuture(new PageSetImpl<StorageMetadata>(transform(
            containers, new Function<String, StorageMetadata>() {
               public StorageMetadata apply(String name) {
                  MutableStorageMetadata cmd = create();
                  cmd.setName(name);
                  cmd.setType(StorageType.CONTAINER);
                  cmd.setLocation(storageStrategy.getLocation(name));
                  return cmd;
               }
            }), null));
   }
View Full Code Here

   BucketToResourceMetadata(Function<String, Location> locationOfBucket) {
      this.locationOfBucket = locationOfBucket;
   }

   public StorageMetadata apply(BucketMetadata from) {
      MutableStorageMetadata to = new MutableStorageMetadataImpl();
      to.setName(from.getName());
      to.setType(StorageType.CONTAINER);
      to.setLocation(locationOfBucket.apply(from.getName()));
      to.setCreationDate(from.getCreationDate());
      return to;
   }
View Full Code Here

   public void test() {
      BucketsToStorageMetadata fn = new BucketsToStorageMetadata(
               sameThreadExecutor(),
               new BucketToResourceMetadata(Functions.forMap(ImmutableMap.<String, Location> of("mycontainer", region))));

      MutableStorageMetadata expected = new MutableStorageMetadataImpl();
      expected.setName("mycontainer");
      expected.setType(StorageType.CONTAINER);
      expected.setLocation(region);
     
      assertEquals(
               fn.apply(ImmutableSet.of(new BucketMetadata("mycontainer", null, null))).toString(),
               new PageSetImpl<StorageMetadata>(ImmutableSet.<StorageMetadata> of(expected), null).toString());
View Full Code Here

*/
@Singleton
public class CommonPrefixesToResourceMetadata implements Function<String, StorageMetadata> {

   public StorageMetadata apply(String from) {
      MutableStorageMetadata returnVal = new MutableStorageMetadataImpl();
      returnVal.setType(StorageType.RELATIVE_PATH);
      returnVal.setName(from);
      return returnVal;
   }
View Full Code Here

   ContainerToResourceMetadata(Supplier<Location> defaultLocation) {
      this.defaultLocation = defaultLocation;
   }

   public StorageMetadata apply(ContainerMetadata from) {
      MutableStorageMetadata to = new MutableStorageMetadataImpl();
      to.setName(from.getName());
      to.setLocation(defaultLocation.get());
      to.setType(StorageType.CONTAINER);
      return to;
   }
View Full Code Here

      this.region = region;
   }

   @Override
   public StorageMetadata apply(Container from) {
      MutableStorageMetadata to = new MutableStorageMetadataImpl();
      to.setName(from.getName());
      to.setLocation(region);
      to.setType(StorageType.CONTAINER);
      to.setUserMetadata(from.getMetadata());
      return to;
   }
View Full Code Here

   ContainerToResourceMetadata(Supplier<Location> defaultLocation) {
      this.defaultLocation = defaultLocation;
   }

   public StorageMetadata apply(ContainerProperties from) {
      MutableStorageMetadata to = new MutableStorageMetadataImpl();
      to.setName(from.getName());
      to.setLocation(defaultLocation.get());
      to.setETag(from.getETag());
      to.setLastModified(from.getLastModified());
      to.setUri(from.getUrl());
      to.setType(StorageType.CONTAINER);
      to.setUserMetadata(from.getMetadata());
      return to;
   }
View Full Code Here

TOP

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

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.