Andrea Aime ha scritto:
  > Of course one way is to replicate sort of the same trick
> for JDBCFeatureStore, leveraging the knowledge of the
> feature returned by the writer to stick a FID into it,
> and then change JDBCDataStore.getNextValue() so that it
> also takes the current Feature and tries to unpack the
> primary key instead of blindly trying to generate a new
> value.
> This would also be an acceptable solution to me btw,
> and I guess it would cover 90% of what is needed:
> shapefile datastore cannot accept user provided pks,
> the only other one I can think of that would need
> to use assigned values is probably the WFS data store
> one (and maybe the SDE one? not sure).

Chatting with Jody on IRC the point of how to control this
was raised. A hint of sorts?
Without making an API change we could put the hint about
how we want the primary key to be handled in the
feature user map.
FID handling hints could follow the WFS suggestions:
- generateNew
- useExisting
- replaceDuplicate... humm....

Generate is what we do today.
UseExisting would make the code try to parse the feature
fid and try to insert it. What do we do if we fail?
Throw an exception?
ReplaceDuplicate might be a little nasty, the spec says
that if another feature with the same FID exists,
it should be removed and replaced. I mean, it's doable,
but quite some side effect for a hint. Looks more like
something better controlled at the user application
level.

What about just generateNew, useExisting, and maybe
reuseOrGenerate which would reuse the fid if properly
formatted, and silently generate a new one otherwise?
(it would mean useExisting would throw an exception in
  case of mis-formatted fid)

Opinions?

Cheers
Andrea




-- 
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to