org.deegree.feature.persistence.query
Interface FeatureResultSet

All Superinterfaces:
java.lang.Iterable<Feature>
All Known Implementing Classes:
CombinedResultSet, FilteredFeatureResultSet, IteratorResultSet, MemoryFeatureResultSet, ThreadedResultSet

public interface FeatureResultSet
extends java.lang.Iterable<Feature>

Provides access to the results of a Query operation.

The primary means of accessing the individual result features is to use the Iterable.iterator() method and subsequently call it's Iterator.next() methods. Depending on the implementation (e.g. when backed by an SQL result set), this enables the processing of arbitrary large numbers of results without causing memory issues. Also, it's essential to ensure that the close() method is called afterwards, or resource leaks may occur (e.g. open SQL result sets).

A typical use of a FeatureResultSet looks like this:

   ...
   FeatureResultSet rs = null;
    try {
        // retrieve the FeatureResultSet
        rs = ...
        for ( Feature f : rs ) {
            // do something with the feature
            // ...
        }
    } finally {
        // make sure that the FeatureResultSet always gets closed
        if ( rs != null ) {
            rs.close();
        }
    }
    ...
 

Version:
$Revision: 24847 $, $Date: 2010-06-11 23:00:44 +0200 (Fr, 11. Jun 2010) $
Author:
Markus Schneider, last edited by: $Author: mschneider $

Method Summary
 void close()
          Must be invoked after using to close underlying resources, e.g.
 FeatureCollection toCollection()
          Returns all members of the FeatureResultSet as a FeatureCollection.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

close

void close()
Must be invoked after using to close underlying resources, e.g. SQL ResultSets.


toCollection

FeatureCollection toCollection()
Returns all members of the FeatureResultSet as a FeatureCollection.

NOTE: This method should not be called for very large result sets, as it introduces the overhead of keeping all created feature instances in memory. The returned collection will contain all Features instances from the current position in the iteration sequence.

Returns:
members as feature collection, never null


Copyright © 2011. All Rights Reserved.