Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Contact:

Jody Garnett

Tracker:

https://jira.codehaus.org/browse/GEOT-4191

Tagline:

Excerpt

try-with-resource

Section
Column
width70%
Table of Contents
Column

Children:

Children Display

Description

Reading the Java 7 planned try-with-resource syntax I am convinced that supporting the Closable interface is necessary change for GeoTools 9.x.

Reading: 

Status

This proposal is shaping up, ask question on the email list or vote below:

Tasks

 

no progress

(tick)

done

(error)

impeded

(warning)

lack mandate/funds/time

(question)

volunteer needed

  1. (tick) Coordinate API Change (above patches should be tested / applied together)
  2. Implement Closable
    • (tick) FeatureIterator
    • (tick) FeatureReader
    • (tick) FeatureWriter
  3. (tick) A lot of this work got rolled into the FeatureCollection clean up
  4. Warn / Patch downstream applications (Combined with FeatureCollection cleanup)
    1. (tick) Patch for GeoServer
    2. (warning) Patch for uDig (patch ready held up waiting for 1.3.3 release)
  5. Check the code examples in user guide

API Changes

FeatureIterator

BEFORE:

Code Block
languagejava
public interface FeatureIterator<F extends Feature> {
    public boolean hasNext();
    public F next() throws java.util.NoSuchElementException;
    public void close();
}

AFTER:

Code Block
import java.lang.Closable;
public interface FeatureIterator<F extends Feature> extends Closable {
    public boolean hasNext();
    public F next() throws java.util.NoSuchElementException;
    public void close() throws IOException;
}

FeatureReader

BEFORE:

Code Block
languagejava
public interface FeatureReader<T extends FeatureType, F extends Feature> {
    T getFeatureType();
    F next() throws IOException, IllegalArgumentException, NoSuchElementException;
    boolean hasNext() throws IOException;
    void close() throws IOException;
}

AFTER:

Code Block
import java.lang.Closable;
public interface FeatureReader<T extends FeatureType, F extends Feature> extends Closable {
    T getFeatureType();
    F next() throws IOException, IllegalArgumentException, NoSuchElementException;
    boolean hasNext() throws IOException;
    void close() throws IOException;
}

FeatureWriter

BEFORE:

Code Block
languagejava
public interface FeatureWriter<T extends FeatureType, F extends Feature> {
    T getFeatureType();
    F next() throws IOException;
    void remove() throws IOException;
    void write() throws IOException;
    boolean hasNext() throws IOException;
    void close() throws IOException;
}

AFTER:

Code Block
import java.lang.Closable;
public interface FeatureWriter<T extends FeatureType, F extends Feature> extends Closable {
    T getFeatureType();
    F next() throws IOException;
    void remove() throws IOException;
    void write() throws IOException;
    boolean hasNext() throws IOException;
    void close() throws IOException;
}