java - Why can't I cast WFSFeatureSource into SimpleFeatureStore? -


in geotools javadoc transaction (and in few other places, such blogs , forth) suggest lines performing transactions on database:

simplefeaturestore road = (simplefeaturestore) store.getfeaturesource("road"); 

where "store", far can work out, datastore. method returns wfsfeaturestore, wants cast simplefeaturestore. however, @ runtime, says can't cast this, , halts program. wfsfeaturestore class, simplefeaturestore interface. both implement simplefeaturesource interface.

there must lost in description somewhere, because these places suggest it, doesn't work. can enlighten me?

a datastore return simplefeaturesource instead of simplefeaturestore if chosen target not writable. in case of wfs maybe remote wfs server not allow wfs-t or wfs store not able parse capabilities. possibility server supports wfs-t 1.1, far know geotools has code transactions against wfs 1.0 server.


Comments