Constructs a live DataSource from a set of parameters.
An instance of this interface should exist for all DataSource providers, common examples being JNDI, DBCP, C3P0. In addition to implementing
this interface data source providers should have a services file:
META-INF/services/org.geotools.data.DataSourceFactorySpi
The file should contain a single line which gives the full name of the
implementing class.
example:
e.g.
org.geotools.data.dbpc.DBCPDataSourceFactory
The factories are never called directly by client code, instead the
DataSourceFinder class is used.
The following example shows how a user might setup a DBCP connection pool::
HashMap params = new HashMap();
params.put("url","jdbc:postgresql://localhost/dbname");
params.put("driverClassName","org.postgresql.Driver");
params.put("username", "5432");
params.put("password","postgis_test");
params.put("maxActive", "10");
DataSource ds = DataSourceFinder.getDataSource(params);
author: Andrea Aime - TOPP |