2013-04-02 27 views
2

我正在使用JClouds来抽象各种云提供商,包括Rackspace。使用JClouds设置容器位置位置API

我使用BLOBSTORE从JClouds来存储文件,其API建议我可以在一个特定的(供应商依赖的)位置使用创建容器:

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

但是,我怎么得到位置变量(接口类型位置)?

例如,RackSpace支持Dallas或Chicago作为容器的位置。因此,我愿做这样的事情:

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

的“魔力”的字符串US-IL从the source拍摄。

我尝试使用这样的:

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

任何人都可以阐明我应如何使用这一些轻?

相关问题:JClouds for Azure Blob(不适用,因为答案是Azure的具体并不要求位置...。)

回答

2

这是现在在jclouds 1.8.0及以上的可能。

RegionScopedBlobStoreContext blobStoreContext = ContextBuilder.newBuilder(PROVIDER) 
     .credentials(username, apiKey) 
     .buildView(RegionScopedBlobStoreContext.class); 
BlobStore blobStore = blobStoreContext.getBlobStore(REGION); 
+0

是的,我发现尽可能多的源代码。我也检查了Atmos(Ninefold),但是位置也不支持那里。它看起来像输入位置API没有为BlobStore实现。 – jvandertil

+0

@EverettToews对此有何更新? –

+0

我们在[openstack-swift](https://github.com/jclouds/jclouds-labs-openstack/tree/master/openstack-swift)上有一个开始,但我们仍有一段路要走。 –