Revision 29289 branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java
DBFStoreProvider.java | ||
---|---|---|
37 | 37 |
import org.gvsig.fmap.dal.feature.exception.PerformEditingException; |
38 | 38 |
import org.gvsig.fmap.dal.feature.exception.UnknownDataTypeException; |
39 | 39 |
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider; |
40 |
import org.gvsig.fmap.dal.feature.spi.FeatureData;
|
|
40 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
|
|
41 | 41 |
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices; |
42 | 42 |
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider; |
43 | 43 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
... | ... | |
68 | 68 |
public class DBFStoreProvider extends AbstractFeatureStoreProvider implements |
69 | 69 |
ResourceConsumer { |
70 | 70 |
|
71 |
public static String NAME = "DBFStore";
|
|
71 |
public static String NAME = "DBF"; |
|
72 | 72 |
public static String DESCRIPTION = "DBF file"; |
73 | 73 |
// private DBFResource dbf = null; |
74 | 74 |
private static final Locale ukLocale = new Locale("en", "UK"); |
... | ... | |
99 | 99 |
|
100 | 100 |
protected void init(DBFStoreParameters params) throws InitializeException { |
101 | 101 |
this.dbfParams = params; |
102 |
this.dynObject = (DelegatedDynObject) ToolsLocator
|
|
102 |
this.metadata = (DelegatedDynObject) ToolsLocator
|
|
103 | 103 |
.getDynObjectManager().createDynObject( |
104 | 104 |
DYNCLASS); |
105 | 105 |
|
106 |
this.dynObject.setDynValue("DefaultSRS", null);
|
|
107 |
this.dynObject.setDynValue("Envelope", null);
|
|
106 |
this.metadata.setDynValue("DefaultSRS", null);
|
|
107 |
this.metadata.setDynValue("Envelope", null);
|
|
108 | 108 |
|
109 | 109 |
File theFile = getDBFParameters().getDBFFile(); |
110 | 110 |
dbfResource = this.createResource(FileResource.NAME, |
... | ... | |
149 | 149 |
} |
150 | 150 |
} |
151 | 151 |
|
152 |
public FeatureData getFeatureDataByReference(
|
|
152 |
public FeatureProvider getFeatureDataByReference(
|
|
153 | 153 |
FeatureReferenceProviderServices reference, FeatureType featureType) |
154 | 154 |
throws DataException { |
155 | 155 |
|
... | ... | |
159 | 159 |
} |
160 | 160 |
|
161 | 161 |
|
162 |
public FeatureData getFeatureDataByReference(
|
|
162 |
public FeatureProvider getFeatureDataByReference(
|
|
163 | 163 |
FeatureReferenceProviderServices reference) throws DataException { |
164 | 164 |
return this.getFeatureDataByReference(reference, this.store |
165 | 165 |
.getDefaultFeatureType()); |
166 | 166 |
} |
167 | 167 |
|
168 |
public void performEditing(Iterator deleteds, Iterator inserteds,
|
|
168 |
public void performChanges(Iterator deleteds, Iterator inserteds,
|
|
169 | 169 |
Iterator updateds, Iterator originalFeatureTypesUpdated) |
170 | 170 |
throws PerformEditingException { |
171 | 171 |
|
... | ... | |
214 | 214 |
* ================================================== |
215 | 215 |
*/ |
216 | 216 |
|
217 |
public FeatureData createFeatureData(FeatureType type) throws DataException {
|
|
217 |
public FeatureProvider createFeatureData(FeatureType type) throws DataException {
|
|
218 | 218 |
return new DBFFeatureData(this, type); |
219 | 219 |
} |
220 | 220 |
|
... | ... | |
299 | 299 |
} |
300 | 300 |
|
301 | 301 |
|
302 |
protected void loadValue(FeatureData featureData, int rowIndex,
|
|
302 |
protected void loadValue(FeatureProvider featureData, int rowIndex,
|
|
303 | 303 |
FeatureAttributeDescriptor descriptor) throws ReadException { |
304 | 304 |
if (descriptor.getEvaluator() != null) { |
305 | 305 |
// Nothing to do |
... | ... | |
411 | 411 |
* @return |
412 | 412 |
* @throws ReadException |
413 | 413 |
*/ |
414 |
protected FeatureData getFeatureDataByIndex(long index) throws DataException {
|
|
414 |
protected FeatureProvider getFeatureDataByIndex(long index) throws DataException {
|
|
415 | 415 |
return this |
416 | 416 |
.getFeatureDataByIndex(index, this.store |
417 | 417 |
.getDefaultFeatureType()); |
... | ... | |
441 | 441 |
return true; |
442 | 442 |
} |
443 | 443 |
|
444 |
public boolean canWriteGeometry(int geometryType) throws DataException { |
|
444 |
public boolean canWriteGeometry(int geometryType, int geometrySubType) throws DataException {
|
|
445 | 445 |
return false; |
446 | 446 |
} |
447 | 447 |
|
... | ... | |
483 | 483 |
|
484 | 484 |
protected void loadMetadataValues() throws DynFieldNotFoundException, |
485 | 485 |
ReadException { |
486 |
this.dynObject.setDynValue(DBFLibrary.DYNFIELD_CODEPAGE_NAME, new Byte(
|
|
486 |
this.metadata.setDynValue(DBFLibrary.DYNFIELD_CODEPAGE_NAME, new Byte(
|
|
487 | 487 |
this.dbfFile.getCodePage())); |
488 |
this.dynObject.setDynValue(DYNFIELD_CURRENT_ENCODING, dbfFile
|
|
488 |
this.metadata.setDynValue(DYNFIELD_CURRENT_ENCODING, dbfFile
|
|
489 | 489 |
.getCurrenCharset().name()); |
490 |
this.dynObject.setDynValue(DYNFIELD_ORIGINAL_ENCODING, dbfFile
|
|
490 |
this.metadata.setDynValue(DYNFIELD_ORIGINAL_ENCODING, dbfFile
|
|
491 | 491 |
.getOriginalCharset().name()); |
492 | 492 |
} |
493 | 493 |
|
... | ... | |
565 | 565 |
* @return |
566 | 566 |
* @throws ReadException |
567 | 567 |
*/ |
568 |
protected FeatureData getFeatureDataByIndex(long index,
|
|
568 |
protected FeatureProvider getFeatureDataByIndex(long index,
|
|
569 | 569 |
FeatureType featureType) throws DataException { |
570 |
FeatureData featureData = this.createFeatureData(featureType);
|
|
570 |
FeatureProvider featureData = this.createFeatureData(featureType);
|
|
571 | 571 |
featureData.setOID(new Long(index)); |
572 | 572 |
return featureData; |
573 | 573 |
} |
574 | 574 |
|
575 |
protected void initFeatureDataByIndex(FeatureData featureData,
|
|
575 |
protected void initFeatureDataByIndex(FeatureProvider featureData,
|
|
576 | 576 |
long index, FeatureType featureType) throws DataException { |
577 | 577 |
featureData.setOID(new Long(index)); |
578 | 578 |
} |
... | ... | |
582 | 582 |
* @param featureData |
583 | 583 |
* @throws DataException |
584 | 584 |
*/ |
585 |
protected void loadFeatureDataByIndex(FeatureData featureData)
|
|
585 |
protected void loadFeatureDataByIndex(FeatureProvider featureData)
|
|
586 | 586 |
throws DataException { |
587 | 587 |
this.open(); |
588 | 588 |
this.resourcesBegin(); |
... | ... | |
605 | 605 |
} |
606 | 606 |
} |
607 | 607 |
|
608 |
public int getFeatureReferenceOIDType() {
|
|
608 |
public int getOIDType() { |
|
609 | 609 |
return DataTypes.LONG; |
610 | 610 |
} |
611 | 611 |
|
... | ... | |
628 | 628 |
} |
629 | 629 |
|
630 | 630 |
|
631 |
public void append(FeatureData featureData) throws DataException {
|
|
631 |
public void append(FeatureProvider featureData) throws DataException {
|
|
632 | 632 |
this.resourcesBegin(); |
633 | 633 |
try { |
634 | 634 |
writer.append(store.createFeature(featureData)); |
Also available in: Unified diff