svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.arcims.feature.extension / src / main / java / org / gvsig / fmap / dal / store / arcims / ArcImsStoreParameters.java @ 32356
History | View | Annotate | Download (13.4 KB)
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 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2010 Prodevelop S.L. main development
|
26 |
* http://www.prodevelop.es
|
27 |
*/
|
28 |
|
29 |
package org.gvsig.fmap.dal.store.arcims; |
30 |
|
31 |
import org.gvsig.fmap.dal.DataParameters; |
32 |
import org.gvsig.fmap.dal.DataStoreParameters; |
33 |
import org.gvsig.fmap.dal.DataTypes; |
34 |
import org.gvsig.fmap.dal.exception.InitializeException; |
35 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
36 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
37 |
import org.gvsig.fmap.geom.Geometry; |
38 |
import org.gvsig.tools.ToolsLocator; |
39 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
40 |
import org.gvsig.tools.dynobject.DynClass; |
41 |
import org.gvsig.tools.dynobject.DynField; |
42 |
import org.gvsig.tools.dynobject.DynObjectManager; |
43 |
|
44 |
/**
|
45 |
* vsanjaime
|
46 |
*/
|
47 |
public class ArcImsStoreParameters extends AbstractDataParameters implements |
48 |
DataStoreParameters{ |
49 |
protected static DynClass DYNCLASS = null; |
50 |
public static final String DYNCLASS_NAME = "ArcIMSStoreParameters"; |
51 |
|
52 |
public static final String DYNFIELDNAME_URL = "url"; |
53 |
public static final String DYNFIELDNAME_VERSION = "version"; |
54 |
public static final String DYNFIELDNAME_TYPENAME = "typeName"; |
55 |
public static final String DYNFIELDNAME_NAMESPACE = "namespace"; |
56 |
public static final String DYNFIELDNAME_NAMESPACEPREFIX = "namespacePrefix"; |
57 |
public static final String DYNFIELDNAME_FIELDS = "fields"; |
58 |
public static final String DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE = "filterEncodingByAttribute"; |
59 |
public static final String DYNFIELDNAME_MAXFEATURES = "maxFeatures"; |
60 |
public static final String DYNFIELDNAME_TIMEOUT = "timeOut"; |
61 |
public static final String DYNFIELDNAME_USER = "user"; |
62 |
public static final String DYNFIELDNAME_PASSWORD = "password"; |
63 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY = "filterByAreaGeometry"; |
64 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_OPERATION = "filterByAreaOperation"; |
65 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE = "filterByAreaAttribute"; |
66 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_CRS = "filterByAreaCrs"; |
67 |
|
68 |
private DelegatedDynObject delegatedDynObject;
|
69 |
|
70 |
/**
|
71 |
* Constructor
|
72 |
*/
|
73 |
public ArcImsStoreParameters() {
|
74 |
super();
|
75 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
|
76 |
.getDynObjectManager().createDynObject( |
77 |
ArcImsStoreParameters.DYNCLASS); |
78 |
} |
79 |
|
80 |
@Override
|
81 |
protected DelegatedDynObject getDelegatedDynObject() {
|
82 |
return delegatedDynObject;
|
83 |
} |
84 |
|
85 |
public ArcImsStoreParameters(DataParameters dataParameters) throws InitializeException, ProviderNotRegisteredException{ |
86 |
this();
|
87 |
setUrl((String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_URL));
|
88 |
String namespace = null; |
89 |
String namespacePrefix = null; |
90 |
if (dataParameters.hasDynValue(ArcImsStoreParameters.DYNFIELDNAME_NAMESPACE)){
|
91 |
namespace = (String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_NAMESPACE);
|
92 |
} |
93 |
if (dataParameters.hasDynValue(ArcImsStoreParameters.DYNFIELDNAME_NAMESPACEPREFIX)){
|
94 |
namespacePrefix = (String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_NAMESPACEPREFIX);
|
95 |
} |
96 |
setFeatureType(namespacePrefix, namespace, |
97 |
(String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_TYPENAME));
|
98 |
if (dataParameters.hasDynValue(ArcImsStoreParameters.DYNFIELDNAME_MAXFEATURES)){
|
99 |
setMaxFeatures((Integer)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_MAXFEATURES));
|
100 |
}else{
|
101 |
setMaxFeatures(1000);
|
102 |
} |
103 |
if (dataParameters.hasDynValue(ArcImsStoreParameters.DYNFIELDNAME_TIMEOUT)){
|
104 |
setTimeOut((Integer)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_TIMEOUT));
|
105 |
}else{
|
106 |
setTimeOut(10000);
|
107 |
} |
108 |
if (dataParameters.hasDynValue(ArcImsStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY)){
|
109 |
setFilterByAreaGeometry((Geometry)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY)); |
110 |
setFilterByAreaAttribute((String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE));
|
111 |
setFilterByAreaCrs((String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_CRS));
|
112 |
setFilterByAreaOperation((Integer)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_OPERATION));
|
113 |
} |
114 |
if (dataParameters.hasDynValue(ArcImsStoreParameters.DYNFIELDNAME_VERSION)){
|
115 |
setVersion((String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_VERSION));
|
116 |
} |
117 |
if (dataParameters.hasDynValue(ArcImsStoreParameters.DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE)){
|
118 |
setFilterEncodingByAttribute((String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE));
|
119 |
} |
120 |
if (dataParameters.hasDynValue(ArcImsStoreParameters.DYNFIELDNAME_USER)){
|
121 |
setUser((String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_USER));
|
122 |
} |
123 |
if (dataParameters.hasDynValue(ArcImsStoreParameters.DYNFIELDNAME_PASSWORD)){
|
124 |
setPassword((String)dataParameters.getDynValue(ArcImsStoreParameters.DYNFIELDNAME_PASSWORD));
|
125 |
} |
126 |
} |
127 |
|
128 |
protected static void registerDynClass() { |
129 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
130 |
DynClass dynClass; |
131 |
DynField field; |
132 |
if (DYNCLASS == null) { |
133 |
dynClass = dynman.add(DYNCLASS_NAME); |
134 |
field = dynClass.addDynField(DYNFIELDNAME_URL); |
135 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
136 |
field.setDescription("URL of the WFS server");
|
137 |
field.setType(DataTypes.STRING); |
138 |
field.setMandatory(true);
|
139 |
|
140 |
field = dynClass.addDynField(DYNFIELDNAME_VERSION); |
141 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
142 |
field.setDescription("Version of the WFS server");
|
143 |
field.setType(DataTypes.STRING); |
144 |
field.setMandatory(false);
|
145 |
|
146 |
field = dynClass.addDynField(DYNFIELDNAME_TYPENAME); |
147 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
148 |
field.setDescription("Feature type to retrieve");
|
149 |
field.setType(DataTypes.STRING); |
150 |
field.setMandatory(true);
|
151 |
|
152 |
field = dynClass.addDynField(DYNFIELDNAME_NAMESPACE); |
153 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
154 |
field.setDescription("Namespace of the feature type to retrieve");
|
155 |
field.setType(DataTypes.STRING); |
156 |
field.setMandatory(false);
|
157 |
|
158 |
field = dynClass.addDynField(DYNFIELDNAME_NAMESPACEPREFIX); |
159 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
160 |
field.setDescription("Prefix of the namespace of the feature type to retrieve");
|
161 |
field.setType(DataTypes.STRING); |
162 |
field.setMandatory(false);
|
163 |
|
164 |
field = dynClass.addDynField(DYNFIELDNAME_FIELDS); |
165 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
166 |
field.setDescription("Fields to retrieve separated by ','");
|
167 |
field.setType(DataTypes.STRING); |
168 |
field.setMandatory(false);
|
169 |
|
170 |
field = dynClass.addDynField(DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE); |
171 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
172 |
field.setDescription("Filter encoding request");
|
173 |
field.setType(DataTypes.STRING); |
174 |
field.setMandatory(false);
|
175 |
|
176 |
field = dynClass.addDynField(DYNFIELDNAME_MAXFEATURES); |
177 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
178 |
field.setDescription("Number of features to retrieve");
|
179 |
field.setType(DataTypes.INT); |
180 |
field.setMandatory(false);
|
181 |
|
182 |
field = dynClass.addDynField(DYNFIELDNAME_TIMEOUT); |
183 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
184 |
field.setDescription("Timeout");
|
185 |
field.setType(DataTypes.INT); |
186 |
field.setMandatory(false);
|
187 |
|
188 |
field = dynClass.addDynField(DYNFIELDNAME_USER); |
189 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
190 |
field.setDescription("User name (not used at this moment)");
|
191 |
field.setType(DataTypes.STRING); |
192 |
field.setMandatory(false);
|
193 |
|
194 |
field = dynClass.addDynField(DYNFIELDNAME_PASSWORD); |
195 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
196 |
field.setDescription("Passwrod (not used at this moment");
|
197 |
field.setType(DataTypes.STRING); |
198 |
field.setMandatory(false);
|
199 |
|
200 |
field = dynClass.addDynField(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY); |
201 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
202 |
field.setDescription("Geometry used to do the filter");
|
203 |
field.setType(DataTypes.GEOMETRY); |
204 |
field.setMandatory(false);
|
205 |
|
206 |
field = dynClass.addDynField(DYNFIELDNAME_FILTER_BY_AREA_OPERATION); |
207 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
208 |
field.setDescription("Geometry operation used to do the filter");
|
209 |
field.setType(DataTypes.INT); |
210 |
field.setMandatory(false);
|
211 |
|
212 |
field = dynClass.addDynField(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE); |
213 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
214 |
field.setDescription("Attribute that contains the geometry");
|
215 |
field.setType(DataTypes.STRING); |
216 |
field.setMandatory(false);
|
217 |
|
218 |
field = dynClass.addDynField(DYNFIELDNAME_FILTER_BY_AREA_CRS); |
219 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
220 |
field.setDescription("CRS to do the query");
|
221 |
field.setType(DataTypes.STRING); |
222 |
field.setMandatory(false);
|
223 |
|
224 |
DYNCLASS = dynClass; |
225 |
} |
226 |
} |
227 |
|
228 |
/* (non-Javadoc)
|
229 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName()
|
230 |
*/
|
231 |
public String getDataStoreName() { |
232 |
return ArcImsStoreProvider.NAME;
|
233 |
} |
234 |
|
235 |
/* (non-Javadoc)
|
236 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDescription()
|
237 |
*/
|
238 |
public String getDescription() { |
239 |
return ArcImsStoreProvider.DESCRIPTION;
|
240 |
} |
241 |
|
242 |
/* (non-Javadoc)
|
243 |
* @see org.gvsig.fmap.dal.DataStoreParameters#isValid()
|
244 |
*/
|
245 |
public boolean isValid() { |
246 |
// TODO Auto-generated method stub
|
247 |
return false; |
248 |
} |
249 |
|
250 |
public String getUrl(){ |
251 |
return (String) this.getDynValue(DYNFIELDNAME_URL); |
252 |
} |
253 |
|
254 |
public void setUrl(String url){ |
255 |
this.setDynValue(DYNFIELDNAME_URL, url);
|
256 |
} |
257 |
|
258 |
public String getVersion(){ |
259 |
return (String) this.getDynValue(DYNFIELDNAME_VERSION); |
260 |
} |
261 |
|
262 |
public void setVersion(String version){ |
263 |
this.setDynValue(DYNFIELDNAME_VERSION, version);
|
264 |
} |
265 |
|
266 |
public String getFeatureType(){ |
267 |
return (String) this.getDynValue(DYNFIELDNAME_TYPENAME); |
268 |
} |
269 |
|
270 |
public void setFeatureType(String featureType){ |
271 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType);
|
272 |
} |
273 |
|
274 |
public void setFeatureType(String namespace, String featureType){ |
275 |
this.setDynValue(DYNFIELDNAME_NAMESPACE, namespace);
|
276 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType);
|
277 |
} |
278 |
|
279 |
public void setFeatureType(String prefix, String namespace, String featureType){ |
280 |
this.setDynValue(DYNFIELDNAME_NAMESPACEPREFIX, prefix);
|
281 |
this.setDynValue(DYNFIELDNAME_NAMESPACE, namespace);
|
282 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType);
|
283 |
} |
284 |
|
285 |
public String getFeatureNamespace(){ |
286 |
return (String) this.getDynValue(DYNFIELDNAME_NAMESPACE); |
287 |
} |
288 |
|
289 |
public String getFeaturePrefix(){ |
290 |
return (String) this.getDynValue(DYNFIELDNAME_NAMESPACEPREFIX); |
291 |
} |
292 |
|
293 |
public String getFields(){ |
294 |
return (String) this.getDynValue(DYNFIELDNAME_FIELDS); |
295 |
} |
296 |
|
297 |
public void setFields(String fields){ |
298 |
this.setDynValue(DYNFIELDNAME_FIELDS, fields);
|
299 |
} |
300 |
|
301 |
public String getFilterEncodingByAttribute(){ |
302 |
return (String) this.getDynValue(DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE); |
303 |
} |
304 |
|
305 |
public void setFilterEncodingByAttribute(String filter){ |
306 |
this.setDynValue(DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE, filter);
|
307 |
} |
308 |
|
309 |
public Integer getMaxFeatures(){ |
310 |
return (Integer) this.getDynValue(DYNFIELDNAME_MAXFEATURES); |
311 |
} |
312 |
|
313 |
public void setMaxFeatures(Integer maxFeatures){ |
314 |
this.setDynValue(DYNFIELDNAME_MAXFEATURES, maxFeatures);
|
315 |
} |
316 |
|
317 |
public Integer getTimeOut(){ |
318 |
return (Integer) this.getDynValue(DYNFIELDNAME_TIMEOUT); |
319 |
} |
320 |
|
321 |
public void setTimeOut(Integer timeOut){ |
322 |
this.setDynValue(DYNFIELDNAME_TIMEOUT, timeOut);
|
323 |
} |
324 |
|
325 |
public String getUser(){ |
326 |
return (String) this.getDynValue(DYNFIELDNAME_USER); |
327 |
} |
328 |
|
329 |
public void setUser(String user){ |
330 |
this.setDynValue(DYNFIELDNAME_USER, user);
|
331 |
} |
332 |
|
333 |
public String getPassword(){ |
334 |
return (String) this.getDynValue(DYNFIELDNAME_PASSWORD); |
335 |
} |
336 |
|
337 |
public void setPassword(String password){ |
338 |
this.setDynValue(DYNFIELDNAME_PASSWORD, password);
|
339 |
} |
340 |
|
341 |
public Geometry getFilterByAreaGeometry(){
|
342 |
return (Geometry) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY); |
343 |
} |
344 |
|
345 |
public void setFilterByAreaGeometry(Geometry area){ |
346 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY, area);
|
347 |
} |
348 |
|
349 |
public Integer getFilterByAreaOperation(){ |
350 |
return (Integer) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION); |
351 |
} |
352 |
|
353 |
public void setFilterByAreaOperation(Integer operation){ |
354 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION, operation);
|
355 |
} |
356 |
|
357 |
public String getFilterByAreaCrs(){ |
358 |
return (String) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS); |
359 |
} |
360 |
|
361 |
public void setFilterByAreaCrs(String crs){ |
362 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS, crs);
|
363 |
} |
364 |
|
365 |
public String getFilterByAreaAttribute(){ |
366 |
return (String) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE); |
367 |
} |
368 |
|
369 |
public void setFilterByAreaAttribute(String attribute){ |
370 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE, attribute);
|
371 |
} |
372 |
} |
373 |
|