Hello!
I would like to see a method public void ShapefileDataStore.modifyFeatureType(AttributeType[] removedTypes, AttributeType[] addedTypes, Object[] defaultAddedValues) throws IOException; for modifying current ShapefileDataStore schema. There is a unimplemented stuff updateSchema(FeatureType) that can just delegate real work to the underlying method by analyzing passed FeatureType with current schema. The developer may call ShapefileDataStore.updateSchema(FeatureType) or modifyFeatureType(...) directly from ShapefileDataStore. The last method gives more freedom to manipulate by attribute types without creating FeatureType (etc.). The ShapefileDataStore has to perform schema modifications internally because of read/write lock object is inside of it. The approach is usual: read from current datastore, modify features on the fly to conform changes, write into temporary. Then lock current datastore to rewrite files from temporary one, unlock. I have implemented the method, also tests. Any comments or suggestions (for/against this proposal). If there are no points against I can commit to geotools 2.2.x branch and to trunk. Regards, Vitali. P.S. the difficulty to perform this operation outside of ShapefileDataStore - there is no possibility to get lock. Because of the requirement is schema modification of the current shapefile, not a creation of new shapefile. Without lock it is dangerous in multi-threading environment like UDIG and led to exceptions like "java.io.IOException: Shp has extra record"... ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
