svn-gvsig-desktop / import / extWFS2 / src / com / iver / cit / gvsig / fmap / drivers / wfs / FMapWFSDriver.java @ 18320
History | View | Annotate | Download (18.5 KB)
1 |
package com.iver.cit.gvsig.fmap.drivers.wfs; |
---|---|
2 |
|
3 |
import java.awt.geom.Rectangle2D; |
4 |
import java.io.File; |
5 |
import java.io.IOException; |
6 |
import java.net.ConnectException; |
7 |
import java.net.URL; |
8 |
import java.text.Collator; |
9 |
import java.util.ArrayList; |
10 |
import java.util.Collections; |
11 |
import java.util.Hashtable; |
12 |
import java.util.Iterator; |
13 |
import java.util.Locale; |
14 |
|
15 |
import org.apache.log4j.Logger; |
16 |
import org.gvsig.remoteClient.wfs.WFSClient; |
17 |
import org.gvsig.remoteClient.wfs.WFSFeature; |
18 |
import org.gvsig.remoteClient.wfs.WFSOperation; |
19 |
import org.gvsig.remoteClient.wfs.WFSServiceInformation; |
20 |
import org.gvsig.remoteClient.wfs.WFSStatus; |
21 |
import org.gvsig.remoteClient.wfs.exceptions.WFSException; |
22 |
import org.gvsig.remoteClient.wms.ICancellable; |
23 |
|
24 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
25 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
26 |
import com.hardcode.gdbms.engine.data.edition.DataWare; |
27 |
import com.hardcode.gdbms.engine.values.Value; |
28 |
import com.iver.cit.gvsig.fmap.DriverException; |
29 |
import com.iver.cit.gvsig.fmap.core.FShape; |
30 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
31 |
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes; |
32 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
33 |
import com.iver.cit.gvsig.fmap.drivers.UnsupportedVersionException; |
34 |
import com.iver.cit.gvsig.fmap.drivers.WFSDriver; |
35 |
import com.iver.cit.gvsig.fmap.drivers.WFSDriverException; |
36 |
import com.iver.cit.gvsig.fmap.drivers.gml.GMLDriver; |
37 |
import com.iver.cit.gvsig.fmap.drivers.gml.IGMLDriver; |
38 |
import com.iver.cit.gvsig.fmap.edition.IWriteable; |
39 |
import com.iver.cit.gvsig.fmap.edition.IWriter; |
40 |
import com.iver.cit.gvsig.fmap.edition.wfs.FmapWFSWriter; |
41 |
import com.iver.cit.gvsig.fmap.edition.wfs.WFSTLockFeaturesException; |
42 |
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
43 |
import com.iver.utiles.StringComparator; |
44 |
import com.iver.utiles.StringComparator.LocaleRules; |
45 |
import com.iver.utiles.extensionPoints.ExtensionPoint; |
46 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
47 |
|
48 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
49 |
*
|
50 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
51 |
*
|
52 |
* This program is free software; you can redistribute it and/or
|
53 |
* modify it under the terms of the GNU General Public License
|
54 |
* as published by the Free Software Foundation; either version 2
|
55 |
* of the License, or (at your option) any later version.
|
56 |
*
|
57 |
* This program is distributed in the hope that it will be useful,
|
58 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
59 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
60 |
* GNU General Public License for more details.
|
61 |
*
|
62 |
* You should have received a copy of the GNU General Public License
|
63 |
* along with this program; if not, write to the Free Software
|
64 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
65 |
*
|
66 |
* For more information, contact:
|
67 |
*
|
68 |
* Generalitat Valenciana
|
69 |
* Conselleria d'Infraestructures i Transport
|
70 |
* Av. Blasco Ib??ez, 50
|
71 |
* 46010 VALENCIA
|
72 |
* SPAIN
|
73 |
*
|
74 |
* +34 963862235
|
75 |
* gvsig@gva.es
|
76 |
* www.gvsig.gva.es
|
77 |
*
|
78 |
* or
|
79 |
*
|
80 |
* IVER T.I. S.A
|
81 |
* Salamanca 50
|
82 |
* 46005 Valencia
|
83 |
* Spain
|
84 |
*
|
85 |
* +34 963163400
|
86 |
* dac@iver.es
|
87 |
*/
|
88 |
/* CVS MESSAGES:
|
89 |
*
|
90 |
* $Id: FMapWFSDriver.java 18320 2008-01-25 13:16:03Z jpiera $
|
91 |
* $Log$
|
92 |
* Revision 1.18.2.5 2006-11-17 11:28:45 ppiqueras
|
93 |
* Corregidos bugs y a?adida nueva funcionalidad.
|
94 |
*
|
95 |
* Revision 1.22 2006/11/16 13:31:10 jorpiell
|
96 |
* Se ha eliminado la visivilidad del constructor
|
97 |
*
|
98 |
* Revision 1.21 2006/11/15 17:38:08 jorpiell
|
99 |
* Ya se puede guardar una capa en WFS.
|
100 |
*
|
101 |
* Revision 1.20 2006/09/25 10:23:03 caballero
|
102 |
* no multiType
|
103 |
*
|
104 |
* Revision 1.19 2006/09/18 12:07:31 jorpiell
|
105 |
* Se ha sustituido geotools por el driver de remoteservices
|
106 |
*
|
107 |
* Revision 1.18 2006/07/24 08:27:35 jorpiell
|
108 |
* Implementado el m?todo getFieldType que permite la exportaci?n a los diferentes tipos de ficheros (como shp,....)
|
109 |
*
|
110 |
* Revision 1.17 2006/07/21 10:02:43 caballero
|
111 |
* soluci?n provisional a WFS
|
112 |
*
|
113 |
* Revision 1.16 2006/07/12 11:55:22 jmvivo
|
114 |
* *** empty log message ***
|
115 |
*
|
116 |
* Revision 1.15 2006/07/12 10:58:10 jmvivo
|
117 |
* A?adido el metodo 'reload' del ObjectDriver (falta implementar)
|
118 |
*
|
119 |
* Revision 1.14 2006/07/11 11:55:41 jorpiell
|
120 |
* Se ha a?adido el fallo de tipo de dato en el log
|
121 |
*
|
122 |
* Revision 1.13 2006/06/15 10:34:12 jorpiell
|
123 |
* Ya se pueden ver los atributos de las tablas
|
124 |
*
|
125 |
* Revision 1.12 2006/06/15 07:50:58 jorpiell
|
126 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz
|
127 |
*
|
128 |
* Revision 1.11 2006/06/14 08:46:24 jorpiell
|
129 |
* Se tiene en cuanta la opcion para refrescar las capabilities
|
130 |
*
|
131 |
* Revision 1.10 2006/06/14 07:57:19 jorpiell
|
132 |
* Ya no se usa la estrategia ni se usa geotools para hacer el getFeature. Ahora se usa ?nicamente para el parseo de GML
|
133 |
*
|
134 |
* Revision 1.9 2006/06/05 16:49:42 caballero
|
135 |
* poder editar y exportar
|
136 |
*
|
137 |
* Revision 1.8 2006/05/30 05:26:38 jorpiell
|
138 |
* isWritable ha sido a?adido a la interfaz, y hay que implementarlo
|
139 |
*
|
140 |
* Revision 1.7 2006/05/25 10:32:11 jorpiell
|
141 |
* Se ha renombrado la clase WFSFields por WFSAttributes porque era algo confusa
|
142 |
*
|
143 |
* Revision 1.6 2006/05/23 13:21:28 jorpiell
|
144 |
* Se tiene en cuanta el online resource
|
145 |
*
|
146 |
* Revision 1.5 2006/05/22 10:31:35 jorpiell
|
147 |
* Cambio producido al cambiar una interfaz del geotools driver
|
148 |
*
|
149 |
* Revision 1.4 2006/05/22 10:11:10 jorpiell
|
150 |
* Eliminadas algunas lineas innecesarias
|
151 |
*
|
152 |
* Revision 1.3 2006/05/19 12:53:54 jorpiell
|
153 |
* Se le ha a?adido un driver de geottols, por lo que tiene dos drivers. Para hacer el getFeatureInfo y el capablities utilizar? elremoteServices y para hacer el getFeature usar? el de geotools.
|
154 |
*
|
155 |
* Revision 1.2 2006/04/20 16:38:24 jorpiell
|
156 |
* Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
|
157 |
*
|
158 |
* Revision 1.1 2006/04/19 12:50:16 jorpiell
|
159 |
* Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
|
160 |
*
|
161 |
*
|
162 |
*/
|
163 |
/**
|
164 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
165 |
*/
|
166 |
public class FMapWFSDriver implements WFSDriver, BoundedShapes,ObjectDriver,IWriteable{ |
167 |
private WFSClient remoteServicesClient;
|
168 |
private WFSLayerNode[] featuresList; |
169 |
private Hashtable hashFeatures; |
170 |
private DriverAttributes attr = new DriverAttributes(); |
171 |
private IGMLDriver driver = null; |
172 |
private boolean hasGeometry = false; |
173 |
//The GML driver to use
|
174 |
private static Class gmlDriverClass = null; |
175 |
//WFSTDriver
|
176 |
private FmapWFSWriter writer = null; |
177 |
private WFSStatus status = null; |
178 |
private boolean isWfstEditing = false; |
179 |
private boolean isWfstGeometriesUpdated = true; |
180 |
|
181 |
FMapWFSDriver() { |
182 |
super();
|
183 |
} |
184 |
|
185 |
//Method used to register the GML parser
|
186 |
public static void registerGmlDriver(Class clazz){ |
187 |
gmlDriverClass = clazz; |
188 |
} |
189 |
|
190 |
/*
|
191 |
* (non-Javadoc)
|
192 |
* @see com.iver.cit.gvsig.fmap.drivers.WFSDriver#getCapabilities(java.net.URL)
|
193 |
*/
|
194 |
public void getCapabilities(URL server) |
195 |
throws WFSDriverException {
|
196 |
try {
|
197 |
getClient(server).connect(null);
|
198 |
} catch (Exception e) { |
199 |
throw new WFSDriverException(e); |
200 |
} |
201 |
} |
202 |
|
203 |
/*
|
204 |
* (non-Javadoc)
|
205 |
* @see com.iver.cit.gvsig.fmap.drivers.WFSDriver#describeFeatureType(java.lang.String)
|
206 |
*/
|
207 |
public void describeFeatureType(String featureType,String nameSpace) throws WFSException { |
208 |
status = new WFSStatus(featureType,nameSpace);
|
209 |
remoteServicesClient.describeFeatureType(status); |
210 |
} |
211 |
|
212 |
/*
|
213 |
* (non-Javadoc)
|
214 |
* @see com.iver.cit.gvsig.fmap.drivers.WFSDriver#getFeature(org.gvsig.remoteClient.wfs.WFSStatus)
|
215 |
*/
|
216 |
public void getFeature(WFSStatus wfsStatus) throws WFSException { |
217 |
//Retrieve the file
|
218 |
File file = remoteServicesClient.getFeature(wfsStatus);
|
219 |
try {
|
220 |
//Creates the driver
|
221 |
if (gmlDriverClass == null){ |
222 |
ExtensionPoint extensionPoint = (ExtensionPoint)ExtensionPointsSingleton.getInstance().get("FMAPWFSDriver");
|
223 |
if (extensionPoint != null){ |
224 |
driver = (IGMLDriver)extensionPoint.create("FMAPWFSDriver");
|
225 |
} |
226 |
} |
227 |
} catch (Exception e1) { |
228 |
driver = new GMLDriver();
|
229 |
} |
230 |
//Reads the GML file
|
231 |
try {
|
232 |
driver.open(file); |
233 |
driver.initialize(); |
234 |
hasGeometry = WFSUtils.getHasGeometry(featuresList,wfsStatus); |
235 |
} catch (Exception e) { |
236 |
Logger.getLogger(getClass().getName()).error(e.getMessage());
|
237 |
throw new WFSDriverException(e); |
238 |
} |
239 |
} |
240 |
|
241 |
/*
|
242 |
* (non-Javadoc)
|
243 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getShapeType()
|
244 |
*/
|
245 |
public int getShapeType() { |
246 |
//return driver.getShapeType();
|
247 |
try {
|
248 |
if (getShapeCount() > 0){ |
249 |
return getShapeType(0); |
250 |
} |
251 |
} catch (IOException e) { |
252 |
// TODO Auto-generated catch block
|
253 |
e.printStackTrace(); |
254 |
} |
255 |
return FShape.MULTI;
|
256 |
} |
257 |
|
258 |
/*
|
259 |
* (non-Javadoc)
|
260 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getShapeCount()
|
261 |
*/
|
262 |
public int getShapeCount() throws IOException { |
263 |
return driver.getShapeCount();
|
264 |
} |
265 |
|
266 |
/*
|
267 |
* (non-Javadoc)
|
268 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getDriverAttributes()
|
269 |
*/
|
270 |
public DriverAttributes getDriverAttributes() {
|
271 |
return attr;
|
272 |
} |
273 |
|
274 |
/*
|
275 |
* (non-Javadoc)
|
276 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getFullExtent()
|
277 |
*/
|
278 |
public Rectangle2D getFullExtent() throws IOException { |
279 |
return driver.getFullExtent();
|
280 |
} |
281 |
|
282 |
/*
|
283 |
* (non-Javadoc)
|
284 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getShape(int)
|
285 |
*/
|
286 |
public IGeometry getShape(int index) throws IOException { |
287 |
return driver.getShape(index);
|
288 |
} |
289 |
|
290 |
/*
|
291 |
* (non-Javadoc)
|
292 |
* @see com.hardcode.driverManager.Driver#getName()
|
293 |
*/
|
294 |
public String getName() { |
295 |
return "WFS Driver"; |
296 |
} |
297 |
|
298 |
|
299 |
|
300 |
/**
|
301 |
* Devuelve WFSClient a partir de su URL.
|
302 |
*
|
303 |
* @param url URL.
|
304 |
*
|
305 |
* @return WMSClient.
|
306 |
* @throws IOException
|
307 |
* @throws ConnectException
|
308 |
*
|
309 |
* @throws UnsupportedVersionException
|
310 |
* @throws IOException
|
311 |
*/
|
312 |
public WFSClient getClient(URL url) throws ConnectException, IOException { |
313 |
if (remoteServicesClient == null) { |
314 |
remoteServicesClient = new WFSClient(url.toString());
|
315 |
} |
316 |
return remoteServicesClient;
|
317 |
} |
318 |
|
319 |
/**
|
320 |
* Creates a new instance of a WFSClient.
|
321 |
* @param
|
322 |
* host
|
323 |
* @throws IOException
|
324 |
* @throws ConnectException
|
325 |
*/
|
326 |
public void createClient(URL host) throws ConnectException, IOException { |
327 |
remoteServicesClient = new WFSClient(host.toString());
|
328 |
} |
329 |
|
330 |
/**
|
331 |
* Establishes the connection to the WfS server. Connecting to a WFS is
|
332 |
* an abstraction.<br>
|
333 |
* <p>
|
334 |
* Actually, it sends a GetCapabilities request to read the necessary
|
335 |
* data for building further DescribeFeatureType requests.
|
336 |
* </p>
|
337 |
* @throws IOException, DriverException.
|
338 |
*/
|
339 |
public boolean connect(boolean override,ICancellable cancel) throws IOException, DriverException { |
340 |
return remoteServicesClient.connect(override,cancel);
|
341 |
} |
342 |
|
343 |
public boolean connect(ICancellable cancel) { |
344 |
return remoteServicesClient.connect(false, cancel); |
345 |
} |
346 |
|
347 |
/**
|
348 |
* Returns an array of WFSLayerNode's with the descriptors of
|
349 |
* all features (retrieved using the getCapabilities operation)
|
350 |
* @return WFSLayerNode[]
|
351 |
*/
|
352 |
public WFSLayerNode[] getLayerList(){ |
353 |
if (hashFeatures == null) { |
354 |
hashFeatures = new Hashtable(); |
355 |
Hashtable wfsFeatures = remoteServicesClient.getFeatures();
|
356 |
|
357 |
StringComparator stringComparator = new StringComparator();
|
358 |
// Set spanish rules and with case sensitive
|
359 |
Collator collator = Collator.getInstance(new Locale("es_ES")); |
360 |
stringComparator.setLocaleRules(stringComparator.new LocaleRules(true, collator));
|
361 |
stringComparator.setCaseSensitive(false);
|
362 |
|
363 |
ArrayList keysList = new ArrayList(wfsFeatures.keySet()); |
364 |
Collections.sort(keysList, stringComparator);
|
365 |
|
366 |
Iterator keys = keysList.iterator();
|
367 |
featuresList = new WFSLayerNode[wfsFeatures.size()];
|
368 |
|
369 |
for (int i=0 ; i<wfsFeatures.size() ; i++){ |
370 |
WFSLayerNode lyr = new WFSLayerNode();
|
371 |
WFSFeature feature = (WFSFeature)wfsFeatures.get(keys.next()); |
372 |
|
373 |
lyr.setName(feature.getName()); |
374 |
lyr.setTitle(feature.getTitle()); |
375 |
lyr.setAbstract(feature.getAbstract()); |
376 |
lyr.setFields(feature.getFields()); |
377 |
lyr.setSrs(feature.getSrs()); |
378 |
lyr.setLatLonBbox(feature.getLatLonBbox()); |
379 |
|
380 |
featuresList[i] = lyr; |
381 |
hashFeatures.put(lyr.getName(), lyr); |
382 |
} |
383 |
} |
384 |
return featuresList;
|
385 |
} |
386 |
|
387 |
/**
|
388 |
* Returns all the feature information retrieved using a
|
389 |
* describeFeatureTypeOpearion
|
390 |
* @param layerName
|
391 |
* Feature name
|
392 |
* @return
|
393 |
*/
|
394 |
public WFSLayerNode getLayerInfo(String layerName){ |
395 |
WFSLayerNode lyr = (WFSLayerNode)hashFeatures.get(layerName); |
396 |
try {
|
397 |
describeFeatureType(layerName, null);
|
398 |
WFSFeature feature = (WFSFeature) remoteServicesClient.getFeatures().get(layerName); |
399 |
lyr.setFields(feature.getFields()); |
400 |
} catch (WFSException e) {
|
401 |
// The feature doesn't has fields
|
402 |
e.printStackTrace(); |
403 |
} |
404 |
return lyr;
|
405 |
} |
406 |
|
407 |
|
408 |
/**
|
409 |
* @return The title of the service offered by the WMS server.
|
410 |
*/
|
411 |
public String getServiceTitle() { |
412 |
return remoteServicesClient.getServiceInformation().title;
|
413 |
} |
414 |
|
415 |
/**
|
416 |
* @return The abstract of the service offered by the WMS server.
|
417 |
*/
|
418 |
public String getServiceAbstract() { |
419 |
return remoteServicesClient.getServiceInformation().abstr;
|
420 |
} |
421 |
|
422 |
/**
|
423 |
* @return the online resource
|
424 |
*/
|
425 |
public String getOnlineResource(){ |
426 |
WFSServiceInformation si = remoteServicesClient.getServiceInformation(); |
427 |
return si.getOnline_resource();
|
428 |
} |
429 |
|
430 |
/**
|
431 |
*
|
432 |
* @return the host
|
433 |
*/
|
434 |
public String getHost(){ |
435 |
return remoteServicesClient.getHost();
|
436 |
} |
437 |
|
438 |
/**
|
439 |
* @return the version of this client.
|
440 |
*/
|
441 |
public String getVersion() { |
442 |
return remoteServicesClient.getVersion();
|
443 |
} |
444 |
|
445 |
/*
|
446 |
* (non-Javadoc)
|
447 |
* @see com.iver.cit.gvsig.fmap.drivers.WFSDriver#close()
|
448 |
*/
|
449 |
public void close() { |
450 |
// TODO Auto-generated method stub
|
451 |
|
452 |
} |
453 |
|
454 |
/*
|
455 |
* (non-Javadoc)
|
456 |
* @see com.iver.cit.gvsig.fmap.drivers.WFSDriver#open()
|
457 |
*/
|
458 |
public void open() throws DriverException { |
459 |
attr.setLoadedInMemory(true);
|
460 |
|
461 |
} |
462 |
|
463 |
/*
|
464 |
* (non-Javadoc)
|
465 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getPrimaryKeys()
|
466 |
*/
|
467 |
public int[] getPrimaryKeys() throws com.hardcode.gdbms.engine.data.driver.DriverException { |
468 |
throw new UnsupportedOperationException(); |
469 |
} |
470 |
|
471 |
/*
|
472 |
* (non-Javadoc)
|
473 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#write(com.hardcode.gdbms.engine.data.edition.DataWare)
|
474 |
*/
|
475 |
public void write(DataWare dataWare) throws com.hardcode.gdbms.engine.data.driver.DriverException { |
476 |
|
477 |
} |
478 |
|
479 |
/*
|
480 |
* (non-Javadoc)
|
481 |
* @see com.hardcode.gdbms.engine.data.driver.GDBMSDriver#setDataSourceFactory(com.hardcode.gdbms.engine.data.DataSourceFactory)
|
482 |
*/
|
483 |
public void setDataSourceFactory(DataSourceFactory dsf) { |
484 |
// TODO Auto-generated method stub
|
485 |
|
486 |
} |
487 |
|
488 |
/*
|
489 |
* (non-Javadoc)
|
490 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldValue(long, int)
|
491 |
*/
|
492 |
public Value getFieldValue(long rowIndex, int fieldId) throws com.hardcode.gdbms.engine.data.driver.DriverException { |
493 |
return driver.getFieldValue(rowIndex, fieldId);
|
494 |
} |
495 |
|
496 |
/*
|
497 |
* (non-Javadoc)
|
498 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldCount()
|
499 |
*/
|
500 |
public int getFieldCount() throws com.hardcode.gdbms.engine.data.driver.DriverException { |
501 |
return driver.getFieldCount();
|
502 |
} |
503 |
|
504 |
/*
|
505 |
* (non-Javadoc)
|
506 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldName(int)
|
507 |
*/
|
508 |
public String getFieldName(int fieldId) throws com.hardcode.gdbms.engine.data.driver.DriverException { |
509 |
return driver.getFieldName(fieldId);
|
510 |
} |
511 |
|
512 |
/*
|
513 |
* (non-Javadoc)
|
514 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getRowCount()
|
515 |
*/
|
516 |
public long getRowCount() throws com.hardcode.gdbms.engine.data.driver.DriverException { |
517 |
return driver.getRowCount();
|
518 |
} |
519 |
|
520 |
/*
|
521 |
* (non-Javadoc)
|
522 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldType(int)
|
523 |
*/
|
524 |
public int getFieldType(int i) throws com.hardcode.gdbms.engine.data.driver.DriverException { |
525 |
return driver.getFieldType(i);
|
526 |
} |
527 |
|
528 |
/*
|
529 |
* (non-Javadoc)
|
530 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldWidth(int)
|
531 |
*/
|
532 |
public int getFieldWidth(int i) throws com.hardcode.gdbms.engine.data.driver.DriverException { |
533 |
// TODO Auto-generated method stub
|
534 |
return 100; |
535 |
} |
536 |
|
537 |
/*
|
538 |
* (non-Javadoc)
|
539 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#isWritable()
|
540 |
*/
|
541 |
public boolean isWritable() { |
542 |
return true; |
543 |
} |
544 |
|
545 |
/*
|
546 |
* (non-Javadoc)
|
547 |
* @see com.iver.cit.gvsig.fmap.drivers.BoundedShapes#getShapeBounds(int)
|
548 |
*/
|
549 |
public Rectangle2D getShapeBounds(int index) throws IOException { |
550 |
return getShape(index).getBounds2D();
|
551 |
} |
552 |
|
553 |
/*
|
554 |
* (non-Javadoc)
|
555 |
* @see com.iver.cit.gvsig.fmap.drivers.BoundedShapes#getShapeType(int)
|
556 |
*/
|
557 |
public int getShapeType(int index) { |
558 |
try {
|
559 |
if (getShapeCount() > 0){ |
560 |
return getShape(0).getGeometryType(); |
561 |
} |
562 |
|
563 |
} catch (IOException e) { |
564 |
e.printStackTrace(); |
565 |
} |
566 |
return FShape.MULTI;
|
567 |
} |
568 |
|
569 |
/*
|
570 |
* (non-Javadoc)
|
571 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#reload()
|
572 |
*/
|
573 |
public void reload() throws IOException, com.hardcode.gdbms.engine.data.driver.DriverException { |
574 |
try {
|
575 |
getFeature(status); |
576 |
} catch (WFSException e) {
|
577 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException(e); |
578 |
} |
579 |
} |
580 |
|
581 |
/*
|
582 |
* (non-Javadoc)
|
583 |
* @see com.iver.cit.gvsig.fmap.edition.IWriteable#getWriter()
|
584 |
*/
|
585 |
public IWriter getWriter() {
|
586 |
if (writer == null){ |
587 |
writer = new FmapWFSWriter(this, isWfstEditing); |
588 |
} |
589 |
return writer;
|
590 |
} |
591 |
|
592 |
/**
|
593 |
* @return the status
|
594 |
*/
|
595 |
public WFSStatus getStatus() {
|
596 |
return status;
|
597 |
} |
598 |
|
599 |
/**
|
600 |
* @return the isWfstEditing
|
601 |
*/
|
602 |
public boolean isWfstEditing() { |
603 |
return isWfstEditing;
|
604 |
} |
605 |
|
606 |
/**
|
607 |
* @param isWfstEditing the isWfstEditing to set
|
608 |
*/
|
609 |
public void setWfstEditing(boolean isWfstEditing) { |
610 |
this.isWfstEditing = isWfstEditing;
|
611 |
if (writer != null){ |
612 |
writer.setWfstEditing(isWfstEditing); |
613 |
} |
614 |
} |
615 |
|
616 |
/**
|
617 |
* @return the isWfstGeometriesUpdated
|
618 |
*/
|
619 |
public boolean isWfstGeometriesUpdated() { |
620 |
return isWfstGeometriesUpdated;
|
621 |
} |
622 |
|
623 |
/**
|
624 |
* @param isWfstGeometriesUpdated the isWfstGeometriesUpdated to set
|
625 |
*/
|
626 |
public void setWfstGeometriesUpdated(boolean isWfstGeometriesUpdated) { |
627 |
this.isWfstGeometriesUpdated = isWfstGeometriesUpdated;
|
628 |
} |
629 |
|
630 |
/**
|
631 |
* It locks all the features
|
632 |
* @param expiryTime
|
633 |
* The maximum time to edit
|
634 |
* @throws WFSTLockFeaturesException
|
635 |
*/
|
636 |
public void lockCurrentFeatures(int expiryTime) throws WFSTLockFeaturesException{ |
637 |
((FmapWFSWriter)getWriter()).lockCurrentFeatures(expiryTime); |
638 |
} |
639 |
|
640 |
/**
|
641 |
* @return the remoteServicesClient
|
642 |
*/
|
643 |
public WFSClient getRemoteServicesClient() {
|
644 |
return remoteServicesClient;
|
645 |
} |
646 |
|
647 |
/**
|
648 |
* @return true if the server supports WFST
|
649 |
*/
|
650 |
public boolean isTransactional(){ |
651 |
String onlineResource = remoteServicesClient.getServiceInformation().getOnlineResource(WFSOperation.TRANSACTION);
|
652 |
if (onlineResource == null){ |
653 |
onlineResource = remoteServicesClient.getServiceInformation().getOnlineResource(WFSOperation.TRANSACTION, WFSOperation.PROTOCOL_POST); |
654 |
if (onlineResource == null){ |
655 |
return false; |
656 |
} |
657 |
} |
658 |
return true; |
659 |
} |
660 |
} |