Class SampleDataAccessFactory

  • All Implemented Interfaces:
    DataAccessFactory, Factory

    public class SampleDataAccessFactory
    extends Object
    implements DataAccessFactory
    Sample implementation of a DataAccessFactory for testing.

    Enabled with a connection parameter "dbtype" of "sample-data-access".

    Since:
    2.6
    Author:
    Ben Caradoc-Davies (CSIRO Earth Science and Resource Engineering)
    • Field Detail

      • DBTYPE_STRING

        public static final String DBTYPE_STRING
        The "dbtype" connection string required to use this factory.
        See Also:
        Constant Field Values
      • PARAMS

        public static final Map<String,​Serializable> PARAMS
        The connection parameters required to use this factory.
    • Constructor Detail

      • SampleDataAccessFactory

        public SampleDataAccessFactory()
    • Method Detail

      • canProcess

        public boolean canProcess​(Map<String,​?> params)
        Are these parameters for us?
        Specified by:
        canProcess in interface DataAccessFactory
        Parameters:
        params - The full set of information needed to construct a live data source.
        Returns:
        booean true if and only if this factory can process the resource indicated by the param set and all the required params are pressent.
        See Also:
        DataAccessFactory.canProcess(java.util.Map)
      • createDataStore

        public DataAccess<? extends FeatureType,​? extends Feature> createDataStore​(Map<String,​?> params)
                                                                                  throws IOException
        Specified by:
        createDataStore in interface DataAccessFactory
        Parameters:
        params - The full set of information needed to construct a live data store. Typical key values for the map include: url - location of a resource, used by file reading datasources. dbtype - the type of the database to connect to, e.g. postgis, mysql
        Returns:
        The created DataStore, this may be null if the required resource was not found or if insufficent parameters were given. Note that canProcess() should have returned false if the problem is to do with insuficent parameters.
        Throws:
        IOException - if there were any problems setting up (creating or connecting) the datasource.
        See Also:
        DataAccessFactory.createDataStore(java.util.Map)
      • isAvailable

        public boolean isAvailable()
        Returns true, as this implementation is always available.
        Specified by:
        isAvailable in interface DataAccessFactory
        Returns:
        true if and only if this factory has all the appropriate jars on the classpath to create DataStores.
        See Also:
        DataAccessFactory.isAvailable()
      • getImplementationHints

        public Map<RenderingHints.Key,​?> getImplementationHints()
        Returns an empty list, containing no hints.
        Specified by:
        getImplementationHints in interface Factory
        Returns:
        The map of hints, or an {@linkplain java.util.Collections.emptyMap() empty map} if none.
        See Also:
        Factory.getImplementationHints()