[udig-devel] Datastores & co

Jody Garnett jgarnett at refractions.net
Tue Jan 15 12:15:19 PST 2008


Andrea Antonello wrote:
> I have a problem with the thousand levels of abstraction for feature
> data.
>   
Fair enough.
> After running up and down the line, I decided that DataStore could be a
> good interface to use to get a whole pile of data types from which to
> get features.
>   
Okay; we should be able to get to that from an IService.
> But right after that thought, I noticed that:
> DataStore tmpStore = tmpLayer.getResource(DataStore.class, null);
>   
Option 1)
FeatureSource source = tmpLayer.getResource( FeatureSource.class, null );
DataStore source.getDataStore();

Option 2)
IGeoResource resource = tmlLayer.getGeoResource(...); // not sure of the 
details here
IService service = resource.getParent();
DataStore dataStore = service.resolve( DataStore.class, null );

Cheers,
Jody
> does return null for the first thing I tried, i.e. the
> ShapefileDataStore. This happens because it doesn't resolve to it.
>
> So I don't understand if I got the thing wrong and if yes, what should
> I take to be able to define an item that deals with most possible
> features types? This should apply from the layers but also from the
> catalog resources.
>   
A layer is bound to a single kind of features (ie the contents) ; as 
represented by the FeatureSource read only api; or the FeatureStore 
subclass for a read/write api. Those features are provided by a service; 
the service is represented a DataStore (like a Databse, WFS or a Shapefile).

Cheers,
Jody


More information about the udig-devel mailing list