root / branches / v2_0_0_prep / libraries / libFMap_dalfile / src / org / gvsig / fmap / dal / store / dgn / DGNStoreParameters.java @ 32880
History | View | Annotate | Download (3.02 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.FeatureType; |
9 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
10 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
11 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
12 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
13 |
import org.gvsig.tools.ToolsLocator; |
14 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
15 |
import org.gvsig.tools.persistence.PersistenceManager; |
16 |
|
17 |
public class DGNStoreParameters extends AbstractDataParameters implements |
18 |
DataStoreParameters, FilesystemStoreParameters, |
19 |
NewFeatureStoreParameters { |
20 |
|
21 |
public static final String PARAMETERS_DEFINITION_NAME = "DGNStoreParameters"; |
22 |
|
23 |
private static final String FIELD_FILE = "file"; |
24 |
private static final String FIELD_CRS = "CRS"; |
25 |
|
26 |
private DelegatedDynObject parameters;
|
27 |
|
28 |
|
29 |
public DGNStoreParameters() {
|
30 |
this(PARAMETERS_DEFINITION_NAME);
|
31 |
} |
32 |
|
33 |
protected DGNStoreParameters(String parametersDefinitionName) { |
34 |
this(parametersDefinitionName, DGNStoreProvider.NAME);
|
35 |
} |
36 |
|
37 |
public DGNStoreParameters(String parametersDefinitionName, String name) { |
38 |
super();
|
39 |
this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName);
|
40 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name);
|
41 |
} |
42 |
|
43 |
public String getDataStoreName() { |
44 |
return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
45 |
} |
46 |
|
47 |
public String getDescription() { |
48 |
return this.getDynClass().getDescription(); |
49 |
} |
50 |
|
51 |
|
52 |
public void setCRS(IProjection srs) { |
53 |
setDynValue(FIELD_CRS, srs); |
54 |
} |
55 |
|
56 |
public void setCRS(String srs) { |
57 |
setDynValue(FIELD_CRS, srs); |
58 |
} |
59 |
|
60 |
public IProjection getCRS() {
|
61 |
return (IProjection) getDynValue(FIELD_CRS);
|
62 |
} |
63 |
|
64 |
public String getFileName() { |
65 |
return this.getFile().getPath(); |
66 |
} |
67 |
|
68 |
public boolean isValid() { |
69 |
if (getCRS() == null ) { |
70 |
return false; |
71 |
} |
72 |
if (getFile() == null) { |
73 |
return false; |
74 |
} |
75 |
return true; |
76 |
} |
77 |
|
78 |
public File getFile() { |
79 |
return (File) this.getDynValue(FIELD_FILE); |
80 |
} |
81 |
|
82 |
public void setFile(File file) { |
83 |
this.setDynValue(FIELD_FILE, file);
|
84 |
} |
85 |
|
86 |
public void setFile(String file) { |
87 |
this.setDynValue(FIELD_FILE, file);
|
88 |
} |
89 |
|
90 |
public FeatureType getDefaultFeatureType() {
|
91 |
return null; //TODO ???? |
92 |
} |
93 |
|
94 |
public void setDefaultFeatureType(FeatureType defaultFeatureType) { |
95 |
throw new UnsupportedOperationException(); |
96 |
} |
97 |
|
98 |
protected static void registerParametersDefinition() { |
99 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
100 |
if( manager.getDefinition(PARAMETERS_DEFINITION_NAME) == null ) { |
101 |
manager.addDefinition( |
102 |
DGNStoreParameters.class, |
103 |
PARAMETERS_DEFINITION_NAME, |
104 |
DGNStoreParameters.class.getResourceAsStream("DGNStoreParameters.xml"),
|
105 |
DGNStoreParameters.class.getClassLoader(), |
106 |
null,
|
107 |
null
|
108 |
); |
109 |
} |
110 |
} |
111 |
|
112 |
protected DelegatedDynObject getDelegatedDynObject() {
|
113 |
return parameters;
|
114 |
} |
115 |
} |