1

I can't find an example on how to create a new container/bucket with specific Location (Singapore) using JClouds. All the examples that I found on google are using null as default location.

azureBlobStore.createContainerInLocation(null, containerName);

Could any of you, JClouds veterans, help me out here?

David Makogon
  • 69,407
  • 21
  • 141
  • 189
carbotex
  • 569
  • 1
  • 6
  • 16

2 Answers2

1

I haven't used JClouds, but just went and looked at the docs for Azure storage. First thing they show is creation of a blob context:

BlobStoreContext context = new BlobStoreContextFactory().createContext("azureblob", accesskeyid, secretkey);

According to the Javadocs, the params are provider, identity, and credential. That being the case, you probably need to pass the storage account and key from the Windows Azure portal into the 2nd and 3rd parameters. Once you do this, your location is set for you, to the data center where you set up the storage account (In Windows Azure, a storage account is associated with a specific data center upon creation - all containers and objects are then created in that data center as well). I don't think the Location parameter is meaningful when setting up your Azure blob container. That Location parameter is nullable, since it only applies to a subset of cloud providers based on that provider's API (see Javadocs for more details).

David Makogon
  • 69,407
  • 21
  • 141
  • 189
0

I was looking for the same answer the other day and just wanted to echo what David said. Here is the code for AzureBlobStore.java in jclouds 1.5

   @Override
   public boolean createContainerInLocation(Location location, String container) {
      return sync.createContainer(container);
   }

As you can see, the location is ignored because your Azure account is already tied to a specific location.

Niraj Tolia
  • 541
  • 5
  • 5