[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[udig-devel] [jira] Created: (UDIG-1633) Cannot resolve PostGIS layer to JDBCDataStore
|
Cannot resolve PostGIS layer to JDBCDataStore
---------------------------------------------
Key: UDIG-1633
URL: http://jira.codehaus.org/browse/UDIG-1633
Project: uDIG
Issue Type: Bug
Components: database
Affects Versions: UDIG 1.2.RC1
Environment: JDK 1.6.0_18, gtk.linux.x86_64
Reporter: Harald Wellmann
I'm implementing a custom ActionTool working on a PostGIS layer, and I need to access the underlying DataSource from the tool implementation. I'm not sure if the following code is the best way of doing so, but with this approach, I hit a bug in PostgisSchemaFolder
ILayer layer = getContext().getSelectedLayer();
try
{
IService service = layer.getGeoResource().resolve(IService.class, null);
IResolve member = service.members(null).get(0);
boolean canResolve = member.canResolve(JDBCDataStore.class);
if (canResolve)
{
JDBCDataStore store = member.resolve(JDBCDataStore.class, null);
// FIXME: store is null!
DataSource dataSource = store.getDataSource();
log.info(dataSource.toString());
}
}
catch (IOException exc)
{
exc.printStackTrace();
}
member is of class PostgisSchemaFolder. canResolve() returns true for JDBCDataStore, but resolve() only works for DataStore, not for JDBCDataStore. I locally patched the resolve() method, replacing DataStore by JDBCDataStore to make things work.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira