Jody Garnett wrote:
So it is time to work with others, the geotools project has ported the uDig IResolve API (for catalog), and completed it as an implementation of the "extensible interface pattern". What does this mean? It means that you will be able to supply a factory that can make new adapters for existing IService and IResource handles (no more if/then/else logic).

I have several choices ...

Option 1: extend at the interface level
Option 2: extend at the implementation level
Both of these fail due to the conflict between URL and URI.
Option 3: Bridge
Going to try Option 3, sorry I messed up the example earlier....

class GTGeoResource extends IGeoResource {
   GTGeoResource( GeoResource geotoolsHandle );
}


I will also grab the interface I need from GeoTools and port it to eclipse progress monitors:

public interface IResolveAdapterFactory {
   boolean canAdapt(IResolve resolve, Class adapter);
   Object adapt(IResolve resolve, Class adapter, IProgressMonitor monitor)
       throws IOException;
}

The alternative is to make use of the Eclipse Platform facilities for this stuff ...

interface IAdapterFactory {
   public Object getAdapter(Object adaptableObject, Class adapterType);
   public Class[] getAdapterList();
}

Although I am a bit concerned that using IAdapterFactory misses some of the point: 1. the "target" class is not present in the interface (instead it is part of the XML referring to this class) 2. there is no opportunity to provide a progress monitor when creating the adapter

Point 1 is not so much of a problem, Point 2 breaks the spirit of IResolve (be explicit about delay at the API level) - so I am going to proceed with IResolveAdapterFactory as based on Justin's work.

(The only other thing would be to check the common navigator framework now that it is ready, although I think that may be an Eclipse 3.2 only thing - in terms of "integration" with eclipse we are probably going to have to support this framework eventually anyways).

Cheers,
Jody

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to