Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Datastores & co

> So did you want to place this in the code example plugin?

No, I wanted to first discuss the thing and understand it to make one
that works :)

>
>
> > 2) try to get the same thing from a udig layer (assuming the ILayers
> > were put into the itemsMap):
> >
> > ILayer tmpLayer = itemsMap.get(name);
> >                 if (tmpLayer != null) {
> >                     try {
> >                         FeatureStore tmpStore =
> > tmpLayer.getResource(FeatureStore.class, null); if (tmpStore != null)
> >                             selectedLayers.add(tmpStore);
> >                     } catch (IOException e) {
> >                         e.printStackTrace();
> >                     }
> >                 }
> >
> > Here I have to use FeatureStore, because with DataStore it would return
> > null.
> > In fact, UDIGFeatureStore implements FeatureStore, but not DataStore,
> >
> Right; it will *never* implement DataStore; that is what the
> getDataStore() method is for. FeatureStore is an interface providing a
> view on a DataStore.
>
> > so they do not resolve to the same. To get the DataStore out of the
> > UDIGFeatureStore I need to go through:
> >
> > DataStore dS = null;
> >                     if (tmp instanceof DataStore) {
> >                         dS = tmp
> >                     } else if (tmp instanceof UDIGFeatureStore) {
> >                         dS = ((UDIGFeatureStore) tmp).getDataStore()
> >                     }
> >
> So this makes sense to me; I think the problem may be confusion of
> layer.getResource( .. ) - the method is a helper method and perhaps not
> being that helpful right now.

I find it helpful, but the problem is that in one of the two cases it
returns a DataStore and in the other one not.

What should the behaviour be? Which is/should be the absolute
interface ("there will be only one!")? :)

Ciao
Andrea


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


Back to the top