org.geotools.data
Class SampleDataAccessFactory

Object
  extended by 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)

Nested Class Summary
 
Nested classes/interfaces inherited from interface DataAccessFactory
DataAccessFactory.Param
 
Field Summary
static DataAccessFactory.Param DBTYPE
           
static String DBTYPE_STRING
          The "dbtype" connection string required to use this factory.
static HashMap<String,Serializable> PARAMS
          The connection parameters required to use this factory.
 
Constructor Summary
SampleDataAccessFactory()
           
 
Method Summary
 boolean canProcess(Map<String,Serializable> params)
          Are these parameters for us?
 DataAccess<? extends FeatureType,? extends Feature> createDataStore(Map<String,Serializable> params)
          Create a SampleDataAccess.
 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.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 HashMap<String,Serializable> PARAMS
The connection parameters required to use this factory.

Constructor Detail

SampleDataAccessFactory

public SampleDataAccessFactory()
Method Detail

canProcess

public boolean canProcess(Map<String,Serializable> 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,Serializable> params)
                                                                    throws IOException
Create a SampleDataAccess.

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)

getDescription

public String getDescription()
Need to implement this.

Specified by:
getDescription in interface DataAccessFactory
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 interface DataAccessFactory
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 interface DataAccessFactory
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 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 empty map if none.
See Also:
Factory.getImplementationHints()


Copyright © 1996-2014 Geotools. All Rights Reserved.