[udig-devel] AbstractFeatureStore vs. UdigFeatureStore
Jesse Eichar
jeichar at refractions.net
Fri Jul 20 09:29:14 PDT 2007
You are correct. You can remove that extension. However I expect
that other negative behaviour will occur because that featurestore is
responsible for putting the Transaction on the Layer's FeatureStore.
If you remove it you may be in autocommit mode so the user will not
be able to rollback. What you can do it find the GeoResource in the
Catalog using CatalogPlugin.getLocalCatalog().find( layer.getId() ).
That will give you the unwrapped FeatureStore. Sorry I didn't think
of that yesterday.
Jesse
On Jul 20, 2007, at 12:00 AM, tony.roth at GMX.de wrote:
> You are right, I use the layer before it is added to the map.
>
> I have some temporary/memory based layer and I have layer (sets of
> layer) of different wms server. The user can select one wms server
> out of a list. The layers are added to the map just before the map
> is opened. If the user changes the wms server I remove all layers
> from the map and add them (changing the wms layer) in the correct
> order. This is also done since if you close the mapeditor and opens
> it again, the temporary layers have been removed from the map.
> Perhaps its just a bug in 1.1RC8.
>
> Since it works with 1.1RC8 I thought this would be ok.
>
> I discoverd that it is WrapFeatureStore which intercepts the
> getRessource call of a layer and adds a UDIGFeatureStore. This
> interception is declared in plugin.xml of
> net.refractions.udig.project. I see that this extension exists in
> 1.1RC8 and in 1.1RC10 but it is only used in 1.1RC10: in RC8 the
> debugger tells me that UDIGFeatureStore is never used... and I get
> no exception.
> If I remove this extension from the plugin.xml in RC10 the
> nullpointer exception disappears.
>
> tony roth
>
>
> Something is funny here because the mapEditor shouldn't have to be
> open for the layer to have a map. Indeed as soon as the layer is
> added to the map it has a map. I'll admit that there is some
> dependencies. For example a layer isn't usable without a map.
> There is a construct called Layer interceptors that run when a
> layer is created but I don't see how that could cause a problem...
>
> Are you sure that you are not editing a layer before adding it to a
> map?
>
> Jesse
>
>
> On Jul 19, 2007, at 5:19 AM, tony.roth at GMX.de wrote:
>
>> After switching to SDK 1.1RC10 I got an odd nullpointer exception
>> at removing features of a feature store.
>> I use a temporary / memory based layer which is wrapped by a class
>> called LayerContainer. This class has some convenience methods for
>> changing the (SLD) style and for adding / removing objects like
>> this one:
>> private void removeAllContent(){
>> FeatureStore fs = layer.getGeoRessource().resolve
>> (FeatureStore.class,null);
>> fs.removeFeaures(Filter.NONE);
>> }
>> Using SDK1.1RC8 the object "fs" is an AbstractFeatureStore. Using
>> SDK1.1RC10 it is an UDIGFeatureStore which calls the method
>> "setTransactionInternal" in every method which changes the set of
>> features. In setTransactionInternal this line fails in my
>> application:
>> Transaction transaction = ((EditManager)) layer.getMap
>> ().getEditManager()).getTransaction();
>> layer.getMap() returns null
>> getMap() invokes getMapInternal() invokes getContextModel() which
>> returns the eContainer (type: InternalObject) which is null
>> I can only guess what happens: The the layer is manipulated
>> (adding / removing features) before the map is opened in a
>> MapEditor the first time. This is done since the user can "add
>> objects to map" in a perspective which has no visible map / no
>> MapEditor. The class LayerContainer is notified via
>> eventmanagement and adds / removes features. Under 1.1RC8 this
>> doesn't matter since another FeatureStore is used.
>> (The map object is created before the layer is instanced.)
>> what can I do?
>> tony roth
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.refractions.net/pipermail/udig-devel/attachments/20070720/6ae9111d/attachment.html
More information about the udig-devel
mailing list