Question

I am using JClouds to abstract over various cloud providers, including Rackspace.

I am using the BlobStore from JClouds to store files, their API suggests that I can create a container in a specific (provider dependent) Location using:

context.getBlobStore().createContainerInLocation(location, "containerName");

However, how am I supposed to get the location variable (of interface type Location)?

For example, RackSpace supports Dallas or Chicago as the Location of a container. So I would like to do something like this:

 Location dallas = ....; // Get location that points to "US-IL"
 context.getBlobStore().createContainerInLocation(dallas, "container");

The 'magic' string US-IL was taken from the source.

I tried using this:

 context.getBlobStore().listAssignableLocations();  // Only contains a single default location
 context.getBlobStore().listAssignableLocations()[0].getParent(); // Not sure what this refers to, scoped at PROVIDER level

Anyone that can shed some light on how I should be using this?

Related question: JClouds for Azure Blob (not applicable, because the answer is Azure specific. Which did not require the location...)

Était-ce utile?

La solution

This is now possible in jclouds 1.8.0 and above.

RegionScopedBlobStoreContext blobStoreContext = ContextBuilder.newBuilder(PROVIDER)
        .credentials(username, apiKey)
        .buildView(RegionScopedBlobStoreContext.class);
BlobStore blobStore = blobStoreContext.getBlobStore(REGION);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top