|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Constructs a live DataStore from a set of parameters.
An instance of this interface should exist for all data stores which want to take advantage of the dynamic plugin system. In addition to implementing this interface datastores 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 users, instead the DataStoreFinder class is used.The DataStoreFinder may implements the Catalog interface
The following example shows how a user might connect to a PostGIS database:
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");
DataStoreFinder catalog = DataStoreFinder();
catalog.addDataStore("leeds", params);
DataStore postgis = catalog.getDataStore( "leeds" );
FeatureSource = postgis.getFeatureSource( "table" );
Nested Class Summary | |
static class |
DataStoreFactorySpi.Param
Data class used to capture Parameter requirements. |
Method Summary | |
boolean |
canProcess(java.util.Map params)
Test to see if this factory is suitable for processing the data pointed to by the param tags. |
DataStore |
createDataStore(java.util.Map params)
Construct a live data source using the params specifed. |
DataStore |
createNewDataStore(java.util.Map params)
|
java.lang.String |
getDescription()
Describe the nature of the datasource constructed by this factory. |
DataStoreFactorySpi.Param[] |
getParametersInfo()
MetaData about the required Parameters. |
Method Detail |
public DataStore createDataStore(java.util.Map params) throws java.io.IOException
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
java.io.IOException
- if there were any problems creating or connecting
the datasource.public DataStore createNewDataStore(java.util.Map params) throws java.io.IOException
java.io.IOException
public java.lang.String getDescription()
public DataStoreFactorySpi.Param[] getParametersInfo()
Interpretation of FeatureDescriptor values:
This should be the same as:
Object params = factory.getParameters();
BeanInfo info = getBeanInfo( params );
return info.getPropertyDescriptors();
public boolean canProcess(java.util.Map params)
params
- The full set of information needed to construct a live
data source.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |