GCE Framework throws ClassCastException

Description

The GCE Framework in module/main will choke on plugins which are not backed by the Geotools GCE building blocks. The critical failure is in GridFormatFinder, StreamGridCoverageExchange, and FileSystemGridCoverageExchange, at least. Each failure is characterized by a cast of a GeoAPI "Format" interface to a Geotools "AbstractGridFormat" object in order to access some functionality which is not provided by the interface. The GeoAPI "Format" interface is a purely descriptive interface which exists merely to provide information about the format. The Geotools GCE framework requires functionality provided by AbstractGridFormat (such as "accepts()", "getReader()", "getWriter()").

An Example:
GridFormatFinder requires the "accepts()" method which used to be part of the old org.geotools.data.coverage.grid.Format interface. This will not work with the new GeoAPI interfaces, as this method is missing. Plugin writers who write their own org.opengis.coverage.grid.Format interface will not inherit from AbstractGridFormat, and this will throw a ClassCastException in the following code:

public static Format findFormat(Object o){
Format[] formats=getFormatArray();
for (int i = 0; i < formats.length; i++)
{
Format f = formats[i];
if( ((AbstractGridFormat)f).accepts(o) )
return f;
}
return null;
}

At the very least, plugin writers should be warned that they must implement the GeoAPI interface with AbstractGridFormat! A more thorough solution would be to force the GridFormatFinder to look for objects of type "AbstractGridFormat" instead of GeoAPI "Format".

Plugins should not be allowed to break module/main!!

Environment

None

Activity

Show:
codehaus
April 10, 2015, 3:33 PM

CodeHaus Comment From: desruisseaux - Time: Wed, 20 Apr 2005 02:00:31 -0500
---------------------
The whole GridCoverage packages in GeoAPI need to be replaced by new interfaces derived from ISO. We hope to fix this issue at this time.

codehaus
April 10, 2015, 3:33 PM

CodeHaus Comment From: jgarnett - Time: Sun, 5 Mar 2006 15:11:41 -0600
---------------------
Hi Martin this bug is assigned to you and was listed as a BLOCKER on 2.2 release. It does not appear that you plan to fix it based on your comments. I am going to mark it as critical and ask for a javadoc change for 2.2.

codehaus
April 10, 2015, 3:33 PM

CodeHaus Comment From: desruisseaux - Time: Sun, 5 Mar 2006 15:46:41 -0600
---------------------
Unsassigning from me for now. I didn't wrote the GCE part. Maybe it would be better if we could get one of the author to look at it. I will take back this issue later (don't know when - maybe when I will be back on grid coverage work) if nobody work on it.

codehaus
April 10, 2015, 3:33 PM

CodeHaus Comment From: bnordgren - Time: Mon, 6 Mar 2006 14:10:05 -0600
---------------------
The GCE framework may be on it's way out, to be replaced by the new coverage stuff. May want to wait and see.

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Affects versions

Priority

High
Configure