root / org.gvsig.dgn / trunk / org.gvsig.dgn / org.gvsig.dgn.provider / src / main / java / org / gvsig / fmap / dal / store / dgn / DGNStoreParameters.java @ 6
History | View | Annotate | Download (2.53 KB)
1 |
package org.gvsig.fmap.dal.store.dgn; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
|
5 |
import org.cresques.cts.IProjection; |
6 |
import org.gvsig.fmap.dal.DataStoreParameters; |
7 |
import org.gvsig.fmap.dal.FileHelper; |
8 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
9 |
import org.gvsig.fmap.dal.feature.FeatureType; |
10 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
11 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
12 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
13 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
14 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
15 |
|
16 |
public class DGNStoreParameters extends AbstractDataParameters implements |
17 |
DataStoreParameters, FilesystemStoreParameters, |
18 |
NewFeatureStoreParameters { |
19 |
|
20 |
public static final String PARAMETERS_DEFINITION_NAME = "DGNStoreParameters"; |
21 |
|
22 |
private static final String FIELD_FILE = "file"; |
23 |
private static final String FIELD_CRS = "CRS"; |
24 |
|
25 |
private DelegatedDynObject parameters;
|
26 |
|
27 |
|
28 |
public DGNStoreParameters() {
|
29 |
this(PARAMETERS_DEFINITION_NAME);
|
30 |
} |
31 |
|
32 |
protected DGNStoreParameters(String parametersDefinitionName) { |
33 |
this(parametersDefinitionName, DGNStoreProvider.NAME);
|
34 |
} |
35 |
|
36 |
public DGNStoreParameters(String parametersDefinitionName, String name) { |
37 |
super();
|
38 |
this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
|
39 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
|
40 |
} |
41 |
|
42 |
public String getDataStoreName() { |
43 |
return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
44 |
} |
45 |
|
46 |
public String getDescription() { |
47 |
return this.getDynClass().getDescription(); |
48 |
} |
49 |
|
50 |
|
51 |
public void setCRS(IProjection srs) { |
52 |
setDynValue(FIELD_CRS, srs); |
53 |
} |
54 |
|
55 |
public void setCRS(String srs) { |
56 |
setDynValue(FIELD_CRS, srs); |
57 |
} |
58 |
|
59 |
public IProjection getCRS() {
|
60 |
return (IProjection) getDynValue(FIELD_CRS);
|
61 |
} |
62 |
|
63 |
public String getFileName() { |
64 |
return this.getFile().getPath(); |
65 |
} |
66 |
|
67 |
public boolean isValid() { |
68 |
if (getCRS() == null ) { |
69 |
return false; |
70 |
} |
71 |
if (getFile() == null) { |
72 |
return false; |
73 |
} |
74 |
return true; |
75 |
} |
76 |
|
77 |
public File getFile() { |
78 |
return (File) this.getDynValue(FIELD_FILE); |
79 |
} |
80 |
|
81 |
public void setFile(File file) { |
82 |
this.setDynValue(FIELD_FILE, file);
|
83 |
} |
84 |
|
85 |
public void setFile(String file) { |
86 |
this.setDynValue(FIELD_FILE, file);
|
87 |
} |
88 |
|
89 |
public EditableFeatureType getDefaultFeatureType() {
|
90 |
return null; //TODO ???? |
91 |
} |
92 |
|
93 |
public void setDefaultFeatureType(FeatureType defaultFeatureType) { |
94 |
throw new UnsupportedOperationException(); |
95 |
} |
96 |
|
97 |
protected DelegatedDynObject getDelegatedDynObject() {
|
98 |
return parameters;
|
99 |
} |
100 |
} |