Class SampleDataAccessFactory
- Object
-
- SampleDataAccessFactory
-
- All Implemented Interfaces:
DataAccessFactory
,Factory
public class SampleDataAccessFactory extends Object implements DataAccessFactory
Sample implementation of aDataAccessFactory
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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface DataAccessFactory
DataAccessFactory.Param
-
-
Field Summary
Fields Modifier and Type Field Description static DataAccessFactory.Param
DBTYPE
static String
DBTYPE_STRING
The "dbtype" connection string required to use this factory.static Map<String,Serializable>
PARAMS
The connection parameters required to use this factory.
-
Constructor Summary
Constructors Constructor Description SampleDataAccessFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canProcess(Map<String,?> params)
Are these parameters for us?DataAccess<? extends FeatureType,? extends Feature>
createDataStore(Map<String,?> params)
Create aSampleDataAccess
.String
getDescription()
Need to implement this.String
getDisplayName()
Need to implement this.Map<RenderingHints.Key,?>
getImplementationHints()
Returns an empty list, containing no hints.DataAccessFactory.Param[]
getParametersInfo()
Need to implement this.boolean
isAvailable()
Returns true, as this implementation is always available.
-
-
-
Field Detail
-
DBTYPE_STRING
public static final String DBTYPE_STRING
The "dbtype" connection string required to use this factory.- See Also:
- Constant Field Values
-
DBTYPE
public static final DataAccessFactory.Param DBTYPE
-
PARAMS
public static final Map<String,Serializable> PARAMS
The connection parameters required to use this factory.
-
-
Method Detail
-
canProcess
public boolean canProcess(Map<String,?> params)
Are these parameters for us?- Specified by:
canProcess
in interfaceDataAccessFactory
- 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
Create aSampleDataAccess
.- Specified by:
createDataStore
in interfaceDataAccessFactory
- 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)
-
getDescription
public String getDescription()
Need to implement this.- Specified by:
getDescription
in interfaceDataAccessFactory
- Returns:
- A human readable description that is suitable for inclusion in a list of available datasources.
- See Also:
DataAccessFactory.getDescription()
-
getDisplayName
public String getDisplayName()
Need to implement this.- Specified by:
getDisplayName
in interfaceDataAccessFactory
- Returns:
- A short name suitable for display in a user interface.
- See Also:
DataAccessFactory.getDisplayName()
-
getParametersInfo
public DataAccessFactory.Param[] getParametersInfo()
Need to implement this.- Specified by:
getParametersInfo
in interfaceDataAccessFactory
- Returns:
- Param array describing the Map for createDataStore
- See Also:
DataAccessFactory.getParametersInfo()
-
isAvailable
public boolean isAvailable()
Returns true, as this implementation is always available.- Specified by:
isAvailable
in interfaceDataAccessFactory
- 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 interfaceFactory
- Returns:
- The map of hints, or an {@linkplain java.util.Collections.emptyMap() empty map} if none.
- See Also:
Factory.getImplementationHints()
-
-