Class DataStoreFactory

java.lang.Object
org.moeaframework.core.spi.AbstractFactory<DataStoreProvider>
org.moeaframework.analysis.store.DataStoreFactory
All Implemented Interfaces:
Iterable<DataStoreProvider>

public class DataStoreFactory extends AbstractFactory<DataStoreProvider>
Factory for creating data store instances. See DataStoreProvider for details on adding new providers.

This class is thread safe.

  • Constructor Details

    • DataStoreFactory

      public DataStoreFactory()
      Constructs a new data store factory.
  • Method Details

    • getInstance

      public static DataStoreFactory getInstance()
      Returns the default data store factory.
      Returns:
      the default data store factory
    • setInstance

      public static void setInstance(DataStoreFactory instance)
      Sets the default data store factory.
      Parameters:
      instance - the default data store factory
    • getDataStore

      public DataStore getDataStore(URI uri)
      Searches through all discovered DataStoreProvider instances, returning an instance of the provider with the configured URI. This method must throw an ProviderNotFoundException if 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

      public DataStore getDataStore(String str)
      Convenience method for calling getDataStore(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 URI
      ProviderNotFoundException - if no provider for the URI is available
    • resolveContainer

      public Container resolveContainer(URI uri)
      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

      public Container resolveContainer(String str)
      Convenience method for calling resolveContainer(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 URI
      ProviderNotFoundException - if no provider for the URI is available
    • resolveBlob

      public Blob resolveBlob(URI uri)
      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 blob
      ProviderNotFoundException - if no provider for the URI is available
    • resolveBlob

      public Blob resolveBlob(String str)
      Convenience method for calling resolveBlob(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 blob
      IllegalArgumentException - if the string is not a valid URI
      ProviderNotFoundException - if no provider for the URI is available