Revision 38864 branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java
DBFStoreProvider.java | ||
---|---|---|
11 | 11 |
import java.util.List; |
12 | 12 |
import java.util.Locale; |
13 | 13 |
|
14 |
import org.slf4j.Logger; |
|
15 |
import org.slf4j.LoggerFactory; |
|
16 |
|
|
14 | 17 |
import org.gvsig.fmap.dal.DALLocator; |
15 | 18 |
import org.gvsig.fmap.dal.DataManager; |
16 | 19 |
import org.gvsig.fmap.dal.DataServerExplorer; |
... | ... | |
64 | 67 |
public class DBFStoreProvider extends AbstractFeatureStoreProvider implements |
65 | 68 |
ResourceConsumer { |
66 | 69 |
|
67 |
// private static final Logger LOG = LoggerFactory.getLogger(DBFStoreProvider.class);
|
|
70 |
private static final Logger LOG = LoggerFactory.getLogger(DBFStoreProvider.class);
|
|
68 | 71 |
|
69 | 72 |
public static String NAME = "DBF"; |
70 | 73 |
public static String DESCRIPTION = "DBF file"; |
... | ... | |
78 | 81 |
private ResourceProvider dbfResource; |
79 | 82 |
private long counterNewsOIDs = -1; |
80 | 83 |
private DBFFeatureWriter writer; |
84 |
|
|
85 |
private static long lastLogTime = 0; |
|
81 | 86 |
|
82 | 87 |
|
83 | 88 |
protected static void registerMetadataDefinition() throws MetadataException { |
... | ... | |
355 | 360 |
|
356 | 361 |
protected void loadValue(FeatureProvider featureProvider, int rowIndex, |
357 | 362 |
FeatureAttributeDescriptor descriptor) throws ReadException { |
363 |
|
|
358 | 364 |
if (descriptor.getEvaluator() != null) { |
359 | 365 |
// Nothing to do |
360 | 366 |
return; |
361 | 367 |
} |
362 | 368 |
|
363 |
|
|
364 | 369 |
int dbfIndex = this.dbfFile.getFieldIndex(descriptor.getName()); |
370 |
|
|
371 |
if (dbfIndex < 0) { |
|
372 |
// Someone asked to load a field |
|
373 |
// which does not exist in the DBF file. This can happen |
|
374 |
// in editing process when a field has been added |
|
375 |
// in the current editing session, so we simply do nothing. |
|
376 |
// The expansion manager is expected to manage those new fields |
|
377 |
// and their values. |
|
378 |
long curr_time = System.currentTimeMillis(); |
|
379 |
// This ensures not more than one log every 2 seconds |
|
380 |
if (curr_time - lastLogTime > 2000) { |
|
381 |
LOG.info("Warning: The requested field does not exist in the DBF file. Assumed it's a new field in editing mode."); |
|
382 |
lastLogTime = curr_time; |
|
383 |
} |
|
384 |
return; |
|
385 |
} |
|
386 |
|
|
365 | 387 |
String value = null; |
366 | 388 |
try { |
367 | 389 |
value = this.dbfFile.getStringFieldValue(rowIndex, dbfIndex); |
Also available in: Unified diff