org.geotools.data
Class SampleDataAccessFactory

java.lang.Object
  extended by org.geotools.data.SampleDataAccessFactory
All Implemented Interfaces:
DataAccessFactory, Factory

public class SampleDataAccessFactory
extends java.lang.Object
implements DataAccessFactory

Sample implementation of a DataAccessFactory for testing.

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

Since:
2.6
Version:
$Id: SampleDataAccessFactory.java 32071 2008-12-24 03:03:33Z bencaradocdavies $
Author:
Ben Caradoc-Davies, CSIRO Exploration and Mining

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

Field Detail

DBTYPE_STRING

public static final java.lang.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 java.util.HashMap<java.lang.String,java.io.Serializable> PARAMS
The connection parameters required to use this factory.

Constructor Detail

SampleDataAccessFactory

public SampleDataAccessFactory()
Method Detail

canProcess

public boolean canProcess(java.util.Map<java.lang.String,java.io.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 org.opengis.feature.type.FeatureType,? extends org.opengis.feature.Feature> createDataStore(java.util.Map<java.lang.String,java.io.Serializable> params)
                                                                                                                 throws java.io.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:
java.io.IOException - if there were any problems setting up (creating or connecting) the datasource.
See Also:
DataAccessFactory.createDataStore(java.util.Map)

getDescription

public java.lang.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 java.lang.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 java.util.Map<java.awt.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-2010 Geotools. All Rights Reserved.