The following bug report:
- https://jira.codehaus.org/browse/GEOT-4306
And email discussion:
-
http://osgeo-org.1560.n6.nabble.com/SQL-2008R2-readers-iterators-being-left-open-td5012067.html
Made me sad, especially the stack trace:
WARNING: The unclosed reader originated on this stack trace
java.lang.Exception
at org.geotools.jdbc.JDBCFeatureReader.init(JDBCFeatureReader.java:169)
at
org.geotools.jdbc.JDBCFeatureReader.<init>(JDBCFeatureReader.java:132)
at
org.geotools.jdbc.JDBCFeatureSource.getReaderInternal(JDBCFeatureSource.java:580)
at
org.geotools.jdbc.JDBCFeatureStore.getReaderInternal(JDBCFeatureStore.java:225)
at
org.geotools.data.store.ContentFeatureSource.getReader(ContentFeatureSource.java:562)
at
org.geotools.data.store.ContentFeatureCollection.features(ContentFeatureCollection.java:238)
at
org.geotools.data.store.ContentFeatureCollection.features(ContentFeatureCollection.java:68)
at
org.geotools.data.collection.CollectionDataStore.getBoundsInternal(CollectionDataStore.java:152)
at
org.geotools.data.collection.CollectionDataStore.getBounds(CollectionDataStore.java:145)
at
org.geotools.data.AbstractFeatureSource.getBounds(AbstractFeatureSource.java:318)
at
org.geotools.data.AbstractFeatureSource.getBounds(AbstractFeatureSource.java:286)
at org.geotools.map.FeatureLayer.getBounds(FeatureLayer.java:195)
While I have fixed the bug with ContentFeatureCollection on the feature
collection clean up branch (and attached a patch) I am considering how else we
could make DataUtilities.source( SimpleFeatureCollection ) not suck.
Right now the implementation goes through several of the usual suspects
(ListFeatureCollection, SpatialIndexFeatureCollection,
TreeSetFeatureCollection) and special cases them.
Everything else is handled with:
CollectionDataStore store = new CollectionDataStore(collection);
String typeName = store.getTypeNames()[0];
try {
return store.getFeatureSource(typeName);
} catch (IOException e) {
throw new IllegalArgumentException("CollectionDataStore
inconsistent, "
+ " ensure type name "+typeName+" is the same for all
features", e);
}
What I would like is a way to crawl back up from a FeatureCollection to a
decent FeatureSource that can handle Query based access.
So far my best idea is:
1) Optional interface allowing a FeatureCollection to provide its FeatureSource
and Query
2) Rework DataUtilities.source( SimpleFeatureCollection ) to check for that
interface as follows:
if( collection instanceof QueryFeatureCollection){
QueryFeatureCollection collection2 = (QueryFeatureCollection) collection;
Query query = collection2.getQuery();
SimpleFeatureSource source = collection2.getFeatureSource();
if( query == Query.ALL ) return source;
return new DefaultView( source, query );
}
--
Jody Garnett
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel