Revision 20660 trunk/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFStore.java

View differences:

DBFStore.java
39 39

  
40 40
public class DBFStore extends FeatureStore{
41 41
	public static String DATASTORE_NAME = "DBFStore";
42
	protected DBFResource dbf= null;
42
	private DBFResource dbf= null;
43 43
	protected List featureTypes = new ArrayList();//<IFeatureType>
44 44
	protected IFeatureType featureType;
45 45
	protected IMetadata metadata;
......
47 47

  
48 48

  
49 49
	 public void init(IDataStoreParameters parameters) throws InitializeException {
50
	        super.init(parameters);
51
	    	dbfParameters=(DBFStoreParameters)parameters;
52
	    	DBFResource tmpResoure = new DBFResource(dbfParameters.getDBFFile());
50
		 dbfParameters=(DBFStoreParameters)parameters;
51
		 DBFResource tmpResource = new DBFResource(dbfParameters.getDBFFile());
53 52

  
54
	    	ResourceManager resMan = ResourceManager.getResourceManager();
53
		 ResourceManager resMan = ResourceManager.getResourceManager();
55 54

  
56
	    	try {
57
				this.dbf = (DBFResource)resMan.addResource(tmpResoure);
58
			} catch (DataException e1) {
59
				throw new InitializeException(this.getName(),e1);
60
			}
55
		 try {
56
			 this.dbf = (DBFResource)resMan.addResource(tmpResource);
57
		 } catch (DataException e1) {
58
			 throw new InitializeException(this.getName(),e1);
59
		 }
61 60

  
62
//			this.dbf.open();
63
//			this.dbf.addObserver(this);
61
		 super.init(parameters,this.dbf);
62

  
63
//		 this.dbf.open();
64
//		 this.dbf.addObserver(this);
65
		 this.initFeatureType();
66
	 }
67

  
68
	 private void initFeatureType() throws InitializeException{
64 69
	    	int fieldCount = -1;
65 70
	    	try{
66 71
	    		fieldCount =dbf.getFieldCount();
......
81 86
					}
82 87
	                featureType.add(fad);
83 88
	            }
84
	    }
85 89

  
90
	 }
86 91

  
92

  
87 93
	 private IFeatureAttributeDescriptor createFeatureAttribute(int i) throws ReadException, IsNotAttributeSettingException {
88 94
	        char fieldType = dbf.getFieldType(i);
89 95
	        AttributeDescriptor dad=new AttributeDescriptor();
......
127 133
		}
128 134
        writer.postProcess();
129 135

  
136
        this.dbf.changed(this);
130 137
	}
131 138

  
132 139
	public IDataCollection getDataCollection(IFeatureType type, String filter, String order) throws ReadException {
......
294 301
		}
295 302
		return src;
296 303
	}
304

  
305
	/* (non-Javadoc)
306
	 * @see org.gvsig.data.vectorial.FeatureStore#doRefresh()
307
	 */
308
	protected void doRefresh() throws OpenException, InitializeException {
309
		this.initFeatureType();
310
	}
311

  
312
	/**
313
	 * @param i
314
	 * @param i2
315
	 * @return
316
	 * @throws ReadException
317
	 */
318
	protected String getStringFieldValue(int rowIndex, int fieldId) throws ReadException {
319
		return this.dbf.getStringFieldValue(rowIndex, fieldId);
320
	}
297 321
}

Also available in: Unified diff