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