[udig-devel] Extention propsoal ...

Jody Garnett jgarnett at refractions.net
Fri Sep 8 07:02:45 PDT 2006


A couple of requests for extension points have gone by recently:
- IResolveAdapterFactory - completed (thanks Jesse)
- IGeoCoder - for the location view to process

And I am about to request one more, but I am not sure how to phrase it - 
basically as an application developer I want to hook into uDig and be 
able to do the kinds of things it does (and I expect uDig to use the 
same facilities it is offering me).

So here is the uDig functionality that I want to take part in:
- when you request a FeatureSource for a Layer, uDig will create you 
one, and hook it up with a Transaction

Sine a Transaction completely holds the "state" for all geotools data 
interaction this is all fine and good. But uDig goes the extra mile and 
holds onto the FeatureSource so you can get back the exact same instance 
next time. This is helpful when it holds onto other resources for you 
(ie WMSLayer, something you made up, etc...).  To be open ended the 
layer "refresh" option should actually empty out all these things, 
forcing renderer's and so on to fetch them from the catalog again.

That is the background information, here is the activity I need to take 
part in  ....
- uDig constructs a FeatureSource, and performs some manipulations on it 
before making it available for caching (ie uDig sets the 
currentTransaction).
- I need in there in order to wrap the featureSource with my own class 
before it is cached, and used by all uDig display and edit tools

So here is what I propose (note use of proxy rather then adapter as we 
need to maintain the same interface):
interface LayerResourceProxy<R> {
        public <R> proxy( ILayer layer, <R> resource);
}

The extension point XML will define the specific interface being 
handled. For uDig to make use of the same facility it will need to 
implement something like the following:
class TransactionResourceProxy implements 
LayerResourceProxy<FeatureSource> {
        public FeatureSource proxy( ILayer layer, FeatureSource resource){
               if( resource instanceof FeatureStore){
                      ((FeatureStore)resource).setTransaction( 
transaction ); // no idea where transaction is off the top of my head
               }
               return resource;
        }
}

Comments are welcome,
Jody

 



More information about the udig-devel mailing list