2013-04-02 28 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)上有一個開始,但我們仍有一段路要走。 –