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