svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.utils / src / main / java / org / gvsig / utils / swing / jcomboServer / ServerData.java @ 40561
History | View | Annotate | Download (8.99 KB)
1 | 40561 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright (C) 2007-2013 gvSIG Association.
|
||
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 3
|
||
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 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 40435 | jjdelcerro | |
25 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
26 | *
|
||
27 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
28 | *
|
||
29 | * This program is free software; you can redistribute it and/or
|
||
30 | * modify it under the terms of the GNU General Public License
|
||
31 | * as published by the Free Software Foundation; either version 2
|
||
32 | * of the License, or (at your option) any later version.
|
||
33 | *
|
||
34 | * This program is distributed in the hope that it will be useful,
|
||
35 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
36 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
37 | * GNU General Public License for more details.
|
||
38 | *
|
||
39 | * You should have received a copy of the GNU General Public License
|
||
40 | * along with this program; if not, write to the Free Software
|
||
41 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
42 | *
|
||
43 | * For more information, contact:
|
||
44 | *
|
||
45 | * Generalitat Valenciana
|
||
46 | * Conselleria d'Infraestructures i Transport
|
||
47 | * Av. Blasco Ib??ez, 50
|
||
48 | * 46010 VALENCIA
|
||
49 | * SPAIN
|
||
50 | *
|
||
51 | * +34 963862235
|
||
52 | * gvsig@gva.es
|
||
53 | * www.gvsig.gva.es
|
||
54 | *
|
||
55 | * or
|
||
56 | *
|
||
57 | * IVER T.I. S.A
|
||
58 | * Salamanca 50
|
||
59 | * 46005 Valencia
|
||
60 | * Spain
|
||
61 | *
|
||
62 | * +34 963163400
|
||
63 | * dac@iver.es
|
||
64 | */
|
||
65 | package org.gvsig.utils.swing.jcomboServer; |
||
66 | import java.util.Date; |
||
67 | import java.util.Properties; |
||
68 | |||
69 | import org.gvsig.utils.DateTime; |
||
70 | |||
71 | |||
72 | /**
|
||
73 | * This class represents a data server, that can be a WMS, WFS, Catalog or
|
||
74 | * any kind of server. It contains the server URL and has a couple of
|
||
75 | * attributes that describe the server type (serverType and serverSubType).
|
||
76 | * It contains the date when the server was created and the date when the server
|
||
77 | * was accessed last time. *
|
||
78 | *
|
||
79 | * @author Jorge Piera Llodra (piera_jor@gva.es)
|
||
80 | */
|
||
81 | public class ServerData { |
||
82 | |||
83 | /**
|
||
84 | *
|
||
85 | *
|
||
86 | */
|
||
87 | public static final String SERVER_TYPE_CATALOG = "CATALOG"; |
||
88 | |||
89 | /**
|
||
90 | *
|
||
91 | *
|
||
92 | */
|
||
93 | public static final String SERVER_TYPE_GAZETTEER = "GAZETTEER"; |
||
94 | |||
95 | /**
|
||
96 | *
|
||
97 | *
|
||
98 | */
|
||
99 | public static final String SERVER_TYPE_MULTIPLE = "MULTIPLE"; |
||
100 | /**
|
||
101 | *
|
||
102 | *
|
||
103 | */
|
||
104 | public static final String SERVER_TYPE_WMS = "WMS"; |
||
105 | |||
106 | /**
|
||
107 | *
|
||
108 | *
|
||
109 | */
|
||
110 | public static final String SERVER_TYPE_WCS = "WCS"; |
||
111 | |||
112 | /**
|
||
113 | *
|
||
114 | *
|
||
115 | */
|
||
116 | public static final String SERVER_TYPE_WFS = "WFS"; |
||
117 | |||
118 | /**
|
||
119 | *
|
||
120 | *
|
||
121 | */
|
||
122 | public static final String SERVER_TYPE_WMTS = "WMTS"; |
||
123 | |||
124 | /**
|
||
125 | *
|
||
126 | *
|
||
127 | */
|
||
128 | public static final String SERVER_SUBTYPE_CATALOG_Z3950 = "Z3950"; |
||
129 | |||
130 | /**
|
||
131 | *
|
||
132 | *
|
||
133 | */
|
||
134 | public static final String SERVER_SUBTYPE_CATALOG_SRW = "SRW"; |
||
135 | |||
136 | /**
|
||
137 | *
|
||
138 | *
|
||
139 | */
|
||
140 | public static final String SERVER_SUBTYPE_CATALOG_CSW = "CSW"; |
||
141 | |||
142 | /**
|
||
143 | *
|
||
144 | *
|
||
145 | */
|
||
146 | public static final String SERVER_SUBTYPE_GAZETTEER_WFSG = "WFS-G"; |
||
147 | |||
148 | /**
|
||
149 | *
|
||
150 | *
|
||
151 | */
|
||
152 | public static final String SERVER_SUBTYPE_GAZETTEER_ADL = "ADL"; |
||
153 | |||
154 | /**
|
||
155 | *
|
||
156 | *
|
||
157 | */
|
||
158 | public static final String SERVER_SUBTYPE_GAZETTEER_IDEC = "IDEC"; |
||
159 | |||
160 | /**
|
||
161 | *
|
||
162 | *
|
||
163 | */
|
||
164 | public static final String SERVER_SUBTYPE_GAZETTEER_WFS = "WFS"; |
||
165 | |||
166 | /**
|
||
167 | *
|
||
168 | *
|
||
169 | */
|
||
170 | private Date added = null; |
||
171 | |||
172 | /**
|
||
173 | *
|
||
174 | *
|
||
175 | */
|
||
176 | private Date lastAccess = null; |
||
177 | |||
178 | /**
|
||
179 | *
|
||
180 | *
|
||
181 | */
|
||
182 | private String serviceType = null; |
||
183 | |||
184 | /**
|
||
185 | *
|
||
186 | *
|
||
187 | */
|
||
188 | private String serviceSubType = null; |
||
189 | |||
190 | /**
|
||
191 | *
|
||
192 | *
|
||
193 | */
|
||
194 | private String serverAddress = null; |
||
195 | |||
196 | /**
|
||
197 | *
|
||
198 | *
|
||
199 | */
|
||
200 | private String database = null; |
||
201 | |||
202 | private Properties properies = new Properties(); |
||
203 | |||
204 | /**
|
||
205 | *
|
||
206 | *
|
||
207 | *
|
||
208 | * @param serverAddress Server address
|
||
209 | * @param added When the server was added
|
||
210 | * @param lastAccess When the server was used last time
|
||
211 | * @param serviceType Service type
|
||
212 | * @param serviceSubType Service subtype
|
||
213 | */
|
||
214 | public ServerData(String serverAddress, Date added, Date lastAccess, String serviceType, String serviceSubType) { |
||
215 | this.added = added;
|
||
216 | this.lastAccess = lastAccess;
|
||
217 | this.serviceType = serviceType;
|
||
218 | this.serviceSubType = serviceSubType;
|
||
219 | this.serverAddress = serverAddress;
|
||
220 | } |
||
221 | |||
222 | /**
|
||
223 | *
|
||
224 | *
|
||
225 | *
|
||
226 | * @param serverAddress Server address
|
||
227 | * @param added When the server was added
|
||
228 | * @param lastAccess When the server was used last time
|
||
229 | * @param serviceType Service type
|
||
230 | * @param serviceSubType Service subtype
|
||
231 | * @param database Database name
|
||
232 | */
|
||
233 | public ServerData(String serverAddress, Date added, Date lastAccess, String serviceType, String serviceSubType,String database) { |
||
234 | this.added = added;
|
||
235 | this.lastAccess = lastAccess;
|
||
236 | this.serviceType = serviceType;
|
||
237 | this.serviceSubType = serviceSubType;
|
||
238 | this.serverAddress = serverAddress;
|
||
239 | this.database = database;
|
||
240 | } |
||
241 | |||
242 | /**
|
||
243 | * Constructor for a new Server
|
||
244 | *
|
||
245 | *
|
||
246 | * @param serverAddress Server Address
|
||
247 | * @param serviceType Server Type
|
||
248 | * @param serviceSubType Server Subtype
|
||
249 | */
|
||
250 | public ServerData(String serverAddress, String serviceType, String serviceSubType) { |
||
251 | |||
252 | this.serverAddress = serverAddress;
|
||
253 | this.added = DateTime.getCurrentDate();
|
||
254 | this.lastAccess = DateTime.getCurrentDate();
|
||
255 | this.serviceType = serviceType;
|
||
256 | this.serviceSubType = serviceSubType;
|
||
257 | } |
||
258 | |||
259 | /**
|
||
260 | * Constructor for a new Server
|
||
261 | *
|
||
262 | *
|
||
263 | * @param serverAddress Server Address
|
||
264 | * @param serviceType Server Type
|
||
265 | * @param serviceSubType Server Subtype
|
||
266 | */
|
||
267 | public ServerData(String serverAddress, String serviceType, String serviceSubType,String database) { |
||
268 | |||
269 | this.serverAddress = serverAddress;
|
||
270 | this.added = DateTime.getCurrentDate();
|
||
271 | this.lastAccess = DateTime.getCurrentDate();
|
||
272 | this.serviceType = serviceType;
|
||
273 | this.serviceSubType = serviceSubType;
|
||
274 | this.database = database;
|
||
275 | } |
||
276 | |||
277 | /**
|
||
278 | * Constructor for a new Server
|
||
279 | *
|
||
280 | *
|
||
281 | * @param serverAddress Server Address
|
||
282 | * @param serviceType Server Type
|
||
283 | */
|
||
284 | public ServerData(String serverAddress, String serviceType) { |
||
285 | |||
286 | this.serverAddress = serverAddress;
|
||
287 | this.added = DateTime.getCurrentDate();
|
||
288 | this.lastAccess = DateTime.getCurrentDate();
|
||
289 | this.serviceType = serviceType;
|
||
290 | this.serviceSubType = ""; |
||
291 | this.database = ""; |
||
292 | } |
||
293 | |||
294 | /**
|
||
295 | * This method updates the last access attribute. New value
|
||
296 | * is the current time.
|
||
297 | *
|
||
298 | */
|
||
299 | public void updateLastAccess() { |
||
300 | lastAccess = DateTime.getCurrentDate(); |
||
301 | } |
||
302 | |||
303 | /**
|
||
304 | * The server address field have to be showed in the combo
|
||
305 | *
|
||
306 | *
|
||
307 | * @return String
|
||
308 | */
|
||
309 | public String toString() { |
||
310 | return getServerAddress();
|
||
311 | } |
||
312 | |||
313 | /**
|
||
314 | *
|
||
315 | *
|
||
316 | *
|
||
317 | * @return Returns the added.
|
||
318 | */
|
||
319 | public Date getAdded() { |
||
320 | return added;
|
||
321 | } |
||
322 | |||
323 | /**
|
||
324 | *
|
||
325 | *
|
||
326 | *
|
||
327 | * @param added The added to set.
|
||
328 | */
|
||
329 | public void setAdded(Date added) { |
||
330 | this.added = added;
|
||
331 | } |
||
332 | |||
333 | /**
|
||
334 | *
|
||
335 | *
|
||
336 | *
|
||
337 | * @return Returns the lastAccess.
|
||
338 | */
|
||
339 | public Date getLastAccess() { |
||
340 | return lastAccess;
|
||
341 | } |
||
342 | |||
343 | /**
|
||
344 | *
|
||
345 | *
|
||
346 | *
|
||
347 | * @param lastAccess The lastAccess to set.
|
||
348 | */
|
||
349 | public void setLastAccess(Date lastAccess) { |
||
350 | this.lastAccess = lastAccess;
|
||
351 | } |
||
352 | |||
353 | /**
|
||
354 | *
|
||
355 | *
|
||
356 | *
|
||
357 | * @return Returns the serverAddress.
|
||
358 | */
|
||
359 | public String getServerAddress() { |
||
360 | return serverAddress;
|
||
361 | } |
||
362 | |||
363 | /**
|
||
364 | *
|
||
365 | *
|
||
366 | *
|
||
367 | * @param serverAddress The serverAddress to set.
|
||
368 | */
|
||
369 | public void setServerAddress(String serverAddress) { |
||
370 | this.serverAddress = serverAddress;
|
||
371 | } |
||
372 | |||
373 | /**
|
||
374 | *
|
||
375 | *
|
||
376 | *
|
||
377 | * @return Returns the serviceSubType.
|
||
378 | */
|
||
379 | public String getServiceSubType() { |
||
380 | return serviceSubType;
|
||
381 | } |
||
382 | |||
383 | /**
|
||
384 | *
|
||
385 | *
|
||
386 | *
|
||
387 | * @param serviceSubType The serviceSubType to set.
|
||
388 | */
|
||
389 | public void setServiceSubType(String serviceSubType) { |
||
390 | this.serviceSubType = serviceSubType;
|
||
391 | } |
||
392 | |||
393 | /**
|
||
394 | *
|
||
395 | *
|
||
396 | *
|
||
397 | * @return Returns the serviceType.
|
||
398 | */
|
||
399 | public String getServiceType() { |
||
400 | return serviceType;
|
||
401 | } |
||
402 | |||
403 | /**
|
||
404 | *
|
||
405 | *
|
||
406 | *
|
||
407 | * @param serviceType The serviceType to set.
|
||
408 | */
|
||
409 | public void setServiceType(String serviceType) { |
||
410 | this.serviceType = serviceType;
|
||
411 | } |
||
412 | |||
413 | public String getDatabase() { |
||
414 | return database;
|
||
415 | } |
||
416 | |||
417 | public void setDatabase(String database) { |
||
418 | this.database = database;
|
||
419 | } |
||
420 | |||
421 | /**
|
||
422 | * @return Returns the properies.
|
||
423 | */
|
||
424 | public Properties getProperies() { |
||
425 | return properies;
|
||
426 | } |
||
427 | |||
428 | /**
|
||
429 | * @param properies The properies to set.
|
||
430 | */
|
||
431 | public void setProperies(Properties properies) { |
||
432 | this.properies = properies;
|
||
433 | } |
||
434 | |||
435 | /**
|
||
436 | *
|
||
437 | * @param propertyName
|
||
438 | * @return
|
||
439 | */
|
||
440 | public String getProperty(String propertyName){ |
||
441 | return (String)getProperies().getProperty(propertyName); |
||
442 | } |
||
443 | } |