Package org.jclouds.blobstore

Examples of org.jclouds.blobstore.BlobStore


   @Option(name = "-l", aliases = "--location", description = "Location to create container in", required = false, multiValued = false)
   String locationString = "";

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

      Location location = null;
      if (!locationString.isEmpty()) {
         for (Location loc : blobStore.listAssignableLocations()) {
            if (loc.getId().equalsIgnoreCase(locationString)) {
               location = loc;
               break;
            }
         }
         if (location == null) {
            throw new IllegalArgumentException("unknown location: " + locationString);
         }
      }

      for (String container : containerNames) {
         boolean created = blobStore.createContainerInLocation(location, container);
         if (!created) {
            if (blobStore.containerExists(container)) {
               throw new Exception("Container already exists: " + container);
            }

            throw new Exception("Could not create container: " + container);
         }
View Full Code Here


   @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

    * @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

   @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

   @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

@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

@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

   @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

   @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

   @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

TOP

Related Classes of org.jclouds.blobstore.BlobStore

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.