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