Package org.duracloud.client
Class ContentStoreManagerImpl
- java.lang.Object
-
- org.duracloud.client.ContentStoreManagerImpl
-
- All Implemented Interfaces:
ContentStoreManager,Securable
- Direct Known Subclasses:
CachingContentStoreManagerImpl
public class ContentStoreManagerImpl extends Object implements ContentStoreManager, Securable
Provides facilities for connecting to a set of content stores- Author:
- Bill Branan
-
-
Constructor Summary
Constructors Constructor Description ContentStoreManagerImpl(String host, String port)Constructor for ContentStoreManagerImpl.ContentStoreManagerImpl(String host, String port, String context)ContentStoreManagerImpl(String host, String port, String context, int socketTimeoutMs)Constructor for ContentStoreManagerImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetBaseURL()ContentStoregetContentStore(String storeID)Gets a specific content store based on ID.ContentStoregetContentStore(String storeID, int maxRetries)Gets a specific content store based on ID.Map<String,ContentStore>getContentStores()Gets all available content stores.Map<String,ContentStore>getContentStores(int maxRetries)Gets all available content stores.ContentStoregetPrimaryContentStore()Gets the primary content store.ContentStoregetPrimaryContentStore(int maxRetries)Gets the primary content store.ContentStoregetPrimaryContentStoreAsAnonymous()Provides access to the primary content store without requiring login().ContentStoregetPrimaryContentStoreAsAnonymous(int maxRetries)Provides access to the primary content store without requiring login().protected RestHttpHelpergetRestHelper()protected booleanisWritable(StorageAccount acct)voidlogin(Credential appCred)voidlogout()protected ContentStorenewContentStoreImpl(StorageAccount acct)protected ContentStorenewContentStoreImpl(StorageAccount acct, int maxRetries)voidreinitialize(String host, String port, String context)reconfigureprotected voidsetRestHelper(RestHttpHelper restHelper)
-
-
-
Constructor Detail
-
ContentStoreManagerImpl
public ContentStoreManagerImpl(String host, String port)
Constructor for ContentStoreManagerImpl.
-
ContentStoreManagerImpl
public ContentStoreManagerImpl(String host, String port, String context, int socketTimeoutMs)
Constructor for ContentStoreManagerImpl.
- Parameters:
host- the host name on which DuraStore can be accessedport- the port on which DuraStore can be accessedcontext- the application context by which DuraStore can be accessedsocketTimeoutMs- The socket timeout in milliseconds. A value less than zero indicates no timeout.
-
-
Method Detail
-
reinitialize
public void reinitialize(String host, String port, String context) throws ContentStoreException
Description copied from interface:ContentStoreManagerreconfigure
- Specified by:
reinitializein interfaceContentStoreManager- Parameters:
host- of durastoreport- of durastorecontext- of durastore- Throws:
ContentStoreException
-
getContentStores
public Map<String,ContentStore> getContentStores() throws ContentStoreException
Gets all available content stores. Each content store uses the default number of retries (3) on call failure.- Specified by:
getContentStoresin interfaceContentStoreManager- Returns:
- a map of content stores to content store IDs
- Throws:
ContentStoreException- if the content store list cannot be retrieved
-
getContentStores
public Map<String,ContentStore> getContentStores(int maxRetries) throws ContentStoreException
Gets all available content stores.- Specified by:
getContentStoresin interfaceContentStoreManager- Parameters:
maxRetries- number of retries to perform if a content store call fails- Returns:
- a map of content stores to content store IDs
- Throws:
ContentStoreException- if the content store list cannot be retrieved
-
getContentStore
public ContentStore getContentStore(String storeID) throws ContentStoreException
Gets a specific content store based on ID. Content store uses the default number of retries (3) on call failure.- Specified by:
getContentStorein interfaceContentStoreManager- Parameters:
storeID- the ID of a particular content store- Returns:
- the ContentStore mapped to storeID
- Throws:
ContentStoreException- if the content store cannot be retrieved
-
getContentStore
public ContentStore getContentStore(String storeID, int maxRetries) throws ContentStoreException
Gets a specific content store based on ID.- Specified by:
getContentStorein interfaceContentStoreManager- Parameters:
storeID- the ID of a particular content storemaxRetries- number of retries to perform if a content store call fails- Returns:
- the ContentStore mapped to storeID
- Throws:
ContentStoreException- if the content store cannot be retrieved
-
getPrimaryContentStore
public ContentStore getPrimaryContentStore() throws ContentStoreException
Gets the primary content store. Content store uses the default number of retries (3) on call failure.- Specified by:
getPrimaryContentStorein interfaceContentStoreManager- Returns:
- the primary ContentStore
- Throws:
ContentStoreException
-
getPrimaryContentStore
public ContentStore getPrimaryContentStore(int maxRetries) throws ContentStoreException
Gets the primary content store.- Specified by:
getPrimaryContentStorein interfaceContentStoreManager- Parameters:
maxRetries- number of retries to perform if a content store call fails- Returns:
- the primary ContentStore
- Throws:
ContentStoreException
-
getPrimaryContentStoreAsAnonymous
public ContentStore getPrimaryContentStoreAsAnonymous() throws ContentStoreException
Provides access to the primary content store without requiring login(). Only certain ContentStore activities are permitted to anonymous users, primarily getting content from open spaces. Content store uses the default number of retries (3) on call failure.- Specified by:
getPrimaryContentStoreAsAnonymousin interfaceContentStoreManager- Returns:
- the primary ContentStore
- Throws:
ContentStoreException
-
getPrimaryContentStoreAsAnonymous
public ContentStore getPrimaryContentStoreAsAnonymous(int maxRetries) throws ContentStoreException
Provides access to the primary content store without requiring login(). Only certain ContentStore activities are permitted to anonymous users, primarily getting content from open spaces.- Specified by:
getPrimaryContentStoreAsAnonymousin interfaceContentStoreManager- Parameters:
maxRetries- number of retries to perform if a content store call fails- Returns:
- the primary ContentStore
- Throws:
ContentStoreException
-
login
public void login(Credential appCred)
-
newContentStoreImpl
protected ContentStore newContentStoreImpl(StorageAccount acct)
-
isWritable
protected boolean isWritable(StorageAccount acct)
-
newContentStoreImpl
protected ContentStore newContentStoreImpl(StorageAccount acct, int maxRetries)
-
getBaseURL
protected String getBaseURL()
-
getRestHelper
protected RestHttpHelper getRestHelper()
-
setRestHelper
protected void setRestHelper(RestHttpHelper restHelper)
-
-