Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Get PostGISServiceImpl

Hi to all,

I need PostGISServiceImpl to execute some query from my postgis db.

I tried this:

PostgisDataStore database;

java.util.Map<String, Serializable> params = new java.util.HashMap<String,
Serializable>();
params.put(PostgisDataStoreFactory.DBTYPE.key, "postgis");
params.put(PostgisDataStoreFactory.HOST.key, "localhost");
params.put(PostgisDataStoreFactory.PORT.key, 5432);
params.put(PostgisDataStoreFactory.SCHEMA.key, "public");
params.put(PostgisDataStoreFactory.DATABASE.key, "xxx");
params.put(PostgisDataStoreFactory.USER.key, "XXX");
params.put(PostgisDataStoreFactory.PASSWD.key, "XXX");

IServiceFactory factory = CatalogPlugin.getDefault().getServiceFactory();
for (IService service : factory.createService(params)) {
	if (service.canResolve(PostgisDataStore.class)) {
		try {
			database = service.resolve(PostgisDataStore.class, new
NullProgressMonitor());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

and this

PostgisDataStoreFactory dsf = new PostgisDataStoreFactory();
if (dsf.canProcess(params)) {
try {
        ds = (PostgisDataStore) dsf.createDataStore(params);
} catch (IOException e) {
      msg = e;
      throw e;
}

but that will create a new connection, while I would like to continue using
udig connection.

Thanks in advance for any replies.
-- 
View this message in context: http://www.nabble.com/Get-PostGISServiceImpl-tp22040381p22040381.html
Sent from the udig-devel mailing list archive at Nabble.com.



Back to the top