Revision 1015
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<artifactId>org.gvsig.wfs.app</artifactId> |
|
4 |
<packaging>pom</packaging> |
|
5 |
|
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<description>Web Feature Service support</description> |
|
8 |
<version>2.0.180</version> |
|
9 |
|
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.desktop</artifactId> |
|
13 |
<version>2.0.371</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-wfs</url> |
|
17 |
|
|
18 |
<repositories> |
|
19 |
<repository> |
|
20 |
<id>gvsig-public-http-repository</id> |
|
21 |
<name>gvSIG maven public HTTP repository</name> |
|
22 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
23 |
<releases> |
|
24 |
<enabled>true</enabled> |
|
25 |
<updatePolicy>daily</updatePolicy> |
|
26 |
<checksumPolicy>warn</checksumPolicy> |
|
27 |
</releases> |
|
28 |
<snapshots> |
|
29 |
<enabled>true</enabled> |
|
30 |
<updatePolicy>daily</updatePolicy> |
|
31 |
<checksumPolicy>warn</checksumPolicy> |
|
32 |
</snapshots> |
|
33 |
</repository> |
|
34 |
</repositories> |
|
35 |
|
|
36 |
<scm> |
|
37 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180</connection> |
|
38 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180</developerConnection> |
|
39 |
<url>scm:svn:https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180</url> |
|
40 |
</scm> |
|
41 |
|
|
42 |
<build> |
|
43 |
<plugins> |
|
44 |
<plugin> |
|
45 |
<groupId>org.apache.maven.plugins</groupId> |
|
46 |
<artifactId>maven-release-plugin</artifactId> |
|
47 |
<configuration> |
|
48 |
<tagBase>https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags</tagBase> |
|
49 |
</configuration> |
|
50 |
</plugin> |
|
51 |
</plugins> |
|
52 |
</build> |
|
53 |
|
|
54 |
<properties> |
|
55 |
<org.gvsig.gpe.version>2.1.188</org.gvsig.gpe.version> |
|
56 |
<org.gvsig.xmlschema.version>2.0.43</org.gvsig.xmlschema.version> |
|
57 |
</properties> |
|
58 |
|
|
59 |
<dependencyManagement> |
|
60 |
<dependencies> |
|
61 |
<!-- Childs --> |
|
62 |
<dependency> |
|
63 |
<groupId>org.gvsig</groupId> |
|
64 |
<artifactId>org.gvsig.wfs.app.mainplugin</artifactId> |
|
65 |
<version>2.0.180</version> |
|
66 |
</dependency> |
|
67 |
|
|
68 |
<!-- Extern libraries --> |
|
69 |
|
|
70 |
<!-- gvSIG extern libraries --> |
|
71 |
<dependency> |
|
72 |
<groupId>org.gvsig</groupId> |
|
73 |
<artifactId>org.gvsig.gpe</artifactId> |
|
74 |
<version>${org.gvsig.gpe.version}</version> |
|
75 |
<type>pom</type> |
|
76 |
<scope>import</scope> |
|
77 |
<exclusions> |
|
78 |
<exclusion> |
|
79 |
<groupId>org.gvsig</groupId> |
|
80 |
<artifactId>org.gvsig.tools.*</artifactId> |
|
81 |
</exclusion> |
|
82 |
</exclusions> |
|
83 |
</dependency> |
|
84 |
<dependency> |
|
85 |
<!-- Para proximas versiones de GPE, >2.1.80, quitar esta dependencia --> |
|
86 |
<groupId>org.gvsig</groupId> |
|
87 |
<artifactId>org.gvsig.gpe.app.mainplugin</artifactId> |
|
88 |
<version>${org.gvsig.gpe.version}</version> |
|
89 |
</dependency> |
|
90 |
<dependency> |
|
91 |
<groupId>org.gvsig</groupId> |
|
92 |
<artifactId>org.gvsig.xmlschema</artifactId> |
|
93 |
<version>${org.gvsig.xmlschema.version}</version> |
|
94 |
<type>pom</type> |
|
95 |
<scope>import</scope> |
|
96 |
<exclusions> |
|
97 |
<exclusion> |
|
98 |
<groupId>org.gvsig</groupId> |
|
99 |
<artifactId>org.gvsig.tools.*</artifactId> |
|
100 |
</exclusion> |
|
101 |
</exclusions> |
|
102 |
</dependency> |
|
103 |
|
|
104 |
</dependencies> |
|
105 |
</dependencyManagement> |
|
106 |
|
|
107 |
<modules> |
|
108 |
<module>org.gvsig.wfs.app.mainplugin</module> |
|
109 |
</modules> |
|
110 |
|
|
111 |
</project> |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Fri Apr 22 02:13:52 CEST 2022 |
|
2 |
buildNumber=2264 |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
<!-- |
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
<includes> |
|
32 |
<include>org.gvsig:org.gvsig.wfs.app.mainplugin</include> |
|
33 |
</includes> |
|
34 |
</dependencySet> |
|
35 |
</dependencySets> |
|
36 |
--> |
|
37 |
|
|
38 |
</assembly> |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/WFSProtocolHandlerFactory.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs; |
|
25 |
|
|
26 |
import java.io.File; |
|
27 |
import java.io.FileReader; |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.Reader; |
|
30 |
import java.net.ConnectException; |
|
31 |
import java.net.URL; |
|
32 |
import java.util.ArrayList; |
|
33 |
import java.util.Iterator; |
|
34 |
import java.util.List; |
|
35 |
|
|
36 |
import org.kxml2.io.KXmlParser; |
|
37 |
import org.xmlpull.v1.XmlPullParserException; |
|
38 |
|
|
39 |
import org.gvsig.compat.CompatLocator; |
|
40 |
import org.gvsig.compat.lang.StringUtils; |
|
41 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
42 |
import org.gvsig.remoteclient.utils.EncodingXMLParser; |
|
43 |
import org.gvsig.remoteclient.utils.Utilities; |
|
44 |
import org.slf4j.Logger; |
|
45 |
import org.slf4j.LoggerFactory; |
|
46 |
|
|
47 |
/** |
|
48 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
49 |
*/ |
|
50 |
public class WFSProtocolHandlerFactory { |
|
51 |
private static Logger logger = LoggerFactory.getLogger(WFSProtocolHandlerFactory.class); |
|
52 |
|
|
53 |
public WFSProtocolHandler wFSProtocolHandler; |
|
54 |
private static final StringUtils stringUtils = CompatLocator.getStringUtils(); |
|
55 |
private static ArrayList supportedVersions = new ArrayList(); |
|
56 |
|
|
57 |
static { |
|
58 |
supportedVersions.add("1.1.0"); |
|
59 |
supportedVersions.add("1.0.0"); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* M?todo que dada una respuesta de getCapabilities y un iterador sobre una |
|
64 |
* coleccion de WFSClient's ordenada descendentemente devuelve el cliente |
|
65 |
* cuya version es igual o inmediatamente inferior |
|
66 |
* |
|
67 |
* @param caps Capabilities con la respuesta del servidor |
|
68 |
* @param clients Iterador de conjunto ordenado descendientemente |
|
69 |
* |
|
70 |
* @return cliente cuya version es igual o inmediatamente inferior |
|
71 |
* @throws IllegalAccessException |
|
72 |
* @throws InstantiationException |
|
73 |
* |
|
74 |
*/ |
|
75 |
private static String getDriverVersion(String version, Iterator clients) throws InstantiationException, IllegalAccessException { |
|
76 |
while (clients.hasNext()) { |
|
77 |
String clientVersion = (String)clients.next(); |
|
78 |
int ret = version.compareTo(clientVersion); |
|
79 |
|
|
80 |
if (ret >= 0) { |
|
81 |
return clientVersion; |
|
82 |
} |
|
83 |
} |
|
84 |
return null; |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Establece la versi?n con la que se comunicar? con el servidor y devuelve |
|
89 |
* el objeto Capabilities obtenido con dicha versi?n |
|
90 |
* |
|
91 |
* @param host maquina con la que se negocia |
|
92 |
* |
|
93 |
* @return instancia de un cliente capaz de negociar con el host que se |
|
94 |
* pasa como par?metro |
|
95 |
*/ |
|
96 |
public static WFSProtocolHandler negotiate(String host, boolean ignoreCache) throws ConnectException, IOException { |
|
97 |
|
|
98 |
if (supportedVersions.size() == 0){ |
|
99 |
return null; |
|
100 |
} |
|
101 |
|
|
102 |
try { |
|
103 |
String highestVersionSupportedByServer = getSuitableWFSVersion(host,"", ignoreCache); |
|
104 |
if (supportedVersions.contains(highestVersionSupportedByServer)) |
|
105 |
{ |
|
106 |
// we support the highest version supported by the server |
|
107 |
// this is the best case |
|
108 |
return createVersionDriver(highestVersionSupportedByServer); |
|
109 |
} |
|
110 |
else |
|
111 |
{ |
|
112 |
// in case we dont support the highest version from the server |
|
113 |
// we start the negotiation process in which we have to get the higest version |
|
114 |
// the WFS supports and we are able to read. |
|
115 |
Iterator iVersion = supportedVersions.iterator(); |
|
116 |
String wfsVersion; |
|
117 |
String gvSIGVersion; |
|
118 |
|
|
119 |
while (iVersion.hasNext()) { |
|
120 |
gvSIGVersion = (String)iVersion.next(); |
|
121 |
wfsVersion = getSuitableWFSVersion(host,gvSIGVersion, ignoreCache); |
|
122 |
//TODO: |
|
123 |
//compare with the version returned by the WMS!!!!! |
|
124 |
// send GetCapabilities and read the version to compare. |
|
125 |
int res = wfsVersion.compareTo(gvSIGVersion); |
|
126 |
|
|
127 |
if (res == 0) { //Si es la misma que nuestra version |
|
128 |
return createVersionDriver(gvSIGVersion); |
|
129 |
} else if (res > 0) { //Si es mayor que nuestra version |
|
130 |
throw new Exception("Server Version too high: " + wfsVersion); |
|
131 |
} else { //Si es menor que nuestra version |
|
132 |
//Obtenemos la primera version menor o igual que tengamos |
|
133 |
String lowerVersion = WFSProtocolHandlerFactory.getDriverVersion(wfsVersion, iVersion); |
|
134 |
|
|
135 |
if (lowerVersion == null) { //Si no hay ninguna |
|
136 |
throw new Exception("Lowest server version is " + wfsVersion); |
|
137 |
} else { |
|
138 |
if (lowerVersion.equals(wfsVersion)) { |
|
139 |
return createVersionDriver(lowerVersion); |
|
140 |
} else { //Si hay una version menor que la que retorno el servidor |
|
141 |
//iV = lower; |
|
142 |
} |
|
143 |
} |
|
144 |
} |
|
145 |
} |
|
146 |
}//case we had to start the negotiation process. |
|
147 |
return null; // if it did not find any suitable version. |
|
148 |
} |
|
149 |
catch(ConnectException conEx) |
|
150 |
{ |
|
151 |
throw conEx; |
|
152 |
} |
|
153 |
catch(IOException ioEx) |
|
154 |
{ |
|
155 |
throw ioEx; |
|
156 |
} |
|
157 |
catch(Exception e) |
|
158 |
{ |
|
159 |
logger.warn("Can't negotiate version for host '"+host+"'.",e); |
|
160 |
return null; |
|
161 |
} |
|
162 |
} |
|
163 |
|
|
164 |
/** |
|
165 |
* Sends a GetCapabilities to the WFS server to get the version |
|
166 |
* if the version parameter is null, the WFS will return the highest version supported |
|
167 |
* if not it will return the lower highest version than the one requested. |
|
168 |
* @param host |
|
169 |
* @param version |
|
170 |
* @return suitable version supported by the server |
|
171 |
*/ |
|
172 |
private static String getSuitableWFSVersion(String host, String _version, boolean ignoreCache) throws ConnectException, IOException { |
|
173 |
String request = WFSProtocolHandler.buildCapabilitiesSuitableVersionRequest(host, _version); |
|
174 |
String version = new String(); |
|
175 |
Reader reader = null; |
|
176 |
File file = null; |
|
177 |
try { |
|
178 |
URL url = new URL(request); |
|
179 |
if( ignoreCache ) { |
|
180 |
Utilities.removeURL(url); |
|
181 |
} |
|
182 |
file = Utilities.downloadFile(url, "wfs-suitable-version", null); |
|
183 |
|
|
184 |
reader = new FileReader(file); |
|
185 |
EncodingXMLParser kxmlParser = new EncodingXMLParser(); |
|
186 |
kxmlParser.setInput(reader); |
|
187 |
kxmlParser.nextTag(); |
|
188 |
if ( kxmlParser.getEventType() != KXmlParser.END_DOCUMENT ) { |
|
189 |
String tag = kxmlParser.getName(); |
|
190 |
if (stringUtils.split(tag, ":").length == 2){ |
|
191 |
tag = stringUtils.split(tag, ":")[1]; |
|
192 |
} |
|
193 |
if ((tag.compareTo(CapabilitiesTags.WFS_CAPABILITIES_ROOT1_0_0)==0)) { |
|
194 |
version = kxmlParser.getAttributeValue("", CapabilitiesTags.VERSION); |
|
195 |
} |
|
196 |
} |
|
197 |
// do not forget to close the Stream. |
|
198 |
reader.close(); |
|
199 |
return version; |
|
200 |
} catch(ConnectException conEx) { |
|
201 |
throw new ConnectException(conEx.getMessage()); |
|
202 |
} catch(IOException ioEx) { |
|
203 |
throw new IOException(ioEx.getMessage()); |
|
204 |
} catch(XmlPullParserException xmlEx) { |
|
205 |
String fname = ""; |
|
206 |
if( file != null ) { |
|
207 |
fname = file.getAbsolutePath(); |
|
208 |
} |
|
209 |
logger.warn("Can't get suitable WFS version for host '"+host+"' from file '"+fname+"'.",xmlEx); |
|
210 |
return ""; |
|
211 |
} finally { |
|
212 |
if (reader != null) { |
|
213 |
try { |
|
214 |
reader.close(); |
|
215 |
} catch(Exception ex) { |
|
216 |
logger.warn("Can't close reader.",ex); |
|
217 |
} |
|
218 |
} |
|
219 |
} |
|
220 |
} |
|
221 |
|
|
222 |
/** |
|
223 |
* Gets the intersection between the versions supported by the server |
|
224 |
* and the versions supported by the application |
|
225 |
* @throws IOException |
|
226 |
* @throws ConnectException |
|
227 |
*/ |
|
228 |
public static List getRequestableVersions(String host, boolean ignoreCache) throws |
|
229 |
ConnectException, IOException { |
|
230 |
|
|
231 |
Iterator iVersion = supportedVersions.iterator(); |
|
232 |
String wfsVersion; |
|
233 |
String gvSIGVersion; |
|
234 |
|
|
235 |
ArrayList resp = new ArrayList(); |
|
236 |
|
|
237 |
while (iVersion.hasNext()) { |
|
238 |
gvSIGVersion = (String)iVersion.next(); |
|
239 |
wfsVersion = getSuitableWFSVersion(host,gvSIGVersion, ignoreCache); |
|
240 |
if (gvSIGVersion.compareTo(wfsVersion) == 0) { |
|
241 |
resp.add(gvSIGVersion); |
|
242 |
} |
|
243 |
} |
|
244 |
return resp; |
|
245 |
} |
|
246 |
|
|
247 |
/** |
|
248 |
* It creates an instance of a WFSDriver class. |
|
249 |
* |
|
250 |
* @param String, with the version of the driver to be created |
|
251 |
* @return WFSDriver. |
|
252 |
*/ |
|
253 |
public static WFSProtocolHandler createVersionDriver(String version) { |
|
254 |
try { |
|
255 |
Class driver; |
|
256 |
version = version.replace('.', '_'); |
|
257 |
driver = Class.forName("org.gvsig.remoteclient.wfs.wfs_"+version+".WFSProtocolHandler" + version); |
|
258 |
return (WFSProtocolHandler)driver.newInstance(); |
|
259 |
} catch (Exception e) { |
|
260 |
logger.warn("Can't create driver for WFS version '"+version+"'.",e); |
|
261 |
return null; |
|
262 |
} |
|
263 |
} |
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
} |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/request/WFSTLockFeatureRequest.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.request; |
|
25 |
|
|
26 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
27 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
28 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
29 |
|
|
30 |
/** |
|
31 |
* Web connections are inherently stateless. As a consequence |
|
32 |
* of this, the semantics of serializable transactions are not |
|
33 |
* preserved. To understand the issue, consider an update operation. |
|
34 |
* The client fetches a feature instance. The feature is then |
|
35 |
* modified on the client side, and submitted back to the database |
|
36 |
* via a Transaction request for update. Serializability is lost |
|
37 |
* since there is nothing to guarantee that while the feature was |
|
38 |
* being modified on the client side, another client did not come |
|
39 |
* along and update that same feature in the database. |
|
40 |
* One way to ensure serializability is to require that access to |
|
41 |
* data be done in a mutually exclusive manner; that is while one |
|
42 |
* transaction accesses a data item, no other transaction can modify |
|
43 |
* the same data item. This can be accomplished by using locks that |
|
44 |
* control access to the data. |
|
45 |
* The purpose of the LockFeature operation is to expose a long |
|
46 |
* term feature locking mechanism to ensure consistency. The lock |
|
47 |
* is considered long term because network latency would make |
|
48 |
* feature locks last relatively longer than native commercial |
|
49 |
* database locks. |
|
50 |
* The LockFeature operation is optional and does not need to be |
|
51 |
* implemented for a WFS implementation to conform to this |
|
52 |
* specification. If a WFS implements the LockFeature operation, |
|
53 |
* this fact must be advertised in the capabilities document |
|
54 |
* @see http://www.opengeospatial.org/standards/wfs |
|
55 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
56 |
*/ |
|
57 |
public abstract class WFSTLockFeatureRequest extends WFSRequest{ |
|
58 |
|
|
59 |
public WFSTLockFeatureRequest(WFSStatus status, |
|
60 |
WFSProtocolHandler protocolHandler) { |
|
61 |
super(status, protocolHandler); |
|
62 |
setDeleted(true); |
|
63 |
} |
|
64 |
|
|
65 |
/* |
|
66 |
* (non-Javadoc) |
|
67 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getTempFilePrefix() |
|
68 |
*/ |
|
69 |
protected String getTempFilePrefix() { |
|
70 |
return "wfs_lockFeature.xml"; |
|
71 |
} |
|
72 |
|
|
73 |
/* |
|
74 |
* (non-Javadoc) |
|
75 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getOperationCode() |
|
76 |
*/ |
|
77 |
protected String getOperationName() { |
|
78 |
return CapabilitiesTags.WFS_LOCKFEATURE; |
|
79 |
} |
|
80 |
|
|
81 |
/* |
|
82 |
* (non-Javadoc) |
|
83 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation() |
|
84 |
*/ |
|
85 |
protected String getSchemaLocation() { |
|
86 |
return "../wfs/1.0.0/WFS-transaction.xsd"; |
|
87 |
} |
|
88 |
} |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/request/WFSGetFeatureRequest.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.request; |
|
25 |
|
|
26 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
27 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
28 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
29 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
30 |
import org.gvsig.remoteclient.wfs.edition.WFSTTags; |
|
31 |
import org.gvsig.remoteclient.wfs.filters.filterencoding.FilterEncoding; |
|
32 |
|
|
33 |
/** |
|
34 |
* The GetFeature operation allows retrieval of features from a |
|
35 |
* web feature service. A GetFeature request is processed by |
|
36 |
* a WFS and when the value of the outputFormat attribute is |
|
37 |
* set to text/gml a GML instance document, containing the |
|
38 |
* result set, is returned to the client. |
|
39 |
* @see http://www.opengeospatial.org/standards/wfs |
|
40 |
* @author Jorge Piera Llodrá (jorge.piera@iver.es) |
|
41 |
*/ |
|
42 |
public abstract class WFSGetFeatureRequest extends WFSRequest{ |
|
43 |
|
|
44 |
public WFSGetFeatureRequest(WFSStatus status, |
|
45 |
WFSProtocolHandler protocolHandler) { |
|
46 |
super(status, protocolHandler); |
|
47 |
} |
|
48 |
|
|
49 |
/* |
|
50 |
* (non-Javadoc) |
|
51 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpPostRequest(java.lang.String) |
|
52 |
*/ |
|
53 |
protected String getHttpPostRequest(String onlineResource) { |
|
54 |
StringBuffer request = new StringBuffer(); |
|
55 |
request.append(WFSTTags.XML_ROOT); |
|
56 |
request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
|
57 |
request.append(CapabilitiesTags.WFS_GETFEATURE + " "); |
|
58 |
request.append(CapabilitiesTags.VERSION + "=\"" + protocolHandler.getVersion() + "\" "); |
|
59 |
request.append(WFSTTags.WFST_SERVICE + "=\"WFS\" "); |
|
60 |
if (status.getMaxFeatures().longValue() > 0){ |
|
61 |
request.append(CapabilitiesTags.MAXFEATURES + "=\"" + status.getMaxFeatures() + "\" "); |
|
62 |
} |
|
63 |
if (status.getResultType() == WFSStatus.RESULTYPE_HITS){ |
|
64 |
request.append(WFSTTags.WFS_RESULTTYPE + "=\"" + WFSTTags.WFS_HITS + "\" "); |
|
65 |
} |
|
66 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.OGC_NAMESPACE_PREFIX); |
|
67 |
request.append("=\"" + WFSTTags.OGC_NAMESPACE + "\" "); |
|
68 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.WFS_NAMESPACE_PREFIX); |
|
69 |
request.append("=\"" + WFSTTags.WFS_NAMESPACE + "\" "); |
|
70 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.XML_NAMESPACE_PREFIX); |
|
71 |
request.append("=\"" + WFSTTags.XML_NAMESPACE + "\" "); |
|
72 |
request.append(WFSTTags.XMLNS + ":" + WFSTTags.GML_NAMESPACE_PREFIX); |
|
73 |
request.append("=\"" + WFSTTags.GML_NAMESPACE + "\" "); |
|
74 |
request.append(WFSTTags.XMLNS + ":" + status.getNamespacePrefix()); |
|
75 |
request.append("=\"" + status.getNamespaceLocation() + "\" "); |
|
76 |
request.append(WFSTTags.XML_NAMESPACE_PREFIX + ":" + WFSTTags.XML_SCHEMALOCATION); |
|
77 |
request.append("=\"" + WFSTTags.WFS_NAMESPACE + " "); |
|
78 |
request.append(getSchemaLocation()); |
|
79 |
request.append("\">"); |
|
80 |
request.append("<" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
|
81 |
request.append(WFSTTags.WFS_QUERY); |
|
82 |
request.append(" typeName=\"" + status.getFeatureFullName() + "\""); |
|
83 |
request.append(">"); |
|
84 |
if ((status.getFilterByAttribute() != null) || (status.getFilterByArea() != null)){ |
|
85 |
FilterEncoding filterEncoding = new FilterEncoding(status); |
|
86 |
request.append(filterEncoding.toString(protocolHandler.getVersion())); |
|
87 |
} |
|
88 |
request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
|
89 |
request.append(WFSTTags.WFS_QUERY); |
|
90 |
request.append(">"); |
|
91 |
request.append("</" + WFSTTags.WFS_NAMESPACE_PREFIX + ":"); |
|
92 |
request.append(CapabilitiesTags.WFS_GETFEATURE + ">"); |
|
93 |
return request.toString(); |
|
94 |
} |
|
95 |
|
|
96 |
/* |
|
97 |
* (non-Javadoc) |
|
98 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getOperationCode() |
|
99 |
*/ |
|
100 |
protected String getOperationName() { |
|
101 |
return CapabilitiesTags.WFS_GETFEATURE; |
|
102 |
} |
|
103 |
|
|
104 |
/* |
|
105 |
* (non-Javadoc) |
|
106 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation() |
|
107 |
*/ |
|
108 |
protected String getSchemaLocation() { |
|
109 |
return null; |
|
110 |
} |
|
111 |
|
|
112 |
/* |
|
113 |
* (non-Javadoc) |
|
114 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getTempFilePrefix() |
|
115 |
*/ |
|
116 |
protected String getTempFilePrefix() { |
|
117 |
return "wfs_getFeature.gml"; |
|
118 |
} |
|
119 |
|
|
120 |
/* |
|
121 |
* (non-Javadoc) |
|
122 |
* @see org.gvsig.remoteclient.wfs.request.WFSRequest#createRequestInformation() |
|
123 |
*/ |
|
124 |
public WFSRequestInformation createRequestInformation() { |
|
125 |
return new WFSGetFeatureRequestInformation(); |
|
126 |
} |
|
127 |
|
|
128 |
|
|
129 |
} |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/request/WFSTransactionRequestInformation.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.request; |
|
25 |
|
|
26 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* @author gvSIG Team |
|
31 |
* @version $Id$ |
|
32 |
* |
|
33 |
*/ |
|
34 |
public class WFSTransactionRequestInformation extends WFSRequestInformation{ |
|
35 |
//Transaction message |
|
36 |
public String message = null; |
|
37 |
|
|
38 |
//Status |
|
39 |
public static final int STATUS_NO_EXECUTED = 0; |
|
40 |
public static final int STATUS_FAILED = 1; |
|
41 |
public static final int STATUS_SUCCESS = 2; |
|
42 |
private int status = 0; |
|
43 |
|
|
44 |
public WFSTransactionRequestInformation() { |
|
45 |
super(); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* @return the status |
|
50 |
*/ |
|
51 |
public int getStatus() { |
|
52 |
return status; |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* @param status the status to set |
|
57 |
*/ |
|
58 |
public void setStatus(int status) { |
|
59 |
this.status = status; |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* @return the message |
|
64 |
*/ |
|
65 |
public String getMessage() { |
|
66 |
return message; |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* @param message the message to set |
|
71 |
*/ |
|
72 |
public void setMessage(String message) { |
|
73 |
this.message = message; |
|
74 |
} |
|
75 |
} |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/request/WFSDescribeFeatureTypeRequest.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.request; |
|
25 |
|
|
26 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
27 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
28 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
29 |
|
|
30 |
/** |
|
31 |
* The function of the DescribeFeatureType operation is to |
|
32 |
* generate a schema description of feature types serviced |
|
33 |
* by a WFS implementation. The schema descriptions define |
|
34 |
* how a WFS implementation expects feature instances to |
|
35 |
* be encoded on input (via Insert and Update requests) |
|
36 |
* and how feature instances will be generated on output |
|
37 |
* (in response to GetFeature and GetGmlObject requests). |
|
38 |
* @see http://www.opengeospatial.org/standards/wfs |
|
39 |
* @author Jorge Piera Llodr? (jorge.piera@iver.es) |
|
40 |
*/ |
|
41 |
public abstract class WFSDescribeFeatureTypeRequest extends WFSRequest{ |
|
42 |
|
|
43 |
public WFSDescribeFeatureTypeRequest(WFSStatus status, |
|
44 |
WFSProtocolHandler protocolHandler) { |
|
45 |
super(status, protocolHandler); |
|
46 |
} |
|
47 |
|
|
48 |
/* |
|
49 |
* (non-Javadoc) |
|
50 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getHttpPostRequest(java.lang.String) |
|
51 |
*/ |
|
52 |
protected String getHttpPostRequest(String onlineResource) { |
|
53 |
// TODO Auto-generated method stub |
|
54 |
return null; |
|
55 |
} |
|
56 |
|
|
57 |
/* |
|
58 |
* (non-Javadoc) |
|
59 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getOperationCode() |
|
60 |
*/ |
|
61 |
protected String getOperationName() { |
|
62 |
return CapabilitiesTags.WFS_DESCRIBEFEATURETYPE; |
|
63 |
} |
|
64 |
|
|
65 |
/* |
|
66 |
* (non-Javadoc) |
|
67 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getSchemaLocation() |
|
68 |
*/ |
|
69 |
protected String getSchemaLocation() { |
|
70 |
return null; |
|
71 |
} |
|
72 |
|
|
73 |
/* |
|
74 |
* (non-Javadoc) |
|
75 |
* @see org.gvsig.remoteClient.wfs.requests.WFSRequest#getTempFilePrefix() |
|
76 |
*/ |
|
77 |
protected String getTempFilePrefix() { |
|
78 |
return "wfs_describeFeatureType.xml"; |
|
79 |
} |
|
80 |
} |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/request/WFSRequest.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.request; |
|
25 |
|
|
26 |
import java.io.File; |
|
27 |
import java.io.IOException; |
|
28 |
import java.net.ConnectException; |
|
29 |
import java.net.UnknownHostException; |
|
30 |
|
|
31 |
import org.gvsig.compat.net.ICancellable; |
|
32 |
import org.gvsig.remoteclient.ogc.request.OGCRequest; |
|
33 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
34 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
35 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
36 |
|
|
37 |
/** |
|
38 |
* This class sends a WFS request and returns the |
|
39 |
* reply in a local File. It tries if the server |
|
40 |
* supports both HTTP Get and Post requests. |
|
41 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
42 |
*/ |
|
43 |
public abstract class WFSRequest extends OGCRequest{ |
|
44 |
protected WFSStatus status = null; |
|
45 |
|
|
46 |
public WFSRequest(WFSStatus status, WFSProtocolHandler protocolHandler) { |
|
47 |
super(status, protocolHandler); |
|
48 |
this.status = status; |
|
49 |
} |
|
50 |
|
|
51 |
/* |
|
52 |
* (non-Javadoc) |
|
53 |
* @see org.gvsig.remoteclient.ogc.request.OGCRequest#sendRequest() |
|
54 |
*/ |
|
55 |
public File sendRequest(ICancellable cancel) throws ConnectException, UnknownHostException, |
|
56 |
IOException { |
|
57 |
if (status != null){ |
|
58 |
((WFSProtocolHandler)protocolHandler).addLastWfsRequestInformation(createRequestInformation()); |
|
59 |
} |
|
60 |
return super.sendRequest(cancel); |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* Creates a request information |
|
65 |
* @return a request information |
|
66 |
*/ |
|
67 |
public WFSRequestInformation createRequestInformation(){ |
|
68 |
return new WFSRequestInformation(); |
|
69 |
} |
|
70 |
} |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/request/WFSGetFeatureRequestInformation.java | ||
---|---|---|
1 |
/** |
|
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 |
|
|
25 |
package org.gvsig.remoteclient.wfs.request; |
|
26 |
|
|
27 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
28 |
|
|
29 |
/** |
|
30 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
31 |
*/ |
|
32 |
public class WFSGetFeatureRequestInformation extends WFSRequestInformation{ |
|
33 |
|
|
34 |
public WFSGetFeatureRequestInformation() { |
|
35 |
super(); |
|
36 |
} |
|
37 |
|
|
38 |
/** |
|
39 |
* The optional numberOfFeatures attribute is used to |
|
40 |
* indicate the number of features that are in the |
|
41 |
* response document. |
|
42 |
*/ |
|
43 |
private int numberOfFeatures = -1; |
|
44 |
|
|
45 |
/** |
|
46 |
* @return the numberOfFeatures |
|
47 |
*/ |
|
48 |
public int getNumberOfFeatures() { |
|
49 |
return numberOfFeatures; |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* @param numberOfFeatures the numberOfFeatures to set |
|
54 |
*/ |
|
55 |
public void setNumberOfFeatures(int numberOfFeatures) { |
|
56 |
this.numberOfFeatures = numberOfFeatures; |
|
57 |
} |
|
58 |
} |
|
59 |
|
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/request/WFSTransactionRequest.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.request; |
|
25 |
|
|
26 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
|
27 |
import org.gvsig.remoteclient.wfs.WFSProtocolHandler; |
|
28 |
import org.gvsig.remoteclient.wfs.WFSRequestInformation; |
|
29 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
30 |
import org.gvsig.remoteclient.wfs.edition.WFSTTags; |
|
31 |
|
|
32 |
|
|
33 |
/** |
|
34 |
* @author gvSIG Team |
|
35 |
* @version $Id$ |
|
36 |
* |
|
37 |
*/ |
|
38 |
public abstract class WFSTransactionRequest extends WFSRequest{ |
|
39 |
protected static final String UPDATE_PROPERTY_TAG = WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_PROPERTY; |
|
40 |
protected static final String UPDATE_NAME_TAG = WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_NAME;; |
|
41 |
protected static final String UPDATE_VALUE_TAG = WFSTTags.WFS_NAMESPACE_PREFIX + ":" + WFSTTags.WFST_VALUE; |
|
42 |
|
|
43 |
/** |
|
44 |
* @param status |
|
45 |
* @param protocolHandler |
|
46 |
*/ |
|
47 |
public WFSTransactionRequest(WFSStatus status, |
|
48 |
WFSProtocolHandler protocolHandler) { |
|
49 |
super(status, protocolHandler); |
|
50 |
} |
|
51 |
|
|
52 |
protected String getTempFilePrefix() { |
|
53 |
return "wfs_transaction.xml"; |
|
54 |
} |
|
55 |
|
|
56 |
protected String getOperationName() { |
|
57 |
return CapabilitiesTags.WFS_TRANSACTION; |
|
58 |
} |
|
59 |
|
|
60 |
public WFSRequestInformation createRequestInformation(){ |
|
61 |
return new WFSTransactionRequestInformation(); |
|
62 |
} |
|
63 |
} |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/WFSFeature.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs; |
|
25 |
|
|
26 |
import java.util.Hashtable; |
|
27 |
import java.util.Vector; |
|
28 |
|
|
29 |
import org.gvsig.remoteclient.utils.BoundaryBox; |
|
30 |
import org.gvsig.remoteclient.wfs.schema.XMLNameSpace; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
34 |
*/ |
|
35 |
public class WFSFeature extends WFSFeatureField { |
|
36 |
private String localName = null; |
|
37 |
private String title = null; |
|
38 |
private String _abstract = null; |
|
39 |
private Vector srs = new Vector(); |
|
40 |
private String defaultSRS = null; |
|
41 |
private BoundaryBox latLonBbox = null; |
|
42 |
private Hashtable bBoxes = new Hashtable(); |
|
43 |
private Vector keywords = new Vector(); |
|
44 |
private XMLNameSpace namespace = null; |
|
45 |
private WFSServiceInformation serviceInformation; |
|
46 |
private boolean isCompleted = false; |
|
47 |
|
|
48 |
protected WFSFeature(WFSServiceInformation serviceInformation){ |
|
49 |
super(); |
|
50 |
this.serviceInformation = serviceInformation; |
|
51 |
} |
|
52 |
|
|
53 |
protected WFSFeature(WFSServiceInformation serviceInformation, String name){ |
|
54 |
super(); |
|
55 |
this.serviceInformation = serviceInformation; |
|
56 |
setName(name); |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* @return Returns the _abstract. |
|
61 |
*/ |
|
62 |
public String getAbstract() { |
|
63 |
return _abstract; |
|
64 |
} |
|
65 |
/** |
|
66 |
* @param _abstract The _abstract to set. |
|
67 |
*/ |
|
68 |
public void setAbstract(String _abstract) { |
|
69 |
this._abstract = _abstract; |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* @param name The name to set. |
|
74 |
*/ |
|
75 |
public void setName(String name) { |
|
76 |
this.name = name; |
|
77 |
int index = name.indexOf(":"); |
|
78 |
if (index > 0){ |
|
79 |
String prefix = name.substring(0, index); |
|
80 |
localName = name.substring(index+1, name.length()); |
|
81 |
String nameSpace = serviceInformation.getNamespace(prefix); |
|
82 |
this.setNamespace(new XMLNameSpace(prefix, nameSpace)); |
|
83 |
} |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* @return Returns the title. |
|
88 |
*/ |
|
89 |
public String getTitle() { |
|
90 |
if ((title == null) || |
|
91 |
(title.equals(""))){ |
|
92 |
return name; |
|
93 |
} |
|
94 |
return title; |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* @param title The title to set. |
|
99 |
*/ |
|
100 |
public void setTitle(String title) { |
|
101 |
this.title = title; |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* @return Returns the latLonBbox. |
|
106 |
*/ |
|
107 |
public BoundaryBox getLatLonBbox() { |
|
108 |
return latLonBbox; |
|
109 |
} |
|
110 |
/** |
|
111 |
* @param latLonBbox The latLonBbox to set. |
|
112 |
*/ |
|
113 |
public void setLatLonBbox(BoundaryBox latLonBbox) { |
|
114 |
this.latLonBbox = latLonBbox; |
|
115 |
} |
|
116 |
/** |
|
117 |
* @return Returns the keywords. |
|
118 |
*/ |
|
119 |
public Vector getKeywords() { |
|
120 |
return keywords; |
|
121 |
} |
|
122 |
|
|
123 |
public void addKeyword(String keyword){ |
|
124 |
keywords.add(keyword); |
|
125 |
} |
|
126 |
/** |
|
127 |
* @return Returns the srs. |
|
128 |
*/ |
|
129 |
public Vector getSrs() { |
|
130 |
return srs; |
|
131 |
} |
|
132 |
|
|
133 |
public void addSRS(String key){ |
|
134 |
String epsgCode = getEPSGCode(key); |
|
135 |
if (!this.srs.contains(epsgCode)){ |
|
136 |
srs.add(epsgCode); |
|
137 |
} |
|
138 |
if (defaultSRS == null){ |
|
139 |
defaultSRS = epsgCode; |
|
140 |
} |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* <p>Adds a bbox to the Bboxes vector</p> |
|
145 |
* @param bbox |
|
146 |
*/ |
|
147 |
public void addBBox(BoundaryBox bbox) { |
|
148 |
bBoxes.put(bbox.getSrs(), bbox); |
|
149 |
} |
|
150 |
|
|
151 |
/** |
|
152 |
* <p>returns the bbox with that id in the Bboxes vector</p> |
|
153 |
* @param id |
|
154 |
*/ |
|
155 |
public BoundaryBox getBbox(String id) { |
|
156 |
return (BoundaryBox)bBoxes.get(id); |
|
157 |
} |
|
158 |
/** |
|
159 |
* @return Returns the namespace. |
|
160 |
*/ |
|
161 |
public XMLNameSpace getNamespace() { |
|
162 |
return namespace; |
|
163 |
} |
|
164 |
/** |
|
165 |
* @param namespace The namespace to set. |
|
166 |
*/ |
|
167 |
public void setNamespace(XMLNameSpace namespace) { |
|
168 |
this.namespace = namespace; |
|
169 |
} |
|
170 |
|
|
171 |
/** |
|
172 |
* @return the localName |
|
173 |
*/ |
|
174 |
public String getLocalName() { |
|
175 |
return localName; |
|
176 |
} |
|
177 |
|
|
178 |
|
|
179 |
/** |
|
180 |
* @return the isCompleted |
|
181 |
*/ |
|
182 |
public boolean isCompleted() { |
|
183 |
return isCompleted; |
|
184 |
} |
|
185 |
|
|
186 |
/** |
|
187 |
* @param isCompleted the isCompleted to set |
|
188 |
*/ |
|
189 |
public void setCompleted(boolean isCompleted) { |
|
190 |
this.isCompleted = isCompleted; |
|
191 |
} |
|
192 |
|
|
193 |
/** |
|
194 |
* @return the defaultSRS |
|
195 |
*/ |
|
196 |
public String getDefaultSRS() { |
|
197 |
return defaultSRS; |
|
198 |
} |
|
199 |
|
|
200 |
|
|
201 |
/** |
|
202 |
* @param defaultSRS the defaultSRS to set |
|
203 |
*/ |
|
204 |
public void setDefaultSRS(String defaultSRS) { |
|
205 |
this.defaultSRS = getEPSGCode(defaultSRS); |
|
206 |
addSRS(defaultSRS); |
|
207 |
} |
|
208 |
|
|
209 |
private String getEPSGCode(String srs){ |
|
210 |
if (srs == null){ |
|
211 |
return null; |
|
212 |
} |
|
213 |
if ((srs.startsWith("urn:x-ogc:def:crs:")) || srs.startsWith("urn:ogc:def:crs:")){ |
|
214 |
String newString = srs.substring(srs.lastIndexOf(":") + 1, srs.length()); |
|
215 |
if (srs.indexOf("EPSG") > 0){ |
|
216 |
if (newString.indexOf("EPSG") < 0){ |
|
217 |
newString = "EPSG:" + newString; |
|
218 |
} |
|
219 |
} |
|
220 |
return newString; |
|
221 |
} |
|
222 |
if (srs.toLowerCase().startsWith("crs:")){ |
|
223 |
return srs.substring(4, srs.length()); |
|
224 |
} |
|
225 |
return srs; |
|
226 |
} |
|
227 |
|
|
228 |
} |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/edition/WFSTDeleteOperation.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.edition; |
|
25 |
|
|
26 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
31 |
*/ |
|
32 |
public class WFSTDeleteOperation extends WFSTOperation { |
|
33 |
|
|
34 |
protected WFSTDeleteOperation(WFSStatus wfsStatus, String id) { |
|
35 |
super(wfsStatus, id); |
|
36 |
} |
|
37 |
|
|
38 |
public String getOperationName() { |
|
39 |
return "Delete"; |
|
40 |
} |
|
41 |
|
|
42 |
public boolean hasTypeName(){ |
|
43 |
return true; |
|
44 |
} |
|
45 |
} |
|
0 | 46 |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/edition/WFSTUpdateOperation.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.edition; |
|
25 |
|
|
26 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
31 |
*/ |
|
32 |
public class WFSTUpdateOperation extends WFSTAttributesOperation { |
|
33 |
|
|
34 |
protected WFSTUpdateOperation(WFSStatus wfsStatus, String id) { |
|
35 |
super(wfsStatus, id); |
|
36 |
} |
|
37 |
|
|
38 |
public String getOperationName() { |
|
39 |
return "Update"; |
|
40 |
} |
|
41 |
|
|
42 |
public boolean hasTypeName(){ |
|
43 |
return true; |
|
44 |
} |
|
45 |
} |
|
0 | 46 |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/edition/WFSTInsertOperation.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.edition; |
|
25 |
|
|
26 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
27 |
|
|
28 |
/** |
|
29 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
30 |
*/ |
|
31 |
public class WFSTInsertOperation extends WFSTAttributesOperation { |
|
32 |
|
|
33 |
protected WFSTInsertOperation(WFSStatus wfsStatus) { |
|
34 |
super(wfsStatus); |
|
35 |
} |
|
36 |
|
|
37 |
public String getOperationName() { |
|
38 |
return "Insert"; |
|
39 |
} |
|
40 |
|
|
41 |
public boolean hasTypeName(){ |
|
42 |
return false; |
|
43 |
} |
|
44 |
} |
|
0 | 45 |
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.180/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/remoteclient/wfs/edition/WFSTTransaction.java | ||
---|---|---|
1 |
/** |
|
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 |
package org.gvsig.remoteclient.wfs.edition; |
|
25 |
|
|
26 |
import java.util.ArrayList; |
|
27 |
import java.util.List; |
|
28 |
|
|
29 |
import org.gvsig.remoteclient.wfs.WFSStatus; |
|
30 |
|
|
31 |
/** |
|
32 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
33 |
*/ |
|
34 |
public class WFSTTransaction { |
|
35 |
private List insertOperations = null; |
|
36 |
private List updateOperations = null; |
|
37 |
private List deleteOperations = null; |
|
38 |
private WFSStatus wfsStatus; |
|
39 |
|
|
40 |
public WFSTTransaction(WFSStatus wfsStatus){ |
|
41 |
insertOperations = new ArrayList(); |
|
42 |
updateOperations = new ArrayList(); |
|
43 |
deleteOperations = new ArrayList(); |
|
44 |
this.wfsStatus = wfsStatus; |
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* Adds a delete operation |
|
49 |
* @param ids |
|
50 |
* The identifiers of the features to delete |
|
51 |
*/ |
|
52 |
public WFSTDeleteOperation createDeleteOperation(String id){ |
|
53 |
WFSTDeleteOperation deleteOperation = new WFSTDeleteOperation(wfsStatus, id); |
|
54 |
deleteOperations.add(deleteOperation); |
|
55 |
return deleteOperation; |
|
56 |
} |
|
57 |
|
|
58 |
/** |
Also available in: Unified diff