Statistics
| Revision:

root / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / wizards / WFSWizardData.java @ 4886

History | View | Annotate | Download (3.69 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
import java.util.Vector;
8

    
9
import javax.swing.JOptionPane;
10

    
11
import com.iver.andami.PluginServices;
12
import com.iver.cit.gvsig.fmap.DriverException;
13
import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriver;
14

    
15
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
16
 *
17
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
18
 *
19
 * This program is free software; you can redistribute it and/or
20
 * modify it under the terms of the GNU General Public License
21
 * as published by the Free Software Foundation; either version 2
22
 * of the License, or (at your option) any later version.
23
 *
24
 * This program is distributed in the hope that it will be useful,
25
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
 * GNU General Public License for more details.
28
 *
29
 * You should have received a copy of the GNU General Public License
30
 * along with this program; if not, write to the Free Software
31
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
32
 *
33
 * For more information, contact:
34
 *
35
 *  Generalitat Valenciana
36
 *   Conselleria d'Infraestructures i Transport
37
 *   Av. Blasco Ib??ez, 50
38
 *   46010 VALENCIA
39
 *   SPAIN
40
 *
41
 *      +34 963862235
42
 *   gvsig@gva.es
43
 *      www.gvsig.gva.es
44
 *
45
 *    or
46
 *
47
 *   IVER T.I. S.A
48
 *   Salamanca 50
49
 *   46005 Valencia
50
 *   Spain
51
 *
52
 *   +34 963163400
53
 *   dac@iver.es
54
 */
55
/* CVS MESSAGES:
56
 *
57
 * $Id: WFSWizardData.java 4886 2006-04-19 12:50:16Z jorpiell $
58
 * $Log$
59
 * Revision 1.1  2006-04-19 12:50:16  jorpiell
60
 * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
61
 *
62
 *
63
 */
64
/**
65
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
66
 */
67
public class WFSWizardData {
68
        private FMapWFSDriver driver = null;
69
        private String title = null;
70
        private String _abstract = null;
71
        private String serverVersion = null;
72
        
73
        /**
74
         * 
75
         * @return The host name
76
         */
77
        public String getHost(){
78
                return driver.getHost();
79
        }
80
        
81
        /**
82
         * Create the WFSClient and try to connect
83
         * @param host
84
         * Server name
85
         * @throws DriverException
86
         */
87
        public void setHost(URL host) throws DriverException{
88
                driver = new FMapWFSDriver();
89
                try {
90
                        driver.createClient(host);
91
                        
92
                        if (!driver.connect()){
93
                                throw new DriverException(PluginServices.getText(this, "cant_connect") + host.toString());
94
                        }                
95
                        
96
                } catch (ConnectException e) {
97
                        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this,"server_timeout"));
98
                        e.printStackTrace();
99
                        return;
100
                } catch (IOException e) {
101
                        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "cant_connect"));
102
                        e.printStackTrace();
103
                        return;
104
                }                
105
        }
106
        
107
        /**
108
         * Server's title (not used in gvSIG)
109
         *          
110
         * T?tulo del servidor (no se usa en gvSIG)        
111
         * 
112
         * @return
113
         */
114
        public String getTitle() {
115
                title = driver.getServiceTitle();
116
                if (title == null){
117
                        return "None";
118
                }
119
                return title;
120
        }
121
        
122
        /**
123
         * The server description.
124
         * 
125
         * La descripci?n del servidor
126
         * 
127
         * @return String
128
         */
129
        public String getAbstract() {
130
                _abstract= driver.getServiceAbstract();
131
                if (_abstract == null){
132
                        return "None";
133
                }
134
                return _abstract;
135
        }
136
        
137
        /**
138
         * @return Returns the driver.
139
         */
140
        public FMapWFSDriver getDriver() {
141
                return driver;
142
        }
143
        
144
        /**
145
         * 
146
         * @return Features vector
147
         */
148
        public Vector getFeatures(){
149
                return driver.getFeatures();
150
        }
151
        
152
        /**
153
         * 
154
         * @return server type
155
         */
156
        public String getServerType() {
157
                serverVersion = driver.getVersion();
158
                if (serverVersion==null){
159
                        return "WFS";
160
                }
161
                return "WFS "+ serverVersion;
162
        }
163
        
164
        
165
        
166
}