public interface DataStoreFactorySpi extends DataAccessFactory
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" );
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:
The file should contain a single line which gives the full name of the implementing class.
The factories are never called directly by client code, instead the DataStoreFinder class is used.
|Modifier and Type||Method and Description|
Construct a live data source using the params specifed.
canProcess, getDescription, getDisplayName, getParametersInfo, isAvailable
DataStore createDataStore(Map<String,Serializable> params) throws IOException
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.
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
IOException- if there were any problems setting up (creating or connecting) the datasource.
Copyright © 1996–2019 Geotools. All rights reserved.