Package org.moeaframework.analysis.store
Class DataStoreFactory
java.lang.Object
org.moeaframework.core.spi.AbstractFactory<DataStoreProvider>
org.moeaframework.analysis.store.DataStoreFactory
- All Implemented Interfaces:
Iterable<DataStoreProvider>
Factory for creating data store instances. See
DataStoreProvider for details on adding new providers.
This class is thread safe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDataStore(String str) Convenience method for callinggetDataStore(URI)with a string representation of the URI.getDataStore(URI uri) Searches through all discoveredDataStoreProviderinstances, returning an instance of the provider with the configured URI.static DataStoreFactoryReturns the default data store factory.resolveBlob(String str) Convenience method for callingresolveBlob(URI)with a string representation of the URI.resolveBlob(URI uri) Resolves a URI to a blob.resolveContainer(String str) Convenience method for callingresolveContainer(URI)with a string representation of the URI.resolveContainer(URI uri) Resolves a URI to a container.static voidsetInstance(DataStoreFactory instance) Sets the default data store factory.Methods inherited from class org.moeaframework.core.spi.AbstractFactory
addProvider, hasProvider, iteratorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DataStoreFactory
public DataStoreFactory()Constructs a new data store factory.
-
-
Method Details
-
getInstance
Returns the default data store factory.- Returns:
- the default data store factory
-
setInstance
Sets the default data store factory.- Parameters:
instance- the default data store factory
-
getDataStore
Searches through all discoveredDataStoreProviderinstances, returning an instance of the provider with the configured URI. This method must throw anProviderNotFoundExceptionif no matching provider is found.- Parameters:
uri- the URI defining the data store configuration- Returns:
- an instance of the data store with the registered name
- Throws:
ProviderNotFoundException- if no provider for the URI is available
-
getDataStore
Convenience method for callinggetDataStore(URI)with a string representation of the URI.- Parameters:
str- the string representation of the URI- Returns:
- an instance of the data store with the registered name
- Throws:
IllegalArgumentException- if the string is not a valid URIProviderNotFoundException- if no provider for the URI is available
-
resolveContainer
Resolves a URI to a container.- Parameters:
uri- the URI referencing a container- Returns:
- the container
- Throws:
ProviderNotFoundException- if no provider for the URI is available
-
resolveContainer
Convenience method for callingresolveContainer(URI)with a string representation of the URI.- Parameters:
str- the string representation of the URI- Returns:
- the container
- Throws:
IllegalArgumentException- if the string is not a valid URIProviderNotFoundException- if no provider for the URI is available
-
resolveBlob
Resolves a URI to a blob.- Parameters:
uri- the URI referencing a blob- Returns:
- the blob
- Throws:
DataStoreException- if the URI is not a valid reference to a blobProviderNotFoundException- if no provider for the URI is available
-
resolveBlob
Convenience method for callingresolveBlob(URI)with a string representation of the URI.- Parameters:
str- the string representation of the URI- Returns:
- the blob
- Throws:
DataStoreException- if the URI is not a valid reference to a blobIllegalArgumentException- if the string is not a valid URIProviderNotFoundException- if no provider for the URI is available
-