|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DataStoreFactorySpi
Factory used to construct a DataStore from a set of parameters.
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" );
FeatureSource = 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:
META-INF/services/org.geotools.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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface DataAccessFactory |
---|
DataAccessFactory.Param |
Method Summary | |
---|---|
DataStore |
createDataStore(Map<String,Serializable> params)
Construct a live data source using the params specifed. |
DataStore |
createNewDataStore(Map<String,Serializable> params)
|
Methods inherited from interface DataAccessFactory |
---|
canProcess, getDescription, getDisplayName, getParametersInfo, isAvailable |
Methods inherited from interface Factory |
---|
getImplementationHints |
Method Detail |
---|
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.
createDataStore
in interface DataAccessFactory
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.DataStore createNewDataStore(Map<String,Serializable> params) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |