Revision 38492
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/RasterClient.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.remoteclient; |
|
3 |
|
|
4 |
/** |
|
5 |
* <p></p> |
|
6 |
* |
|
7 |
*/ |
|
8 |
public abstract class RasterClient extends org.gvsig.remoteclient.RemoteClient implements org.gvsig.remoteclient.IRasterClient { |
|
9 |
} |
|
0 | 10 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/WFSProtocolHandlerFactory.java | ||
---|---|---|
1 |
package org.gvsig.remoteclient.wfs; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.FileReader; |
|
5 |
import java.io.IOException; |
|
6 |
import java.io.Reader; |
|
7 |
import java.net.ConnectException; |
|
8 |
import java.net.URL; |
|
9 |
import java.util.ArrayList; |
|
10 |
import java.util.Iterator; |
|
11 |
|
|
12 |
import org.kxml2.io.KXmlParser; |
|
13 |
import org.xmlpull.v1.XmlPullParserException; |
|
14 |
|
|
15 |
import org.gvsig.compat.CompatLocator; |
|
16 |
import org.gvsig.compat.lang.StringUtils; |
|
17 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
18 |
import org.gvsig.remoteclient.utils.EncodingXMLParser; |
|
19 |
import org.gvsig.remoteclient.utils.Utilities; |
|
20 |
|
|
21 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
22 |
* |
|
23 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
24 |
* |
|
25 |
* This program is free software; you can redistribute it and/or |
|
26 |
* modify it under the terms of the GNU General Public License |
|
27 |
* as published by the Free Software Foundation; either version 2 |
|
28 |
* of the License, or (at your option) any later version. |
|
29 |
* |
|
30 |
* This program is distributed in the hope that it will be useful, |
|
31 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
32 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
33 |
* GNU General Public License for more details. |
|
34 |
* |
|
35 |
* You should have received a copy of the GNU General Public License |
|
36 |
* along with this program; if not, write to the Free Software |
|
37 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
38 |
* |
|
39 |
* For more information, contact: |
|
40 |
* |
|
41 |
* Generalitat Valenciana |
|
42 |
* Conselleria d'Infraestructures i Transport |
|
43 |
* Av. Blasco Ib??ez, 50 |
|
44 |
* 46010 VALENCIA |
|
45 |
* SPAIN |
|
46 |
* |
|
47 |
* +34 963862235 |
|
48 |
* gvsig@gva.es |
|
49 |
* www.gvsig.gva.es |
|
50 |
* |
|
51 |
* or |
|
52 |
* |
|
53 |
* IVER T.I. S.A |
|
54 |
* Salamanca 50 |
|
55 |
* 46005 Valencia |
|
56 |
* Spain |
|
57 |
* |
|
58 |
* +34 963163400 |
|
59 |
* dac@iver.es |
|
60 |
*/ |
|
61 |
/* CVS MESSAGES: |
|
62 |
* |
|
63 |
* $Id$ |
|
64 |
* $Log$ |
|
65 |
* Revision 1.2 2007-02-09 14:11:01 jorpiell |
|
66 |
* Primer piloto del soporte para WFS 1.1 y para WFS-T |
|
67 |
* |
|
68 |
* Revision 1.1 2006/04/19 12:51:35 jorpiell |
|
69 |
* A?adidas algunas de las clases del servicio WFS |
|
70 |
* |
|
71 |
* |
|
72 |
*/ |
|
73 |
/** |
|
74 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
75 |
*/ |
|
76 |
public class WFSProtocolHandlerFactory { |
|
77 |
public WFSProtocolHandler wFSProtocolHandler; |
|
78 |
private static final StringUtils stringUtils = CompatLocator.getStringUtils(); |
|
79 |
private static ArrayList supportedVersions = new ArrayList(); |
|
80 |
|
|
81 |
static { |
|
82 |
supportedVersions.add("1.0.0"); |
|
83 |
supportedVersions.add("1.1.0"); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* M?todo que dada una respuesta de getCapabilities y un iterador sobre una |
|
88 |
* coleccion de WFSClient's ordenada descendentemente devuelve el cliente |
|
89 |
* cuya version es igual o inmediatamente inferior |
|
90 |
* |
|
91 |
* @param caps Capabilities con la respuesta del servidor |
|
92 |
* @param clients Iterador de conjunto ordenado descendientemente |
|
93 |
* |
|
94 |
* @return cliente cuya version es igual o inmediatamente inferior |
|
95 |
* @throws IllegalAccessException |
|
96 |
* @throws InstantiationException |
|
97 |
* |
|
98 |
*/ |
|
99 |
private static String getDriverVersion(String version, Iterator clients) throws InstantiationException, IllegalAccessException { |
|
100 |
while (clients.hasNext()) { |
|
101 |
String clientVersion = (String)clients.next(); |
|
102 |
int ret = version.compareTo(clientVersion); |
|
103 |
|
|
104 |
if (ret >= 0) { |
|
105 |
return clientVersion; |
|
106 |
} |
|
107 |
} |
|
108 |
return null; |
|
109 |
} |
|
110 |
|
|
111 |
/** |
|
112 |
* Establece la versi?n con la que se comunicar? con el servidor y devuelve |
|
113 |
* el objeto Capabilities obtenido con dicha versi?n |
|
114 |
* |
|
115 |
* @param host maquina con la que se negocia |
|
116 |
* |
|
117 |
* @return instancia de un cliente capaz de negociar con el host que se |
|
118 |
* pasa como par?metro |
|
119 |
*/ |
|
120 |
public static WFSProtocolHandler negotiate(String host) throws ConnectException, IOException { |
|
121 |
|
|
122 |
if (supportedVersions.size() == 0){ |
|
123 |
return null; |
|
124 |
} |
|
125 |
|
|
126 |
try { |
|
127 |
String highestVersionSupportedByServer = getSuitableWFSVersion(host,""); |
|
128 |
if (supportedVersions.contains(highestVersionSupportedByServer)) |
|
129 |
{ |
|
130 |
// we support the highest version supported by the server |
|
131 |
// this is the best case |
|
132 |
return createVersionDriver(highestVersionSupportedByServer); |
|
133 |
} |
|
134 |
else |
|
135 |
{ |
|
136 |
// in case we dont support the highest version from the server |
|
137 |
// we start the negotiation process in which we have to get the higest version |
|
138 |
// the WFS supports and we are able to read. |
|
139 |
Iterator iVersion = supportedVersions.iterator(); |
|
140 |
String wfsVersion; |
|
141 |
String gvSIGVersion; |
|
142 |
|
|
143 |
while (iVersion.hasNext()) { |
|
144 |
gvSIGVersion = (String)iVersion.next(); |
|
145 |
wfsVersion = getSuitableWFSVersion(host,gvSIGVersion); |
|
146 |
//TODO: |
|
147 |
//compare with the version returned by the WMS!!!!! |
|
148 |
// send GetCapabilities and read the version to compare. |
|
149 |
int res = wfsVersion.compareTo(gvSIGVersion); |
|
150 |
|
|
151 |
if (res == 0) { //Si es la misma que nuestra version |
|
152 |
return createVersionDriver(gvSIGVersion); |
|
153 |
} else if (res > 0) { //Si es mayor que nuestra version |
|
154 |
throw new Exception("Server Version too high: " + wfsVersion); |
|
155 |
} else { //Si es menor que nuestra version |
|
156 |
//Obtenemos la primera version menor o igual que tengamos |
|
157 |
String lowerVersion = WFSProtocolHandlerFactory.getDriverVersion(wfsVersion, iVersion); |
|
158 |
|
|
159 |
if (lowerVersion == null) { //Si no hay ninguna |
|
160 |
throw new Exception("Lowest server version is " + wfsVersion); |
|
161 |
} else { |
|
162 |
if (lowerVersion.equals(wfsVersion)) { |
|
163 |
return createVersionDriver(lowerVersion); |
|
164 |
} else { //Si hay una version menor que la que retorno el servidor |
|
165 |
//iV = lower; |
|
166 |
} |
|
167 |
} |
|
168 |
} |
|
169 |
} |
|
170 |
}//case we had to start the negotiation process. |
|
171 |
return null; // if it did not find any suitable version. |
|
172 |
} |
|
173 |
catch(ConnectException conEx) |
|
174 |
{ |
|
175 |
throw conEx; |
|
176 |
} |
|
177 |
catch(IOException ioEx) |
|
178 |
{ |
|
179 |
throw ioEx; |
|
180 |
} |
|
181 |
catch(Exception e) |
|
182 |
{ |
|
183 |
e.printStackTrace(); |
|
184 |
return null; |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
/** |
|
189 |
* Sends a GetCapabilities to the WFS server to get the version |
|
190 |
* if the version parameter is null, the WFS will return the highest version supported |
|
191 |
* if not it will return the lower highest version than the one requested. |
|
192 |
* @param host |
|
193 |
* @param version |
|
194 |
* @return suitable version supported by the server |
|
195 |
*/ |
|
196 |
private static String getSuitableWFSVersion(String host, String _version) throws ConnectException, IOException { |
|
197 |
String request = WFSProtocolHandler.buildCapabilitiesSuitableVersionRequest(host, _version); |
|
198 |
String version = new String(); |
|
199 |
Reader reader = null; |
|
200 |
try { |
|
201 |
File file = Utilities.downloadFile(new URL(request), "wfs-suitable-version", null); |
|
202 |
|
|
203 |
reader = new FileReader(file); |
|
204 |
EncodingXMLParser kxmlParser = new EncodingXMLParser(); |
|
205 |
kxmlParser.setInput(reader); |
|
206 |
kxmlParser.nextTag(); |
|
207 |
if ( kxmlParser.getEventType() != KXmlParser.END_DOCUMENT ) { |
|
208 |
String tag = kxmlParser.getName(); |
|
209 |
if (stringUtils.split(tag, ":").length == 2){ |
|
210 |
tag = stringUtils.split(tag, ":")[1]; |
|
211 |
} |
|
212 |
if ((tag.compareTo(CapabilitiesTags.WFS_CAPABILITIES_ROOT1_0_0)==0)) { |
|
213 |
version = kxmlParser.getAttributeValue("", CapabilitiesTags.VERSION); |
|
214 |
} |
|
215 |
} |
|
216 |
// do not forget to close the Stream. |
|
217 |
reader.close(); |
|
218 |
return version; |
|
219 |
} catch(ConnectException conEx) { |
|
220 |
throw new ConnectException(conEx.getMessage()); |
|
221 |
} catch(IOException ioEx) { |
|
222 |
throw new IOException(ioEx.getMessage()); |
|
223 |
} catch(XmlPullParserException xmlEx) { |
|
224 |
xmlEx.printStackTrace(); |
|
225 |
return ""; |
|
226 |
} finally { |
|
227 |
if (reader != null) { |
|
228 |
try { |
|
229 |
reader.close(); |
|
230 |
} catch(Exception ex) { |
|
231 |
ex.printStackTrace(); |
|
232 |
} |
|
233 |
} |
|
234 |
} |
|
235 |
} |
|
236 |
|
|
237 |
/** |
|
238 |
* It creates an instance of a WFSDriver class. |
|
239 |
* |
|
240 |
* @param String, with the version of the driver to be created |
|
241 |
* @return WFSDriver. |
|
242 |
*/ |
|
243 |
public static WFSProtocolHandler createVersionDriver(String version) { |
|
244 |
try { |
|
245 |
Class driver; |
|
246 |
version = version.replace('.', '_'); |
|
247 |
driver = Class.forName("org.gvsig.remoteclient.wfs.wfs_"+version+".WFSProtocolHandler" + version); |
|
248 |
return (WFSProtocolHandler)driver.newInstance(); |
|
249 |
} catch (Exception e) { |
|
250 |
e.printStackTrace(); |
|
251 |
//throw new Exception("WFSDriverFactory. Unknown driver version " + e); |
|
252 |
return null; |
|
253 |
} |
|
254 |
} |
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
} |
|
0 | 259 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/request/WFSDescribeFeatureTypeRequest.java | ||
---|---|---|
1 |
package org.gvsig.remoteclient.wfs.request; |
|
2 |
|
|
3 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
4 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
5 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
6 |
|
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
8 |
* |
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
10 |
* |
|
11 |
* This program is free software; you can redistribute it and/or |
|
12 |
* modify it under the terms of the GNU General Public License |
|
13 |
* as published by the Free Software Foundation; either version 2 |
|
14 |
* of the License, or (at your option) any later version. |
|
15 |
* |
|
16 |
* This program is distributed in the hope that it will be useful, |
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
* GNU General Public License for more details. |
|
20 |
* |
|
21 |
* You should have received a copy of the GNU General Public License |
|
22 |
* along with this program; if not, write to the Free Software |
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
24 |
* |
|
25 |
* For more information, contact: |
|
26 |
* |
|
27 |
* Generalitat Valenciana |
|
28 |
* Conselleria d'Infraestructures i Transport |
|
29 |
* Av. Blasco Ib??ez, 50 |
|
30 |
* 46010 VALENCIA |
|
31 |
* SPAIN |
|
32 |
* |
|
33 |
* +34 963862235 |
|
34 |
* gvsig@gva.es |
|
35 |
* www.gvsig.gva.es |
|
36 |
* |
|
37 |
* or |
|
38 |
* |
|
39 |
* IVER T.I. S.A |
|
40 |
* Salamanca 50 |
|
41 |
* 46005 Valencia |
|
42 |
* Spain |
|
43 |
* |
|
44 |
* +34 963163400 |
|
45 |
* dac@iver.es |
|
46 |
*/ |
|
47 |
/* CVS MESSAGES: |
|
48 |
* |
|
49 |
* $Id$ |
|
50 |
* $Log$ |
|
51 |
* |
|
52 |
*/ |
|
53 |
/** |
|
54 |
* The function of the DescribeFeatureType operation is to |
|
55 |
* generate a schema description of feature types serviced |
|
56 |
* by a WFS implementation. The schema descriptions define |
|
57 |
* how a WFS implementation expects feature instances to |
|
58 |
* be encoded on input (via Insert and Update requests) |
|
59 |
* and how feature instances will be generated on output |
|
60 |
* (in response to GetFeature and GetGmlObject requests). |
|
61 |
* @see http://www.opengeospatial.org/standards/wfs |
|
62 |
* @author Jorge Piera Llodr? (jorge.piera@iver.es) |
|
63 |
*/ |
|
64 |
public abstract class WFSDescribeFeatureTypeRequest extends WFSRequest{ |
|
65 |
|
|
66 |
public WFSDescribeFeatureTypeRequest(WFSStatus status, |
|
67 |
WFSProtocolHandler protocolHandler) { |
|
68 |
super(status, protocolHandler); |
|
69 |
} |
|
70 |
|
|
71 |
/* |
|
72 |
* (non-Javadoc) |
|
73 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpPostRequest(java.lang.String) |
|
74 |
*/ |
|
75 |
protected String getHttpPostRequest(String onlineResource) { |
|
76 |
// TODO Auto-generated method stub |
|
77 |
return null; |
|
78 |
} |
|
79 |
|
|
80 |
/* |
|
81 |
* (non-Javadoc) |
|
82 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getOperationCode() |
|
83 |
*/ |
|
84 |
protected String getOperationName() { |
|
85 |
return CapabilitiesTags.WFS_DESCRIBEFEATURETYPE; |
|
86 |
} |
|
87 |
|
|
88 |
/* |
|
89 |
* (non-Javadoc) |
|
90 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation() |
|
91 |
*/ |
|
92 |
protected String getSchemaLocation() { |
|
93 |
return null; |
|
94 |
} |
|
95 |
|
|
96 |
/* |
|
97 |
* (non-Javadoc) |
|
98 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getTempFilePrefix() |
|
99 |
*/ |
|
100 |
protected String getTempFilePrefix() { |
|
101 |
return "wfs_describeFeatureType.xml"; |
|
102 |
} |
|
103 |
} |
|
0 | 104 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/request/WFSRequest.java | ||
---|---|---|
1 |
package org.gvsig.remoteclient.wfs.request; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
import java.net.ConnectException; |
|
6 |
import java.net.UnknownHostException; |
|
7 |
|
|
8 |
import org.gvsig.compat.net.ICancellable; |
|
9 |
import org.gvsig.remoteclient.ogc.request.OGCRequest; |
|
10 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
11 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
12 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
13 |
|
|
14 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
15 |
* |
|
16 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
17 |
* |
|
18 |
* This program is free software; you can redistribute it and/or |
|
19 |
* modify it under the terms of the GNU General Public License |
|
20 |
* as published by the Free Software Foundation; either version 2 |
|
21 |
* of the License, or (at your option) any later version. |
|
22 |
* |
|
23 |
* This program is distributed in the hope that it will be useful, |
|
24 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
25 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
26 |
* GNU General Public License for more details. |
|
27 |
* |
|
28 |
* You should have received a copy of the GNU General Public License |
|
29 |
* along with this program; if not, write to the Free Software |
|
30 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
31 |
* |
|
32 |
* For more information, contact: |
|
33 |
* |
|
34 |
* Generalitat Valenciana |
|
35 |
* Conselleria d'Infraestructures i Transport |
|
36 |
* Av. Blasco Ib??ez, 50 |
|
37 |
* 46010 VALENCIA |
|
38 |
* SPAIN |
|
39 |
* |
|
40 |
* +34 963862235 |
|
41 |
* gvsig@gva.es |
|
42 |
* www.gvsig.gva.es |
|
43 |
* |
|
44 |
* or |
|
45 |
* |
|
46 |
* IVER T.I. S.A |
|
47 |
* Salamanca 50 |
|
48 |
* 46005 Valencia |
|
49 |
* Spain |
|
50 |
* |
|
51 |
* +34 963163400 |
|
52 |
* dac@iver.es |
|
53 |
*/ |
|
54 |
/* CVS MESSAGES: |
|
55 |
* |
|
56 |
* $Id$ |
|
57 |
* $Log$ |
|
58 |
* |
|
59 |
*/ |
|
60 |
/** |
|
61 |
* This class sends a WFS request and returns the |
|
62 |
* reply in a local File. It tries if the server |
|
63 |
* supports both HTTP Get and Post requests. |
|
64 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
65 |
*/ |
|
66 |
public abstract class WFSRequest extends OGCRequest{ |
|
67 |
protected WFSStatus status = null; |
|
68 |
|
|
69 |
public WFSRequest(WFSStatus status, WFSProtocolHandler protocolHandler) { |
|
70 |
super(status, protocolHandler); |
|
71 |
this.status = status; |
|
72 |
} |
|
73 |
|
|
74 |
/* |
|
75 |
* (non-Javadoc) |
|
76 |
* @see org.gvsig.remoteclient.ogc.request.OGCRequest#sendRequest() |
|
77 |
*/ |
|
78 |
public File sendRequest(ICancellable cancel) throws ConnectException, UnknownHostException, |
|
79 |
IOException { |
|
80 |
if (status != null){ |
|
81 |
((WFSProtocolHandler)protocolHandler).addLastWfsRequestInformation(createRequestInformation()); |
|
82 |
} |
|
83 |
return super.sendRequest(cancel); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Creates a request information |
|
88 |
* @return a request information |
|
89 |
*/ |
|
90 |
public WFSRequestInformation createRequestInformation(){ |
|
91 |
return new WFSRequestInformation(); |
|
92 |
} |
|
93 |
} |
|
0 | 94 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/request/WFSGetFeatureRequestInformation.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.remoteclient.wfs.request; |
|
29 |
|
|
30 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class WFSGetFeatureRequestInformation extends WFSRequestInformation{ |
|
36 |
|
|
37 |
public WFSGetFeatureRequestInformation() { |
|
38 |
super(); |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* The optional numberOfFeatures attribute is used to |
|
43 |
* indicate the number of features that are in the |
|
44 |
* response document. |
|
45 |
*/ |
|
46 |
private int numberOfFeatures = -1; |
|
47 |
|
|
48 |
/** |
|
49 |
* @return the numberOfFeatures |
|
50 |
*/ |
|
51 |
public int getNumberOfFeatures() { |
|
52 |
return numberOfFeatures; |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* @param numberOfFeatures the numberOfFeatures to set |
|
57 |
*/ |
|
58 |
public void setNumberOfFeatures(int numberOfFeatures) { |
|
59 |
this.numberOfFeatures = numberOfFeatures; |
|
60 |
} |
|
61 |
} |
|
62 |
|
|
0 | 63 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/request/WFSTransactionRequest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.remoteclient.wfs.request; |
|
23 |
|
|
24 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
25 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
26 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
27 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
28 |
import org.gvsig.remoteclient.wfs.edition.WFSTTags; |
|
29 |
|
|
30 |
|
|
31 |
/** |
|
32 |
* @author gvSIG Team |
|
33 |
* @version $Id$ |
|
34 |
* |
|
35 |
*/ |
|
36 |
public abstract class WFSTransactionRequest extends WFSRequest{ |
|
37 |
protected static final String UPDATE_PROPERTY_TAG = WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_PROPERTY; |
|
38 |
protected static final String UPDATE_NAME_TAG = WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_NAME;; |
|
39 |
protected static final String UPDATE_VALUE_TAG = WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_VALUE; |
|
40 |
|
|
41 |
/** |
|
42 |
* @param status |
|
43 |
* @param protocolHandler |
|
44 |
*/ |
|
45 |
public WFSTransactionRequest(WFSStatus status, |
|
46 |
WFSProtocolHandler protocolHandler) { |
|
47 |
super(status, protocolHandler); |
|
48 |
} |
|
49 |
|
|
50 |
protected String getTempFilePrefix() { |
|
51 |
return "wfs_transaction.xml"; |
|
52 |
} |
|
53 |
|
|
54 |
protected String getOperationName() { |
|
55 |
return CapabilitiesTags.WFS_TRANSACTION; |
|
56 |
} |
|
57 |
|
|
58 |
public WFSRequestInformation createRequestInformation(){ |
|
59 |
return new WFSTransactionRequestInformation(); |
|
60 |
} |
|
61 |
} |
|
0 | 62 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/request/WFSTLockFeatureRequest.java | ||
---|---|---|
1 |
package org.gvsig.remoteclient.wfs.request; |
|
2 |
|
|
3 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
4 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
5 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
6 |
|
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
8 |
* |
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
10 |
* |
|
11 |
* This program is free software; you can redistribute it and/or |
|
12 |
* modify it under the terms of the GNU General Public License |
|
13 |
* as published by the Free Software Foundation; either version 2 |
|
14 |
* of the License, or (at your option) any later version. |
|
15 |
* |
|
16 |
* This program is distributed in the hope that it will be useful, |
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
* GNU General Public License for more details. |
|
20 |
* |
|
21 |
* You should have received a copy of the GNU General Public License |
|
22 |
* along with this program; if not, write to the Free Software |
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
24 |
* |
|
25 |
* For more information, contact: |
|
26 |
* |
|
27 |
* Generalitat Valenciana |
|
28 |
* Conselleria d'Infraestructures i Transport |
|
29 |
* Av. Blasco Ib??ez, 50 |
|
30 |
* 46010 VALENCIA |
|
31 |
* SPAIN |
|
32 |
* |
|
33 |
* +34 963862235 |
|
34 |
* gvsig@gva.es |
|
35 |
* www.gvsig.gva.es |
|
36 |
* |
|
37 |
* or |
|
38 |
* |
|
39 |
* IVER T.I. S.A |
|
40 |
* Salamanca 50 |
|
41 |
* 46005 Valencia |
|
42 |
* Spain |
|
43 |
* |
|
44 |
* +34 963163400 |
|
45 |
* dac@iver.es |
|
46 |
*/ |
|
47 |
/* CVS MESSAGES: |
|
48 |
* |
|
49 |
* $Id$ |
|
50 |
* $Log$ |
|
51 |
* |
|
52 |
*/ |
|
53 |
/** |
|
54 |
* Web connections are inherently stateless. As a consequence |
|
55 |
* of this, the semantics of serializable transactions are not |
|
56 |
* preserved. To understand the issue, consider an update operation. |
|
57 |
* The client fetches a feature instance. The feature is then |
|
58 |
* modified on the client side, and submitted back to the database |
|
59 |
* via a Transaction request for update. Serializability is lost |
|
60 |
* since there is nothing to guarantee that while the feature was |
|
61 |
* being modified on the client side, another client did not come |
|
62 |
* along and update that same feature in the database. |
|
63 |
* One way to ensure serializability is to require that access to |
|
64 |
* data be done in a mutually exclusive manner; that is while one |
|
65 |
* transaction accesses a data item, no other transaction can modify |
|
66 |
* the same data item. This can be accomplished by using locks that |
|
67 |
* control access to the data. |
|
68 |
* The purpose of the LockFeature operation is to expose a long |
|
69 |
* term feature locking mechanism to ensure consistency. The lock |
|
70 |
* is considered long term because network latency would make |
|
71 |
* feature locks last relatively longer than native commercial |
|
72 |
* database locks. |
|
73 |
* The LockFeature operation is optional and does not need to be |
|
74 |
* implemented for a WFS implementation to conform to this |
|
75 |
* specification. If a WFS implements the LockFeature operation, |
|
76 |
* this fact must be advertised in the capabilities document |
|
77 |
* @see http://www.opengeospatial.org/standards/wfs |
|
78 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
79 |
*/ |
|
80 |
public abstract class WFSTLockFeatureRequest extends WFSRequest{ |
|
81 |
|
|
82 |
public WFSTLockFeatureRequest(WFSStatus status, |
|
83 |
WFSProtocolHandler protocolHandler) { |
|
84 |
super(status, protocolHandler); |
|
85 |
setDeleted(true); |
|
86 |
} |
|
87 |
|
|
88 |
/* |
|
89 |
* (non-Javadoc) |
|
90 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getTempFilePrefix() |
|
91 |
*/ |
|
92 |
protected String getTempFilePrefix() { |
|
93 |
return "wfs_lockFeature.xml"; |
|
94 |
} |
|
95 |
|
|
96 |
/* |
|
97 |
* (non-Javadoc) |
|
98 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getOperationCode() |
|
99 |
*/ |
|
100 |
protected String getOperationName() { |
|
101 |
return CapabilitiesTags.WFS_LOCKFEATURE; |
|
102 |
} |
|
103 |
|
|
104 |
/* |
|
105 |
* (non-Javadoc) |
|
106 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation() |
|
107 |
*/ |
|
108 |
protected String getSchemaLocation() { |
|
109 |
return "../wfs/1.0.0/WFS-transaction.xsd"; |
|
110 |
} |
|
111 |
} |
|
0 | 112 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/request/WFSGetFeatureRequest.java | ||
---|---|---|
1 |
package org.gvsig.remoteclient.wfs.request; |
|
2 |
|
|
3 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
4 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
5 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
6 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
7 |
import org.gvsig.remoteclient.wfs.edition.WFSTTags; |
|
8 |
import org.gvsig.remoteclient.wfs.filters.filterencoding.FilterEncoding; |
|
9 |
|
|
10 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
11 |
* |
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
13 |
* |
|
14 |
* This program is free software; you can redistribute it and/or |
|
15 |
* modify it under the terms of the GNU General Public License |
|
16 |
* as published by the Free Software Foundation; either version 2 |
|
17 |
* of the License, or (at your option) any later version. |
|
18 |
* |
|
19 |
* This program is distributed in the hope that it will be useful, |
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
22 |
* GNU General Public License for more details. |
|
23 |
* |
|
24 |
* You should have received a copy of the GNU General Public License |
|
25 |
* along with this program; if not, write to the Free Software |
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
27 |
* |
|
28 |
* For more information, contact: |
|
29 |
* |
|
30 |
* Generalitat Valenciana |
|
31 |
* Conselleria d'Infraestructures i Transport |
|
32 |
* Av. Blasco Ib??ez, 50 |
|
33 |
* 46010 VALENCIA |
|
34 |
* SPAIN |
|
35 |
* |
|
36 |
* +34 963862235 |
|
37 |
* gvsig@gva.es |
|
38 |
* www.gvsig.gva.es |
|
39 |
* |
|
40 |
* or |
|
41 |
* |
|
42 |
* IVER T.I. S.A |
|
43 |
* Salamanca 50 |
|
44 |
* 46005 Valencia |
|
45 |
* Spain |
|
46 |
* |
|
47 |
* +34 963163400 |
|
48 |
* dac@iver.es |
|
49 |
*/ |
|
50 |
/* CVS MESSAGES: |
|
51 |
* |
|
52 |
* $Id$ |
|
53 |
* $Log$ |
|
54 |
* |
|
55 |
*/ |
|
56 |
/** |
|
57 |
* The GetFeature operation allows retrieval of features from a |
|
58 |
* web feature service. A GetFeature request is processed by |
|
59 |
* a WFS and when the value of the outputFormat attribute is |
|
60 |
* set to text/gml a GML instance document, containing the |
|
61 |
* result set, is returned to the client. |
|
62 |
* @see http://www.opengeospatial.org/standards/wfs |
|
63 |
* @author Jorge Piera Llodrá (jorge.piera@iver.es) |
|
64 |
*/ |
|
65 |
public abstract class WFSGetFeatureRequest extends WFSRequest{ |
|
66 |
|
|
67 |
public WFSGetFeatureRequest(WFSStatus status, |
|
68 |
WFSProtocolHandler protocolHandler) { |
|
69 |
super(status, protocolHandler); |
|
70 |
} |
|
71 |
|
|
72 |
/* |
|
73 |
* (non-Javadoc) |
|
74 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpPostRequest(java.lang.String) |
|
75 |
*/ |
|
76 |
protected String getHttpPostRequest(String onlineResource) { |
|
77 |
StringBuffer request = new StringBuffer(); |
|
78 |
request.append(WFSTTags.XML_ROOT); |
|
79 |
request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
|
80 |
request.append(CapabilitiesTags.WFS_GETFEATURE + " "); |
|
81 |
request.append(CapabilitiesTags.VERSION + "=\"" + protocolHandler.getVersion() + "\" "); |
|
82 |
request.append(WFSTTags.WFST_SERVICE + "=\"WFS\" "); |
|
83 |
if (status.getMaxFeatures() > 0){ |
|
84 |
request.append(CapabilitiesTags.MAXFEATURES + "=\"" + status.getMaxFeatures() + "\" "); |
|
85 |
} |
|
86 |
if (status.getResultType() == WFSStatus.RESULTYPE_HITS){ |
|
87 |
request.append(WFSTTags.WFS_RESULTTYPE + "=\"" + WFSTTags.WFS_HITS + "\" "); |
|
88 |
} |
|
89 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.OGC_NAMESPACE_PREFIX); |
|
90 |
request.append("=\"" + WFSTTags.OGC_NAMESPACE + "\" "); |
|
91 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.WFS_NAMESPACE_PREFIX); |
|
92 |
request.append("=\"" + WFSTTags.WFS_NAMESPACE + "\" "); |
|
93 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.XML_NAMESPACE_PREFIX); |
|
94 |
request.append("=\"" + WFSTTags.XML_NAMESPACE + "\" "); |
|
95 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.GML_NAMESPACE_PREFIX); |
|
96 |
request.append("=\"" + WFSTTags.GML_NAMESPACE + "\" "); |
|
97 |
request.append(WFSTTags.XMLNS + ":" + status.getNamespacePrefix()); |
|
98 |
request.append("=\"" + status.getNamespaceLocation() + "\" "); |
|
99 |
request.append(WFSTTags.XML_NAMESPACE_PREFIX + ":" + WFSTTags.XML_SCHEMALOCATION); |
|
100 |
request.append("=\"" + WFSTTags.WFS_NAMESPACE + " "); |
|
101 |
request.append(getSchemaLocation()); |
|
102 |
request.append("\">"); |
|
103 |
request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
|
104 |
request.append(WFSTTags.WFS_QUERY); |
|
105 |
request.append(" typeName=\"" + status.getFeatureFullName() + "\""); |
|
106 |
request.append(">"); |
|
107 |
if ((status.getFilterByAttribute() != null) || (status.getFilterByArea() != null)){ |
|
108 |
FilterEncoding filterEncoding = new FilterEncoding(status); |
|
109 |
request.append(filterEncoding.toString(protocolHandler.getVersion())); |
|
110 |
} |
|
111 |
request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
|
112 |
request.append(WFSTTags.WFS_QUERY); |
|
113 |
request.append(">"); |
|
114 |
request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
|
115 |
request.append(CapabilitiesTags.WFS_GETFEATURE + ">"); |
|
116 |
return request.toString(); |
|
117 |
} |
|
118 |
|
|
119 |
/* |
|
120 |
* (non-Javadoc) |
|
121 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getOperationCode() |
|
122 |
*/ |
|
123 |
protected String getOperationName() { |
|
124 |
return CapabilitiesTags.WFS_GETFEATURE; |
|
125 |
} |
|
126 |
|
|
127 |
/* |
|
128 |
* (non-Javadoc) |
|
129 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation() |
|
130 |
*/ |
|
131 |
protected String getSchemaLocation() { |
|
132 |
return null; |
|
133 |
} |
|
134 |
|
|
135 |
/* |
|
136 |
* (non-Javadoc) |
|
137 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getTempFilePrefix() |
|
138 |
*/ |
|
139 |
protected String getTempFilePrefix() { |
|
140 |
return "wfs_getFeature.gml"; |
|
141 |
} |
|
142 |
|
|
143 |
/* |
|
144 |
* (non-Javadoc) |
|
145 |
* @see org.gvsig.remoteclient.wfs.request.WFSRequest#createRequestInformation() |
|
146 |
*/ |
|
147 |
public WFSRequestInformation createRequestInformation() { |
|
148 |
return new WFSGetFeatureRequestInformation(); |
|
149 |
} |
|
150 |
|
|
151 |
|
|
152 |
} |
|
0 | 153 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/request/WFSTransactionRequestInformation.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.remoteclient.wfs.request; |
|
23 |
|
|
24 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @author gvSIG Team |
|
29 |
* @version $Id$ |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class WFSTransactionRequestInformation extends WFSRequestInformation{ |
|
33 |
//Transaction message |
|
34 |
public String message = null; |
|
35 |
|
|
36 |
//Status |
|
37 |
public static final int STATUS_NO_EXECUTED = 0; |
|
38 |
public static final int STATUS_FAILED = 1; |
|
39 |
public static final int STATUS_SUCCESS = 2; |
|
40 |
private int status = 0; |
|
41 |
|
|
42 |
public WFSTransactionRequestInformation() { |
|
43 |
super(); |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* @return the status |
|
48 |
*/ |
|
49 |
public int getStatus() { |
|
50 |
return status; |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* @param status the status to set |
|
55 |
*/ |
|
56 |
public void setStatus(int status) { |
|
57 |
this.status = status; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* @return the message |
|
62 |
*/ |
|
63 |
public String getMessage() { |
|
64 |
return message; |
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* @param message the message to set |
|
69 |
*/ |
|
70 |
public void setMessage(String message) { |
|
71 |
this.message = message; |
|
72 |
} |
|
73 |
} |
|
0 | 74 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/WFSFeature.java | ||
---|---|---|
1 |
package org.gvsig.remoteclient.wfs; |
|
2 |
|
|
3 |
import java.util.Hashtable; |
|
4 |
import java.util.Vector; |
|
5 |
|
|
6 |
import org.gvsig.remoteclient.utils.BoundaryBox; |
|
7 |
import org.gvsig.remoteclient.wfs.schema.XMLNameSpace; |
|
8 |
|
|
9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
10 |
* |
|
11 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
12 |
* |
|
13 |
* This program is free software; you can redistribute it and/or |
|
14 |
* modify it under the terms of the GNU General Public License |
|
15 |
* as published by the Free Software Foundation; either version 2 |
|
16 |
* of the License, or (at your option) any later version. |
|
17 |
* |
|
18 |
* This program is distributed in the hope that it will be useful, |
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
* GNU General Public License for more details. |
|
22 |
* |
|
23 |
* You should have received a copy of the GNU General Public License |
|
24 |
* along with this program; if not, write to the Free Software |
|
25 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
26 |
* |
|
27 |
* For more information, contact: |
|
28 |
* |
|
29 |
* Generalitat Valenciana |
|
30 |
* Conselleria d'Infraestructures i Transport |
|
31 |
* Av. Blasco Ib??ez, 50 |
|
32 |
* 46010 VALENCIA |
|
33 |
* SPAIN |
|
34 |
* |
|
35 |
* +34 963862235 |
|
36 |
* gvsig@gva.es |
|
37 |
* www.gvsig.gva.es |
|
38 |
* |
|
39 |
* or |
|
40 |
* |
|
41 |
* IVER T.I. S.A |
|
42 |
* Salamanca 50 |
|
43 |
* 46005 Valencia |
|
44 |
* Spain |
|
45 |
* |
|
46 |
* +34 963163400 |
|
47 |
* dac@iver.es |
|
48 |
*/ |
|
49 |
/* CVS MESSAGES: |
|
50 |
* |
|
51 |
* $Id$ |
|
52 |
* $Log$ |
|
53 |
* Revision 1.7 2007-09-20 09:30:12 jaume |
|
54 |
* removed unnecessary imports |
|
55 |
* |
|
56 |
* Revision 1.6 2007/02/09 14:11:01 jorpiell |
|
57 |
* Primer piloto del soporte para WFS 1.1 y para WFS-T |
|
58 |
* |
|
59 |
* Revision 1.5 2006/06/15 09:05:06 jorpiell |
|
60 |
* Actualizados los WFS |
|
61 |
* |
|
62 |
* Revision 1.4 2006/05/23 13:23:22 jorpiell |
|
63 |
* Se ha cambiado el final del bucle de parseado y se tiene en cuenta el online resource |
|
64 |
* |
|
65 |
* Revision 1.2 2006/04/20 16:39:16 jorpiell |
|
66 |
* A?adida la operacion de describeFeatureType y el parser correspondiente. |
|
67 |
* |
|
68 |
* Revision 1.1 2006/04/19 12:51:35 jorpiell |
|
69 |
* A?adidas algunas de las clases del servicio WFS |
|
70 |
* |
|
71 |
* |
|
72 |
*/ |
|
73 |
/** |
|
74 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
75 |
*/ |
|
76 |
public class WFSFeature extends WFSFeatureField { |
|
77 |
private String localName = null; |
|
78 |
private String title = null; |
|
79 |
private String _abstract = null; |
|
80 |
private Vector srs = new Vector(); |
|
81 |
private String defaultSRS = null; |
|
82 |
private BoundaryBox latLonBbox = null; |
|
83 |
private Hashtable bBoxes = new Hashtable(); |
|
84 |
private Vector keywords = new Vector(); |
|
85 |
private XMLNameSpace namespace = null; |
|
86 |
private WFSServiceInformation serviceInformation; |
|
87 |
private boolean isCompleted = false; |
|
88 |
|
|
89 |
protected WFSFeature(WFSServiceInformation serviceInformation){ |
|
90 |
super(); |
|
91 |
this.serviceInformation = serviceInformation; |
|
92 |
} |
|
93 |
|
|
94 |
protected WFSFeature(WFSServiceInformation serviceInformation, String name){ |
|
95 |
super(); |
|
96 |
this.serviceInformation = serviceInformation; |
|
97 |
setName(name); |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* @return Returns the _abstract. |
|
102 |
*/ |
|
103 |
public String getAbstract() { |
|
104 |
return _abstract; |
|
105 |
} |
|
106 |
/** |
|
107 |
* @param _abstract The _abstract to set. |
|
108 |
*/ |
|
109 |
public void setAbstract(String _abstract) { |
|
110 |
this._abstract = _abstract; |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* @param name The name to set. |
|
115 |
*/ |
|
116 |
public void setName(String name) { |
|
117 |
this.name = name; |
|
118 |
int index = name.indexOf(":"); |
|
119 |
if (index > 0){ |
|
120 |
String prefix = name.substring(0, index); |
|
121 |
localName = name.substring(index+1, name.length()); |
|
122 |
String nameSpace = serviceInformation.getNamespace(prefix); |
|
123 |
this.setNamespace(new XMLNameSpace(prefix, nameSpace)); |
|
124 |
} |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* @return Returns the title. |
|
129 |
*/ |
|
130 |
public String getTitle() { |
|
131 |
if ((title == null) || |
|
132 |
(title.equals(""))){ |
|
133 |
return name; |
|
134 |
} |
|
135 |
return title; |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* @param title The title to set. |
|
140 |
*/ |
|
141 |
public void setTitle(String title) { |
|
142 |
this.title = title; |
|
143 |
} |
|
144 |
|
|
145 |
/** |
|
146 |
* @return Returns the latLonBbox. |
|
147 |
*/ |
|
148 |
public BoundaryBox getLatLonBbox() { |
|
149 |
return latLonBbox; |
|
150 |
} |
|
151 |
/** |
|
152 |
* @param latLonBbox The latLonBbox to set. |
|
153 |
*/ |
|
154 |
public void setLatLonBbox(BoundaryBox latLonBbox) { |
|
155 |
this.latLonBbox = latLonBbox; |
|
156 |
} |
|
157 |
/** |
|
158 |
* @return Returns the keywords. |
|
159 |
*/ |
|
160 |
public Vector getKeywords() { |
|
161 |
return keywords; |
|
162 |
} |
|
163 |
|
|
164 |
public void addKeyword(String keyword){ |
|
165 |
keywords.add(keyword); |
|
166 |
} |
|
167 |
/** |
|
168 |
* @return Returns the srs. |
|
169 |
*/ |
|
170 |
public Vector getSrs() { |
|
171 |
return srs; |
|
172 |
} |
|
173 |
|
|
174 |
public void addSRS(String key){ |
|
175 |
String epsgCode = getEPSGCode(key); |
|
176 |
if (!this.srs.contains(epsgCode)){ |
|
177 |
srs.add(epsgCode); |
|
178 |
} |
|
179 |
if (defaultSRS == null){ |
|
180 |
defaultSRS = epsgCode; |
|
181 |
} |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* <p>Adds a bbox to the Bboxes vector</p> |
|
186 |
* @param bbox |
|
187 |
*/ |
|
188 |
public void addBBox(BoundaryBox bbox) { |
|
189 |
bBoxes.put(bbox.getSrs(), bbox); |
|
190 |
} |
|
191 |
|
|
192 |
/** |
|
193 |
* <p>returns the bbox with that id in the Bboxes vector</p> |
|
194 |
* @param id |
|
195 |
*/ |
|
196 |
public BoundaryBox getBbox(String id) { |
|
197 |
return (BoundaryBox)bBoxes.get(id); |
|
198 |
} |
|
199 |
/** |
|
200 |
* @return Returns the namespace. |
|
201 |
*/ |
|
202 |
public XMLNameSpace getNamespace() { |
|
203 |
return namespace; |
|
204 |
} |
|
205 |
/** |
|
206 |
* @param namespace The namespace to set. |
|
207 |
*/ |
|
208 |
public void setNamespace(XMLNameSpace namespace) { |
|
209 |
this.namespace = namespace; |
|
210 |
} |
|
211 |
|
|
212 |
/** |
|
213 |
* @return the localName |
|
214 |
*/ |
|
215 |
public String getLocalName() { |
|
216 |
return localName; |
|
217 |
} |
|
218 |
|
|
219 |
|
|
220 |
/** |
|
221 |
* @return the isCompleted |
|
222 |
*/ |
|
223 |
public boolean isCompleted() { |
|
224 |
return isCompleted; |
|
225 |
} |
|
226 |
|
|
227 |
/** |
|
228 |
* @param isCompleted the isCompleted to set |
|
229 |
*/ |
|
230 |
public void setCompleted(boolean isCompleted) { |
|
231 |
this.isCompleted = isCompleted; |
|
232 |
} |
|
233 |
|
|
234 |
/** |
|
235 |
* @return the defaultSRS |
|
236 |
*/ |
|
237 |
public String getDefaultSRS() { |
|
238 |
return defaultSRS; |
|
239 |
} |
|
240 |
|
|
241 |
|
|
242 |
/** |
|
243 |
* @param defaultSRS the defaultSRS to set |
|
244 |
*/ |
|
245 |
public void setDefaultSRS(String defaultSRS) { |
|
246 |
this.defaultSRS = getEPSGCode(defaultSRS); |
|
247 |
addSRS(defaultSRS); |
|
248 |
} |
|
249 |
|
|
250 |
private String getEPSGCode(String srs){ |
|
251 |
if (srs == null){ |
|
252 |
return null; |
|
253 |
} |
|
254 |
if ((srs.startsWith("urn:x-ogc:def:crs:")) || srs.startsWith("urn:ogc:def:crs:")){ |
|
255 |
String newString = srs.substring(srs.lastIndexOf(":") + 1, srs.length()); |
|
256 |
if (srs.indexOf("EPSG") > 0){ |
|
257 |
if (newString.indexOf("EPSG") < 0){ |
|
258 |
newString = "EPSG:" + newString; |
|
259 |
} |
|
260 |
} |
|
261 |
return newString; |
|
262 |
} |
|
263 |
if (srs.toLowerCase().startsWith("crs:")){ |
|
264 |
return srs.substring(4, srs.length()); |
|
265 |
} |
|
266 |
return srs; |
|
267 |
} |
|
268 |
|
|
269 |
} |
|
0 | 270 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/edition/WFSTDeleteOperation.java | ||
---|---|---|
1 |
package org.gvsig.remoteclient.wfs.edition; |
|
2 |
|
|
3 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
4 |
|
|
5 |
|
|
6 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
7 |
* |
|
8 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
9 |
* |
|
10 |
* This program is free software; you can redistribute it and/or |
|
11 |
* modify it under the terms of the GNU General Public License |
|
12 |
* as published by the Free Software Foundation; either version 2 |
|
13 |
* of the License, or (at your option) any later version. |
|
14 |
* |
|
15 |
* This program is distributed in the hope that it will be useful, |
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
* GNU General Public License for more details. |
|
19 |
* |
|
20 |
* You should have received a copy of the GNU General Public License |
|
21 |
* along with this program; if not, write to the Free Software |
|
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
23 |
* |
|
24 |
* For more information, contact: |
|
25 |
* |
|
26 |
* Generalitat Valenciana |
|
27 |
* Conselleria d'Infraestructures i Transport |
|
28 |
* Av. Blasco Ib??ez, 50 |
|
29 |
* 46010 VALENCIA |
|
30 |
* SPAIN |
|
31 |
* |
|
32 |
* +34 963862235 |
|
33 |
* gvsig@gva.es |
|
34 |
* www.gvsig.gva.es |
|
35 |
* |
|
36 |
* or |
|
37 |
* |
|
38 |
* IVER T.I. S.A |
|
39 |
* Salamanca 50 |
|
40 |
* 46005 Valencia |
|
41 |
* Spain |
|
42 |
* |
|
43 |
* +34 963163400 |
|
44 |
* dac@iver.es |
|
45 |
*/ |
|
46 |
/* CVS MESSAGES: |
|
47 |
* |
|
48 |
* $Id$ |
|
49 |
* $Log$ |
|
50 |
* |
|
51 |
*/ |
|
52 |
/** |
|
53 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
54 |
*/ |
|
55 |
public class WFSTDeleteOperation extends WFSTOperation { |
|
56 |
|
|
57 |
protected WFSTDeleteOperation(WFSStatus wfsStatus, String id) { |
|
58 |
super(wfsStatus, id); |
|
59 |
} |
|
60 |
|
|
61 |
public String getOperationName() { |
|
62 |
return "Delete"; |
|
63 |
} |
|
64 |
|
|
65 |
public boolean hasTypeName(){ |
|
66 |
return true; |
|
67 |
} |
|
68 |
} |
|
0 | 69 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/edition/WFSTUpdateOperation.java | ||
---|---|---|
1 |
package org.gvsig.remoteclient.wfs.edition; |
|
2 |
|
|
3 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
4 |
|
|
5 |
|
|
6 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
7 |
* |
|
8 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
9 |
* |
|
10 |
* This program is free software; you can redistribute it and/or |
|
11 |
* modify it under the terms of the GNU General Public License |
|
12 |
* as published by the Free Software Foundation; either version 2 |
|
13 |
* of the License, or (at your option) any later version. |
|
14 |
* |
|
15 |
* This program is distributed in the hope that it will be useful, |
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
* GNU General Public License for more details. |
|
19 |
* |
|
20 |
* You should have received a copy of the GNU General Public License |
|
21 |
* along with this program; if not, write to the Free Software |
|
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
23 |
* |
|
24 |
* For more information, contact: |
|
25 |
* |
|
26 |
* Generalitat Valenciana |
|
27 |
* Conselleria d'Infraestructures i Transport |
|
28 |
* Av. Blasco Ib??ez, 50 |
|
29 |
* 46010 VALENCIA |
|
30 |
* SPAIN |
|
31 |
* |
|
32 |
* +34 963862235 |
|
33 |
* gvsig@gva.es |
|
34 |
* www.gvsig.gva.es |
|
35 |
* |
|
36 |
* or |
|
37 |
* |
|
38 |
* IVER T.I. S.A |
|
39 |
* Salamanca 50 |
|
40 |
* 46005 Valencia |
|
41 |
* Spain |
|
42 |
* |
|
43 |
* +34 963163400 |
|
44 |
* dac@iver.es |
|
45 |
*/ |
|
46 |
/* CVS MESSAGES: |
|
47 |
* |
|
48 |
* $Id$ |
|
49 |
* $Log$ |
|
50 |
* |
|
51 |
*/ |
|
52 |
/** |
|
53 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
54 |
*/ |
|
55 |
public class WFSTUpdateOperation extends WFSTAttributesOperation { |
|
56 |
|
|
57 |
protected WFSTUpdateOperation(WFSStatus wfsStatus, String id) { |
|
58 |
super(wfsStatus, id); |
|
59 |
} |
|
60 |
|
|
61 |
public String getOperationName() { |
|
62 |
return "Update"; |
|
63 |
} |
|
64 |
|
|
65 |
public boolean hasTypeName(){ |
|
66 |
return true; |
|
67 |
} |
|
68 |
} |
|
0 | 69 |
tags/v2_0_0_Build_2049/libraries/libRemoteServices/src/org/gvsig/remoteclient/wfs/edition/WFSTInsertOperation.java | ||
---|---|---|
1 |
package org.gvsig.remoteclient.wfs.edition; |
|
2 |
|
|
3 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
4 |
|
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
6 |
* |
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
8 |
* |
|
9 |
* This program is free software; you can redistribute it and/or |
|
10 |
* modify it under the terms of the GNU General Public License |
|
11 |
* as published by the Free Software Foundation; either version 2 |
|
12 |
* of the License, or (at your option) any later version. |
|
13 |
* |
|
14 |
* This program is distributed in the hope that it will be useful, |
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
* GNU General Public License for more details. |
|
18 |
* |
|
19 |
* You should have received a copy of the GNU General Public License |
|
20 |
* along with this program; if not, write to the Free Software |
Also available in: Unified diff