Revision 23543 branches/v2_0_0_prep/libraries/libFMap_dataFile/src/org/gvsig/fmap/data/feature/file/dgn/DGNStoreParameters.java
DGNStoreParameters.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 | 4 |
|
5 |
import org.gvsig.fmap.data.AbstractDataStoreParameters; |
|
6 |
import org.gvsig.fmap.data.InitializeException; |
|
5 |
import org.gvsig.fmap.data.feature.file.AbstractFileStoreParameters; |
|
7 | 6 |
import org.gvsig.fmap.data.feature.file.FileStoreParameters; |
8 | 7 |
|
9 |
import com.iver.utiles.NotExistInXMLEntity; |
|
10 |
import com.iver.utiles.XMLEntity; |
|
11 | 8 |
|
12 |
|
|
13 |
public class DGNStoreParameters extends AbstractDataStoreParameters implements |
|
9 |
public class DGNStoreParameters extends AbstractFileStoreParameters implements |
|
14 | 10 |
FileStoreParameters { |
15 |
private File dgnfile; |
|
16 | 11 |
public String getDataStoreName() { |
17 | 12 |
return DGNStore.DATASTORE_NAME; |
18 | 13 |
} |
19 |
public boolean isValid() { |
|
20 |
return dgnfile != null; |
|
21 |
} |
|
22 |
/* (non-Javadoc) |
|
23 |
* @see org.gvsig.fmap.data.feature.file.FileStoreParameters#getFile() |
|
24 |
*/ |
|
25 |
public File getFile() { |
|
26 |
return dgnfile; |
|
27 |
} |
|
28 |
/* (non-Javadoc) |
|
29 |
* @see org.gvsig.fmap.data.feature.file.FileStoreParameters#setFile(java.io.File) |
|
30 |
*/ |
|
31 |
public void setFile(File aFile) { |
|
32 |
this.dgnfile = aFile; |
|
33 |
} |
|
34 | 14 |
public boolean fileAccept(File f) { |
35 | 15 |
return f.getAbsolutePath().toLowerCase().endsWith(".dgn"); |
36 | 16 |
} |
... | ... | |
39 | 19 |
return "DGN File"; |
40 | 20 |
} |
41 | 21 |
|
42 |
|
|
43 |
public XMLEntity getXMLEntity() { |
|
44 |
XMLEntity xmlEntity = super.getXMLEntity(); |
|
45 |
xmlEntity.putProperty("dgnfile", this.dgnfile.getPath()); |
|
46 |
return xmlEntity; |
|
47 |
} |
|
48 |
|
|
49 |
public void loadFromXMLEntity(XMLEntity xmlEntity) |
|
50 |
throws InitializeException { |
|
51 |
try { |
|
52 |
this.dgnfile = new File(xmlEntity.getStringProperty("dgnfile")); |
|
53 |
} catch (NotExistInXMLEntity e) { |
|
54 |
throw new InitializeException("dgnfile property not found", this |
|
55 |
.getDataStoreName()); |
|
56 |
} |
|
57 |
} |
|
58 |
|
|
59 | 22 |
} |
Also available in: Unified diff