svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dataFile / src / org / gvsig / fmap / data / store / dbf / DBFStoreParameters.java @ 23914
History | View | Annotate | Download (1.74 KB)
1 |
package org.gvsig.fmap.data.store.dbf; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
|
5 |
import org.gvsig.fmap.data.DataStoreParameters; |
6 |
import org.gvsig.fmap.data.DataTypes; |
7 |
import org.gvsig.fmap.data.exceptions.InitializeException; |
8 |
|
9 |
import com.iver.utiles.NotExistInXMLEntity; |
10 |
import com.iver.utiles.XMLEntity; |
11 |
|
12 |
public class DBFStoreParameters extends DataStoreParameters { |
13 |
|
14 |
|
15 |
public DBFStoreParameters() {
|
16 |
super();
|
17 |
initialize(); |
18 |
} |
19 |
|
20 |
public DataStoreParameters initialize() {
|
21 |
this.addParameter("dbfFile", DataTypes.STRING, "Ruta al fichero dbf", |
22 |
null);
|
23 |
this.addAlias("dbfFile", "filename"); |
24 |
this.addAlias("dbfFile", "file"); |
25 |
return this; |
26 |
} |
27 |
|
28 |
public String getDataStoreName() { |
29 |
return DBFStoreProvider.STORE_NAME;
|
30 |
} |
31 |
|
32 |
public boolean isValid() { |
33 |
return (this.getDBFFile() != null); |
34 |
} |
35 |
|
36 |
public String getFile() { |
37 |
return this.getDBFFile(); |
38 |
} |
39 |
|
40 |
public void setFile(File aFile) { |
41 |
this.setDBFFile(aFile);
|
42 |
} |
43 |
|
44 |
public void setFile(String aFileName) { |
45 |
this.setDBFFile(aFileName);
|
46 |
} |
47 |
|
48 |
protected String getDBFFile() { |
49 |
return (String) this.get("dbfFile"); |
50 |
} |
51 |
|
52 |
protected void setDBFFile(File aFile) { |
53 |
this.set("dbfFile", aFile.getPath()); |
54 |
} |
55 |
|
56 |
protected void setDBFFile(String aFileName) { |
57 |
this.set("dbfFile", aFileName); |
58 |
} |
59 |
|
60 |
public String getDescription() { |
61 |
return DBFStoreProvider.STORE_DESCRIPTION;
|
62 |
} |
63 |
|
64 |
public XMLEntity getXMLEntity() {
|
65 |
XMLEntity xmlEntity = super.getXMLEntity();
|
66 |
xmlEntity.putProperty("dbfFile", this.getDBFFile()); |
67 |
return xmlEntity;
|
68 |
} |
69 |
|
70 |
public void loadFromXMLEntity(XMLEntity xmlEntity) |
71 |
throws InitializeException {
|
72 |
try{
|
73 |
this.setDBFFile(xmlEntity.getStringProperty("dbfFile")); |
74 |
} catch (NotExistInXMLEntity e) {
|
75 |
throw new InitializeException(e); |
76 |
} |
77 |
} |
78 |
|
79 |
} |