[Geoserver-devel] three errors from FeatureCollection no longer implementing java.util.Collection

There were three errors:
- Two cases where a list of features was being created; used DataUtilities.list( fc )
- FeatureWrapper; looks to be an adapater to something that expects an iterator; I was able to use the above DataUtilities.list( fc ) method - but this would of course load everything into memory; The javadocs indicate this this is specifically to allow for an object (ie the feature collection) to be used with the for/each loop - I would like to ask the author of this code what they are adapting to and if there is any way we can close the iterator that is created.

Right now the code compiles; FeatureWrapper is the only troubling spot; we can make a new FeatureWrapper that knows it is wrapping a FeatureCollection - but I am not sure if there is any kind of hooks for us to clean up after the wrapper.

Jody

Looks like the code has to do with adapting beans to some kind of model for the template system; options:
- I can make "features" available as an IteratorModel (and preserve the previous risk of leaking connections); or ...
- load the features into an array list and pass "features" in as a CollectionModel; or....
- I can also make my own CollectionModel implementation around FeatureCollection (also has the possibility of leaking connections)

I assume this template code is used when making placemarks?
Jody

Jody Garnett ha scritto:

There were three errors:
- Two cases where a list of features was being created; used DataUtilities.list( fc )
- FeatureWrapper; looks to be an adapater to something that expects an iterator; I was able to use the above DataUtilities.list( fc ) method - but this would of course load everything into memory; The javadocs indicate this this is specifically to allow for an object (ie the feature collection) to be used with the for/each loop - I would like to ask the author of this code what they are adapting to and if there is any way we can close the iterator that is created.

I see that in the meantime your created a custom wrapper, good,
you got me worried with this one.
Just to double check, does the iterator returned by the feature collection close itself properly in case of exception and when it reaches the end of the iterator, or should we add those checks
to the wrapper?

Cheers
Andrea