protected Object doExecute()

in commands/src/main/java/org/jclouds/karaf/commands/blobstore/ContainerCreateCommand.java [38:65]


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