Interface DataStoreFactorySpi
- All Superinterfaces:
DataAccessFactory
,Factory
- All Known Subinterfaces:
FileDataStoreFactorySpi
- All Known Implementing Classes:
AbstractDuckDBDataStoreFactory
,CSVDataStoreFactory
,DB2NGDataStoreFactory
,DB2NGJNDIDataStoreFactory
,DuckDBDataStoreFactory
,ForwardingDataStoreFactory
,GeoJSONDataStoreFactory
,GeoParquetDataStoreFactory
,GeoPkgDataStoreFactory
,GraticuleDataStoreFactory
,H2DataStoreFactory
,H2GISDataStoreFactory
,H2GISJNDIDataStoreFactory
,H2JNDIDataStoreFactory
,HanaDataStoreFactory
,HanaJNDIDataStoreFactory
,InformixDataStoreFactory
,InformixJNDIDataStoreFactory
,JDBCDataStoreFactory
,JDBCJNDIDataStoreFactory
,JDTSSQLServerJNDIDataStoreFactory
,JniOGRDataStoreFactory
,JTDSSqlServerDataStoreFactory
,MBTilesDataStoreFactory
,MongoDataStoreFactory
,MySQLDataStoreFactory
,MySQLJNDIDataStoreFactory
,NetCDFAuxiliaryStoreFactory
,OGRDataStoreFactory
,OracleNGDataStoreFactory
,OracleNGJNDIDataStoreFactory
,OracleNGOCIDataStoreFactory
,PostgisNGDataStoreFactory
,PostgisNGJNDIDataStoreFactory
,PreGeneralizedDataStoreFactory
,PropertyDataStoreFactory
,ShapefileDataStoreFactory
,ShapefileDirectoryFactory
,SingleStoreDataStoreFactory
,SingleStoreJNDIDataStoreFactory
,SQLServerDataStoreFactory
,SQLServerJNDIDataStoreFactory
,STACDataStoreFactory
,TeradataDataStoreFactory
,TeradataJNDIDataStoreFactory
,VectorMosaicStoreFactory
,VPFDataStoreFactory
,VPFFileFactory
,WFSDataStoreFactory
The following example shows how a user might connect to a PostGIS database, and maintain the resulting DataStore in a Registry:
HashMap params = new HashMap();
params.put("namespace", "leeds");
params.put("dbtype", "postgis");
params.put("host","feathers.leeds.ac.uk");
params.put("port", "5432");
params.put("database","postgis_test");
params.put("user","postgis_ro");
params.put("passwd","postgis_ro");
DefaultRegistry registry = new DefaultRegistry();
registry.addDataStore("leeds", params);
DataStore postgis = registry.getDataStore( "leeds" );
SimpleFeatureSource = postgis.getFeatureSource( "table" );
Implementation Notes
An instance of this interface should exist for all data stores which want to take advantage of the dynamic plug-in system. In addition to implementing this factory interface each DataStore implementation should have a services file:
META-INF/services/org.geotools.api.data.DataStoreFactorySpi
The file should contain a single line which gives the full name of the implementing class.
example:
e.g.
org.geotools.data.mytype.MyTypeDataSourceFacotry
The factories are never called directly by client code, instead the DataStoreFinder class is used.
- Author:
- Jody Garnett, Refractions Research
-
Nested Class Summary
Nested classes/interfaces inherited from interface DataAccessFactory
DataAccessFactory.Param
-
Method Summary
Modifier and TypeMethodDescriptioncreateDataStore
(Map<String, ?> params) Construct a live data source using the params specifed.createNewDataStore
(Map<String, ?> params) Methods inherited from interface DataAccessFactory
canProcess, getDescription, getDisplayName, getParametersInfo, isAvailable
Methods inherited from interface Factory
getImplementationHints
-
Method Details
-
createDataStore
Construct a live data source using the params specifed.You can think of this as setting up a connection to the back end data source.
Magic Params: the following params are magic and are honoured by convention by the GeoServer and uDig application.
- "user": is taken to be the user name
- "passwd": is taken to be the password
- "namespace": is taken to be the namespace prefix (and will be kept in sync with GeoServer namespace management.
- 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.
-
createNewDataStore
- Throws:
IOException
-