FeatureWriter with user supplied FeatureIDs
-------------------------------------------

                 Key: GEOT-3544
                 URL: http://jira.codehaus.org/browse/GEOT-3544
             Project: GeoTools
          Issue Type: Bug
          Components: data, data property
            Reporter: Jody Garnett
            Assignee: Jody Garnett
             Fix For: 8-M0


The following output appears silly when testing PropertyDataStore (Run 
PropertyExamples in the test directory):

{noformat}
start     auto-commit: [fid3, fid4, fid1, fid2]
start              t1: [fid3, fid4, fid1, fid2]
start              t2: [fid3, fid4, fid1, fid2]
t1 remove of fid1)
t1 remove auto-commit: [fid3, fid4, fid1, fid2]
t1 remove          t1: [fid3, fid4, fid2]
t1 remove          t2: [fid3, fid4, fid1, fid2]
t2 addition of new feature fid5)
t2 add    auto-commit: [fid3, fid4, fid1, fid2]
t2 add             t1: [fid3, fid4, fid2]
t1 add             t2: [fid3, fid4, fid1, fid2, fid5]
t1 commit (removeal of fid1)
t1 commit auto-commit: [fid3, fid4, fid2]
t1 commit          t1: [fid3, fid4, fid2]
t1 commit          t2: [fid3, fid4, fid2, fid5]
t2 commit (ie addition of new feature)
t2 commit auto-commit: [example3066810808721531672.:example.1303836799597, 
fid3, fid4, fid2]
t2 commit          t1: [example3066810808721531672.:example.1303836799597, 
fid3, fid4, fid2]
t2 commit          t2: [example3066810808721531672.:example.1303836799597, 
fid3, fid4, fid2]
{noformat}

Notice that "fid5" is preserved; until we call commit - at which point a crazy 
id is written out to the property file.

I suspect that the "feature id" preserving hint was never added to 
FeatureWriter; it was only added to smart datastores like jdbc or arcsde?

Since property datastore is advertised as supporting this hint I am a bit 
confused as how to accomplish that? The code that is screwing up is in 
TransactionStateDiff. It gets a FeatureWriter from PropertyDataStore; but there 
is no mechanism available to supply a feature id?

>From TransactionStateDiff

{code}
    for (Iterator i = diff.added.values().iterator(); i.hasNext();) {
        addedFeature = (SimpleFeature) i.next();        
        fid = addedFeature.getID();
        nextFeature = (SimpleFeature)writer.next();
        if (nextFeature == null) {
            throw new DataSourceException("Could not add " + fid);
        } else {
            try {
                nextFeature.setAttributes(addedFeature.getAttributes());
                if( Boolean.TRUE.equals( 
addedFeature.getUserData().get(Hints.USE_PROVIDED_FID)){
                    // how to "fix" featureId?
                }
                writer.write();
                store.listenerManager.fireFeaturesAdded(typeName,
                        transaction, 
ReferencedEnvelope.reference(nextFeature.getBounds()), true);
            } catch (IllegalAttributeException e) {
                throw new DataSourceException("Could update " + fid, e);
            }
        }
{code}

A couple of options:

# Change the FeatureWrierAPI for this?
#* set a hint prior to calling "next"; or
#* make a method next( String fid ); or
#* add a method write( String fid );

# Have next() return a "MutableFIDFeature" like Gabriel did for for ArcSDE?


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to