root / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / wizards / WFSWizardData.java @ 13881
History | View | Annotate | Download (6.47 KB)
1 |
package com.iver.cit.gvsig.gui.wizards; |
---|---|
2 |
|
3 |
import java.awt.Component; |
4 |
import java.io.IOException; |
5 |
import java.net.ConnectException; |
6 |
import java.net.URL; |
7 |
|
8 |
import javax.swing.JOptionPane; |
9 |
|
10 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
11 |
import com.iver.andami.PluginServices; |
12 |
import com.iver.cit.gvsig.exceptions.layers.ConnectionErrorLayerException; |
13 |
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException; |
14 |
import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriver; |
15 |
import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriverFactory; |
16 |
|
17 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
18 |
*
|
19 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
20 |
*
|
21 |
* This program is free software; you can redistribute it and/or
|
22 |
* modify it under the terms of the GNU General Public License
|
23 |
* as published by the Free Software Foundation; either version 2
|
24 |
* of the License, or (at your option) any later version.
|
25 |
*
|
26 |
* This program is distributed in the hope that it will be useful,
|
27 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
* GNU General Public License for more details.
|
30 |
*
|
31 |
* You should have received a copy of the GNU General Public License
|
32 |
* along with this program; if not, write to the Free Software
|
33 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
34 |
*
|
35 |
* For more information, contact:
|
36 |
*
|
37 |
* Generalitat Valenciana
|
38 |
* Conselleria d'Infraestructures i Transport
|
39 |
* Av. Blasco Ib??ez, 50
|
40 |
* 46010 VALENCIA
|
41 |
* SPAIN
|
42 |
*
|
43 |
* +34 963862235
|
44 |
* gvsig@gva.es
|
45 |
* www.gvsig.gva.es
|
46 |
*
|
47 |
* or
|
48 |
*
|
49 |
* IVER T.I. S.A
|
50 |
* Salamanca 50
|
51 |
* 46005 Valencia
|
52 |
* Spain
|
53 |
*
|
54 |
* +34 963163400
|
55 |
* dac@iver.es
|
56 |
*/
|
57 |
/* CVS MESSAGES:
|
58 |
*
|
59 |
* $Id: WFSWizardData.java 13881 2007-09-19 16:22:04Z jaume $
|
60 |
* $Log$
|
61 |
* Revision 1.13 2007-09-19 16:14:50 jaume
|
62 |
* removed unnecessary imports
|
63 |
*
|
64 |
* Revision 1.12 2007/03/06 17:06:25 caballero
|
65 |
* Exceptions
|
66 |
*
|
67 |
* Revision 1.11 2007/02/09 14:12:38 jorpiell
|
68 |
* Soporte para WFS 1.1 y WFS-T
|
69 |
*
|
70 |
* Revision 1.10 2006/12/18 08:48:38 jorpiell
|
71 |
* The props panel uses the same layer driver insteaf of create a nes driver each time
|
72 |
*
|
73 |
* Revision 1.9 2006/11/16 16:57:30 jorpiell
|
74 |
* Un mensaje de error que no se mostraba
|
75 |
*
|
76 |
* Revision 1.8 2006/11/16 13:28:50 jorpiell
|
77 |
* Se usa la factoria de layers para crear la capa
|
78 |
*
|
79 |
* Revision 1.7 2006/07/11 07:26:43 caballero
|
80 |
* traducci?n cant_connect_wfs
|
81 |
*
|
82 |
* Revision 1.6 2006/06/14 08:46:24 jorpiell
|
83 |
* Se tiene en cuanta la opcion para refrescar las capabilities
|
84 |
*
|
85 |
* Revision 1.5 2006/05/23 13:21:59 jorpiell
|
86 |
* Si hay alg?n problema en la carga se muestra un mensaje de error
|
87 |
*
|
88 |
* Revision 1.4 2006/05/23 08:09:53 jorpiell
|
89 |
* Se ha cambiado la forma en la que se leian los valores seleccionados en los paneles y se ha cambiado el comportamiento de los botones
|
90 |
*
|
91 |
* Revision 1.3 2006/05/19 12:58:03 jorpiell
|
92 |
* Modificados algunos paneles
|
93 |
*
|
94 |
* Revision 1.2 2006/04/20 16:38:24 jorpiell
|
95 |
* 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().
|
96 |
*
|
97 |
* Revision 1.1 2006/04/19 12:50:16 jorpiell
|
98 |
* Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
|
99 |
*
|
100 |
*
|
101 |
*/
|
102 |
/**
|
103 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
104 |
*/
|
105 |
public class WFSWizardData { |
106 |
private FMapWFSDriver driver = null; |
107 |
private String title = null; |
108 |
private String _abstract = null; |
109 |
private String serverVersion = null; |
110 |
private int buffer = 0; |
111 |
private int timeOut = 0; |
112 |
private String UserName = null; |
113 |
|
114 |
public String getOnlineResource(){ |
115 |
return driver.getOnlineResource();
|
116 |
} |
117 |
|
118 |
/**
|
119 |
*
|
120 |
* @return The host name
|
121 |
*/
|
122 |
public String getHost(){ |
123 |
return driver.getHost();
|
124 |
} |
125 |
|
126 |
/**
|
127 |
* Create the WFSClient and try to connect
|
128 |
* @param host
|
129 |
* Server name
|
130 |
* @throws DriverException
|
131 |
*/
|
132 |
public void setHost(URL host,boolean override){ |
133 |
try {
|
134 |
driver = FMapWFSDriverFactory.getFMapDriverForURL(host); |
135 |
try {
|
136 |
driver.createClient(host); |
137 |
} catch (ConnectException e) { |
138 |
throw new ConnectionErrorLayerException(host.toString(),e); |
139 |
} catch (IOException e) { |
140 |
throw new ConnectionErrorLayerException(host.toString(),e); |
141 |
} |
142 |
|
143 |
if (!driver.connect(override,null)){ |
144 |
throw new ConnectionErrorLayerException(host.toString(),null); |
145 |
} |
146 |
|
147 |
} catch (ConnectionErrorLayerException e1) {
|
148 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this,"server_timeout")); |
149 |
e1.printStackTrace(); |
150 |
return;
|
151 |
} catch (LoadLayerException e1) {
|
152 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "cant_connect")); |
153 |
e1.printStackTrace(); |
154 |
return;
|
155 |
} |
156 |
} |
157 |
|
158 |
/**
|
159 |
* Server's title (not used in gvSIG)
|
160 |
*
|
161 |
* T?tulo del servidor (no se usa en gvSIG)
|
162 |
*
|
163 |
* @return
|
164 |
*/
|
165 |
public String getTitle() { |
166 |
title = driver.getServiceTitle(); |
167 |
if (title == null){ |
168 |
return "None"; |
169 |
} |
170 |
return title;
|
171 |
} |
172 |
|
173 |
/**
|
174 |
* The server description.
|
175 |
*
|
176 |
* La descripci?n del servidor
|
177 |
*
|
178 |
* @return String
|
179 |
*/
|
180 |
public String getAbstract() { |
181 |
_abstract= driver.getServiceAbstract(); |
182 |
if (_abstract == null){ |
183 |
return "None"; |
184 |
} |
185 |
return _abstract;
|
186 |
} |
187 |
|
188 |
/**
|
189 |
* @return Returns the driver.
|
190 |
*/
|
191 |
public FMapWFSDriver getDriver() {
|
192 |
return driver;
|
193 |
} |
194 |
|
195 |
/**
|
196 |
*
|
197 |
* @return Features vector
|
198 |
*/
|
199 |
public Object[] getFeatures(){ |
200 |
return driver.getLayerList();
|
201 |
} |
202 |
|
203 |
/**
|
204 |
* Return the feature info
|
205 |
* @param featureName
|
206 |
* @return
|
207 |
*/
|
208 |
public Object getFeatureInfo(String featureName,String nameSpace){ |
209 |
return driver.getLayerInfo(featureName,nameSpace);
|
210 |
} |
211 |
|
212 |
/**
|
213 |
*
|
214 |
* @return server type
|
215 |
*/
|
216 |
public String getServerType() { |
217 |
serverVersion = driver.getVersion(); |
218 |
if (serverVersion==null){ |
219 |
return "WFS"; |
220 |
} |
221 |
return "WFS "+ serverVersion; |
222 |
} |
223 |
|
224 |
/**
|
225 |
* @return Returns the buffer.
|
226 |
*/
|
227 |
public int getBuffer() { |
228 |
return buffer;
|
229 |
} |
230 |
|
231 |
/**
|
232 |
* @param buffer The buffer to set.
|
233 |
*/
|
234 |
public void setBuffer(int buffer) { |
235 |
this.buffer = buffer;
|
236 |
} |
237 |
|
238 |
/**
|
239 |
* @return Returns the timeOut.
|
240 |
*/
|
241 |
public int getTimeOut() { |
242 |
return timeOut;
|
243 |
} |
244 |
|
245 |
/**
|
246 |
* @param timeOut The timeOut to set.
|
247 |
*/
|
248 |
public void setTimeOut(int timeOut) { |
249 |
this.timeOut = timeOut;
|
250 |
} |
251 |
|
252 |
/**
|
253 |
* @return Returns the userName.
|
254 |
*/
|
255 |
public String getUserName() { |
256 |
return UserName;
|
257 |
} |
258 |
|
259 |
/**
|
260 |
* @param userName The userName to set.
|
261 |
*/
|
262 |
public void setUserName(String userName) { |
263 |
UserName = userName; |
264 |
} |
265 |
|
266 |
public void setDriver(FMapWFSDriver driver) { |
267 |
this.driver = driver;
|
268 |
} |
269 |
|
270 |
} |