Andrea Aime wrote:
> 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
> 
> 

This conversation became a little too detailed for me to keep up, so I'm 
pushing it back to a simpler time :)

I think the use of a generateNew and useExisting hints makes perfect 
sense, but I'm a bit wary of reuseOrGenerate silently generating a fid. 
  Would there be a mechanism for retrieving the fid that was ultimately 
used, similar to what's currently used, or hooking into an event to be 
notified if a fid was generated?  Would there be a means of determining 
why a fid was rejected or check the validity before submitting the fid?

--
Mark

------------------------------------------------------------------------------
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