Examples of BlobStore


Examples of org.jclouds.blobstore.BlobStore

   @Argument(index = 0, name = "containerNames", description = "The name of the container", required = true, multiValued = true)
   List<String> containerNames = new LinkedList<String>();

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

      for (String container : containerNames) {
         blobStore.deleteContainer(container);
         cacheProvider.getProviderCacheForType("container").remove(blobStore.getContext().unwrap().getId(),
                  container);
      }
      return null;
   }
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore

    * @param provider
    * @param api
    * @return
    */
   public synchronized BlobStore waitForBlobStore(BundleContext bundleContext, String name, String provider, String api) {
      BlobStore blobStore = null;
      try {
         for (int r = 0; r < 6; r++) {
            ServiceReference[] references = null;
            if (name != null) {
              references = bundleContext.getAllServiceReferences(BlobStore.class.getName(), "("+Constants.NAME+"="
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore

   @Argument(index = 1, name = "blobNames", description = "The name of the blobs", required = true, multiValued = true)
   List<String> blobNames = Lists.newArrayList();

   @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();
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore

   @Argument(index = 0, name = "containerName", description = "The name of the container", required = true, multiValued = true)
   final Collection<String> containerNames = Lists.newArrayList();

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

      PageSet<? extends StorageMetadata> allContainerMetadata = blobStore.list();
      for (String containerName : containerNames) {
         boolean found = false;
         for (StorageMetadata containerMetadata : allContainerMetadata) {
            if (containerName.equals(containerMetadata.getName())) {
               printContainerMetadata(containerMetadata);
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore

@Command(scope = "jclouds", name = "blobstore-location-list", description = "List all location names")
public class LocationListCommand extends BlobStoreCommandWithOptions {

   @Override
   protected Object doExecute() throws Exception {
      BlobStore blobStore = getBlobStore();
      List<String> locationNames = Lists.newArrayList();

      for (Location loc : blobStore.listAssignableLocations()) {
          locationNames.add(loc.getId());
      }

      Collections.sort(locationNames);
      for (String locationName : locationNames) {
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore

@Command(scope = "jclouds", name = "blobstore-container-list", description = "Lists all container names")
public class ContainerListCommand extends BlobStoreCommandWithOptions {

   @Override
   protected Object doExecute() throws Exception {
      BlobStore blobStore = getBlobStore();
      List<String> containerNames = Lists.newArrayList();

      for (StorageMetadata containerMetadata : blobStore.list()) {
         containerNames.add(containerMetadata.getName());
      }

      Collections.sort(containerNames);
      for (String containerName : containerNames) {
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore

   @Argument(index = 1, name = "blobName", description = "The name of the blob", required = true, multiValued = false)
   String blobName;

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

      if (!blobStore.blobExists(containerName, blobName)) {
          throw new KeyNotFoundException(containerName, blobName, "while checking existence");
      }
      return null;
   }
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore

   @Argument(index = 1, name = "directoryPath", description = "List blobs only in this directory path", required = false)
   String directoryPath;

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

      ListContainerOptions options = ListContainerOptions.Builder.recursive();
      if (directoryPath != null) {
         options = options.inDirectory(directoryPath);
      }

      while (true) {
         PageSet<? extends StorageMetadata> blobStoreMetadatas = blobStore.list(containerName, options);
         List<String> blobNames = Lists.newArrayList();

         for (StorageMetadata blobMetadata : blobStoreMetadatas) {
            String blobName = blobMetadata.getName();
            // do not add to cacheProvider since long lists will cause OutOfMemoryError
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore

   @Option(name = "-S", aliases = "--signed-request", description = "Use a signed request", required = false, multiValued = false)
   boolean signedRequest;

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

      InputStream is = getBlobInputStream(blobStore, containerName, blobName, signedRequest);
      try {
         if (display) {
            CharStreams.copy(new InputStreamReader(is, Charsets.UTF_8), System.out);
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore

   @Option(name = "-S", aliases = "--signed-request", description = "Use a signed request", required = false, multiValued = false)
   boolean signedRequest;

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

      BlobBuilder builder = blobStore.blobBuilder(blobName);
      if (stringPayload) {
         builder = builder.payload(payload.getBytes())// use default Charset
      } else if (urlPayload) {
         InputStream input = new URL(payload).openStream();
         try {
            builder = builder.payload(ByteStreams.toByteArray(input));
         } finally {
            input.close();
         }
      } else {
         ByteSource byteSource = Files.asByteSource(new File(payload));
         BlobBuilder.PayloadBlobBuilder payloadBuilder = builder
               .payload(byteSource)
               .contentLength(byteSource.size());
         if (!multipartUpload) {
            payloadBuilder = payloadBuilder.contentMD5(byteSource.hash(Hashing.md5()).asBytes());
         }
         builder = payloadBuilder;
      }

      PutOptions options = multipartUpload ? new PutOptions().multipart(true) : PutOptions.NONE;

      write(blobStore, containerName, blobName, builder.build(), options, signedRequest);

      cacheProvider.getProviderCacheForType("container").put(blobStore.getContext().unwrap().getId(), containerName);
      cacheProvider.getProviderCacheForType("blob").put(blobStore.getContext().unwrap().getId(), blobName);

      return null;
   }
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.