Revision 34026 branches/v2_0_0_prep/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/GPEStoreParameters.java
GPEStoreParameters.java | ||
---|---|---|
1 | 1 |
/* gvSIG. Geographic Information System of the Valencian Government |
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
2 |
*
|
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
|
4 |
* of the Valencian Government (CIT)
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or
|
|
7 |
* modify it under the terms of the GNU General Public License
|
|
8 |
* as published by the Free Software Foundation; either version 2
|
|
9 |
* of the License, or (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
19 |
* MA 02110-1301, USA.
|
|
20 |
*
|
|
21 |
*/
|
|
22 | 22 |
|
23 | 23 |
/* |
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
24 |
* AUTHORS (In addition to CIT):
|
|
25 |
* 2009 {Iver T.I.} {Task}
|
|
26 |
*/
|
|
27 |
|
|
28 | 28 |
package org.gvsig.fmap.dal.store.gpe; |
29 | 29 |
|
30 | 30 |
import java.io.File; |
31 | 31 |
|
32 | 32 |
import org.cresques.cts.IProjection; |
33 |
|
|
33 | 34 |
import org.gvsig.fmap.dal.DataStoreParameters; |
34 | 35 |
import org.gvsig.fmap.dal.FileHelper; |
35 | 36 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
36 | 37 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
37 | 38 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
39 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
38 | 40 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
39 | 41 |
|
40 | 42 |
/** |
... | ... | |
42 | 44 |
*/ |
43 | 45 |
public class GPEStoreParameters extends AbstractDataParameters implements |
44 | 46 |
DataStoreParameters, FilesystemStoreParameters { |
45 |
|
|
46 |
public static final String PARAMETERS_DEFINITION_NAME = "GPEStoreParameters"; |
|
47 | 47 |
|
48 |
private static final String FILE_PARAMETER_NAME = "File"; |
|
49 |
private static final String CRS_PARAMETER_NAME = "CRS"; |
|
48 |
public static final String PARAMETERS_DEFINITION_NAME = "GPEStoreParameters"; |
|
50 | 49 |
|
51 |
private DelegatedDynObject parameters; |
|
52 |
|
|
53 |
public GPEStoreParameters() { |
|
54 |
this(PARAMETERS_DEFINITION_NAME); |
|
55 |
} |
|
50 |
private static final String FILE_PARAMETER_NAME = "File"; |
|
51 |
private static final String CRS_PARAMETER_NAME = "CRS"; |
|
52 |
private static final String ENVELOPE_PARAMETER_NAME = "Envelope"; |
|
56 | 53 |
|
57 |
protected GPEStoreParameters(String parametersDefinitionName) { |
|
58 |
this(parametersDefinitionName, GPEStoreProvider.NAME); |
|
59 |
} |
|
54 |
private DelegatedDynObject parameters; |
|
60 | 55 |
|
61 |
public GPEStoreParameters(String parametersDefinitionName, String name) { |
|
62 |
super(); |
|
63 |
this.parameters = (DelegatedDynObject) FileHelper |
|
64 |
.newParameters(parametersDefinitionName); |
|
65 |
this |
|
66 |
.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, |
|
67 |
name); |
|
68 |
} |
|
69 |
|
|
70 |
protected DelegatedDynObject getDelegatedDynObject() { |
|
71 |
return parameters; |
|
72 |
} |
|
56 |
public GPEStoreParameters() { |
|
57 |
this(PARAMETERS_DEFINITION_NAME); |
|
58 |
} |
|
73 | 59 |
|
74 |
public String getDataStoreName() {
|
|
75 |
return GPEStoreProvider.NAME;
|
|
76 |
}
|
|
60 |
protected GPEStoreParameters(String parametersDefinitionName) {
|
|
61 |
this(parametersDefinitionName, GPEStoreProvider.NAME);
|
|
62 |
}
|
|
77 | 63 |
|
78 |
public String getDescription() { |
|
79 |
return GPEStoreProvider.DESCRIPTION; |
|
80 |
} |
|
64 |
public GPEStoreParameters(String parametersDefinitionName, String name) { |
|
65 |
super(); |
|
66 |
this.parameters = (DelegatedDynObject) FileHelper.newParameters(parametersDefinitionName); |
|
67 |
//TODO review this parameters |
|
68 |
this.parameters.getDynClass().addDynFieldObject(ENVELOPE_PARAMETER_NAME).setClassOfValue(Envelope.class).setMandatory(false); |
|
69 |
this.parameters.getDynClass().addDynField(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
|
70 |
} |
|
81 | 71 |
|
82 |
public boolean isValid() {
|
|
83 |
return (this.getFile() != null);
|
|
84 |
}
|
|
72 |
protected DelegatedDynObject getDelegatedDynObject() {
|
|
73 |
return parameters;
|
|
74 |
}
|
|
85 | 75 |
|
86 |
public File getFile() {
|
|
87 |
return (File) this.getDynValue(FILE_PARAMETER_NAME);
|
|
88 |
}
|
|
76 |
public String getDataStoreName() {
|
|
77 |
return GPEStoreProvider.NAME;
|
|
78 |
}
|
|
89 | 79 |
|
90 |
public void setFile(File file) { |
|
91 |
this.setDynValue(FILE_PARAMETER_NAME, file); |
|
92 |
} |
|
93 |
|
|
94 |
public String getFileName() { |
|
95 |
return this.getFile().getAbsolutePath(); |
|
96 |
} |
|
97 |
|
|
98 |
public void setFileName(String fileName) { |
|
99 |
this.setDynValue(FILE_PARAMETER_NAME, fileName); |
|
100 |
} |
|
101 |
|
|
102 |
public IProjection getCRS() { |
|
103 |
return (IProjection) this.getDynValue(CRS_PARAMETER_NAME); |
|
104 |
} |
|
105 |
|
|
106 |
public void setCRS(IProjection srs) { |
|
107 |
this.setDynValue(CRS_PARAMETER_NAME, srs); |
|
108 |
} |
|
109 |
|
|
110 |
public void setCRS(String srs) { |
|
111 |
this.setDynValue(CRS_PARAMETER_NAME, srs); |
|
112 |
} |
|
80 |
public String getDescription() { |
|
81 |
return GPEStoreProvider.DESCRIPTION; |
|
82 |
} |
|
113 | 83 |
|
114 |
} |
|
84 |
public boolean isValid() { |
|
85 |
return (this.getFile() != null); |
|
86 |
} |
|
87 |
|
|
88 |
public File getFile() { |
|
89 |
return (File) this.getDynValue(FILE_PARAMETER_NAME); |
|
90 |
} |
|
91 |
|
|
92 |
public void setFile(File file) { |
|
93 |
this.setDynValue(FILE_PARAMETER_NAME, file); |
|
94 |
} |
|
95 |
|
|
96 |
public String getFileName() { |
|
97 |
return this.getFile().getAbsolutePath(); |
|
98 |
} |
|
99 |
|
|
100 |
public void setFileName(String fileName) { |
|
101 |
this.setDynValue(FILE_PARAMETER_NAME, fileName); |
|
102 |
} |
|
103 |
|
|
104 |
public IProjection getCRS() { |
|
105 |
return (IProjection) this.getDynValue(CRS_PARAMETER_NAME); |
|
106 |
} |
|
107 |
|
|
108 |
public void setCRS(IProjection srs) { |
|
109 |
this.setDynValue(CRS_PARAMETER_NAME, srs); |
|
110 |
} |
|
111 |
|
|
112 |
public void setCRS(String srs) { |
|
113 |
this.setDynValue(CRS_PARAMETER_NAME, srs); |
|
114 |
} |
|
115 |
|
|
116 |
public Envelope getEnvelope() { |
|
117 |
return (Envelope) this.getDynValue(ENVELOPE_PARAMETER_NAME); |
|
118 |
} |
|
119 |
|
|
120 |
public void setEnvelope(Envelope envelope) { |
|
121 |
this.setDynValue(ENVELOPE_PARAMETER_NAME, envelope); |
|
122 |
} |
|
123 |
} |
Also available in: Unified diff