Revision 2889
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org.gvsig.vcsgis.main/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<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"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.vcsgis.main</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.vcsgis</artifactId> |
|
10 |
<version>1.0.0-SNAPSHOT</version> |
|
11 |
</parent> |
|
12 |
|
|
13 |
|
|
14 |
<build> |
|
15 |
<plugins> |
|
16 |
<plugin> |
|
17 |
<artifactId>maven-assembly-plugin</artifactId> |
|
18 |
<executions> |
|
19 |
<execution> |
|
20 |
<id>package-main</id> |
|
21 |
<phase>package</phase> |
|
22 |
<goals> |
|
23 |
<goal>single</goal> |
|
24 |
</goals> |
|
25 |
<configuration> |
|
26 |
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions> |
|
27 |
<appendAssemblyId>false</appendAssemblyId> |
|
28 |
<finalName>${project.artifactId}-${project.version}</finalName> |
|
29 |
<descriptors> |
|
30 |
<descriptor>src/main/assembly/package-main.xml</descriptor> |
|
31 |
</descriptors> |
|
32 |
</configuration> |
|
33 |
</execution> |
|
34 |
</executions> |
|
35 |
</plugin> |
|
36 |
|
|
37 |
<plugin> |
|
38 |
<groupId>org.apache.maven.plugins</groupId> |
|
39 |
<artifactId>maven-jar-plugin</artifactId> |
|
40 |
<configuration> |
|
41 |
<archive> |
|
42 |
<manifest> |
|
43 |
<addClasspath>true</addClasspath> |
|
44 |
<mainClass>org.gvsig.vcsgis.main.Main</mainClass> |
|
45 |
<classpathPrefix>lib</classpathPrefix> |
|
46 |
</manifest> |
|
47 |
</archive> |
|
48 |
</configuration> |
|
49 |
</plugin> |
|
50 |
|
|
51 |
</plugins> |
|
52 |
|
|
53 |
</build> |
|
54 |
|
|
55 |
|
|
56 |
<dependencies> |
|
57 |
<dependency> |
|
58 |
<groupId>org.gvsig</groupId> |
|
59 |
<artifactId>org.gvsig.vcsgis.lib.api</artifactId> |
|
60 |
<scope>compile</scope> |
|
61 |
</dependency> |
|
62 |
<dependency> |
|
63 |
<groupId>org.gvsig</groupId> |
|
64 |
<artifactId>org.gvsig.vcsgis.swing.api</artifactId> |
|
65 |
<scope>compile</scope> |
|
66 |
</dependency> |
|
67 |
|
|
68 |
<!-- runtime dependencies --> |
|
69 |
<dependency> |
|
70 |
<groupId>org.gvsig</groupId> |
|
71 |
<artifactId>org.gvsig.vcsgis.lib.impl</artifactId> |
|
72 |
<scope>runtime</scope> |
|
73 |
</dependency> |
|
74 |
<dependency> |
|
75 |
<groupId>org.gvsig</groupId> |
|
76 |
<artifactId>org.gvsig.vcsgis.swing.impl</artifactId> |
|
77 |
<scope>compile</scope> |
|
78 |
</dependency> |
|
79 |
<dependency> |
|
80 |
<groupId>org.gvsig</groupId> |
|
81 |
<artifactId>${org.gvsig.metadata.lib.basic.impl}</artifactId> |
|
82 |
<scope>runtime</scope> |
|
83 |
</dependency> |
|
84 |
<dependency> |
|
85 |
<groupId>org.gvsig</groupId> |
|
86 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
87 |
<scope>runtime</scope> |
|
88 |
</dependency> |
|
89 |
<dependency> |
|
90 |
<groupId>org.gvsig</groupId> |
|
91 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
92 |
<scope>runtime</scope> |
|
93 |
</dependency> |
|
94 |
<dependency> |
|
95 |
<groupId>org.gvsig</groupId> |
|
96 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
97 |
<scope>runtime</scope> |
|
98 |
</dependency> |
|
99 |
<dependency> |
|
100 |
<groupId>org.gvsig</groupId> |
|
101 |
<artifactId>org.gvsig.fmap.dal.file.shp</artifactId> |
|
102 |
<scope>runtime</scope> |
|
103 |
</dependency> |
|
104 |
<dependency> |
|
105 |
<groupId>org.gvsig</groupId> |
|
106 |
<artifactId>org.gvsig.fmap.dal.file.dbf</artifactId> |
|
107 |
<scope>runtime</scope> |
|
108 |
</dependency> |
|
109 |
<dependency> |
|
110 |
<groupId>org.gvsig</groupId> |
|
111 |
<artifactId>org.gvsig.fmap.dal.db.lib</artifactId> |
|
112 |
<scope>runtime</scope> |
|
113 |
</dependency> |
|
114 |
<dependency> |
|
115 |
<groupId>org.gvsig</groupId> |
|
116 |
<artifactId>org.gvsig.fmap.dal.db.h2</artifactId> |
|
117 |
<scope>runtime</scope> |
|
118 |
</dependency> |
|
119 |
|
|
120 |
<dependency> |
|
121 |
<groupId>org.gvsig</groupId> |
|
122 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
123 |
<scope>runtime</scope> |
|
124 |
</dependency> |
|
125 |
<dependency> |
|
126 |
<groupId>org.gvsig</groupId> |
|
127 |
<artifactId>${org.gvsig.timesupport.lib.impl}</artifactId> |
|
128 |
<scope>runtime</scope> |
|
129 |
</dependency> |
|
130 |
|
|
131 |
<dependency> |
|
132 |
<groupId>org.gvsig</groupId> |
|
133 |
<artifactId>${org.gvsig.compat.impl}</artifactId> |
|
134 |
<scope>runtime</scope> |
|
135 |
</dependency> |
|
136 |
<dependency> |
|
137 |
<groupId>org.gvsig</groupId> |
|
138 |
<artifactId>${org.gvsig.fmap.geometry.impl}</artifactId> |
|
139 |
<scope>runtime</scope> |
|
140 |
</dependency> |
|
141 |
|
|
142 |
<dependency> |
|
143 |
<groupId>org.gvsig</groupId> |
|
144 |
<artifactId>${org.gvsig.proj.lib.impl}</artifactId> |
|
145 |
<scope>runtime</scope> |
|
146 |
</dependency> |
|
147 |
|
|
148 |
<dependency> |
|
149 |
<groupId>org.gvsig</groupId> |
|
150 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
151 |
<scope>runtime</scope> |
|
152 |
</dependency> |
|
153 |
<dependency> |
|
154 |
<groupId>org.gvsig</groupId> |
|
155 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
156 |
<scope>runtime</scope> |
|
157 |
</dependency> |
|
158 |
|
|
159 |
|
|
160 |
</dependencies> |
|
161 |
</project> |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org.gvsig.vcsgis.main/src/main/assembly/package-main.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
|
|
3 |
<id>package-main</id> |
|
4 |
<formats> |
|
5 |
<format>dir</format> |
|
6 |
<format>zip</format> |
|
7 |
</formats> |
|
8 |
|
|
9 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
10 |
<includeBaseDirectory>false</includeBaseDirectory> |
|
11 |
|
|
12 |
<files> |
|
13 |
<file> |
|
14 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
15 |
<outputDirectory>.</outputDirectory> |
|
16 |
</file> |
|
17 |
</files> |
|
18 |
|
|
19 |
<fileSets> |
|
20 |
<fileSet> |
|
21 |
<directory>src/main/resources/data</directory> |
|
22 |
<outputDirectory>data</outputDirectory> |
|
23 |
</fileSet> |
|
24 |
</fileSets> |
|
25 |
|
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>true</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
</dependencySet> |
|
32 |
</dependencySets> |
|
33 |
|
|
34 |
</assembly> |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org.gvsig.vcsgis.main/src/main/java/org/gvsig/vcsgis/main/Main.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2020 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 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 |
* 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.vcsgis.main; |
|
25 |
|
|
26 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
27 |
|
|
28 |
/** |
|
29 |
* Main executable class of vcsgis tool. |
|
30 |
* |
|
31 |
* @author gvSIG Team |
|
32 |
*/ |
|
33 |
public class Main { |
|
34 |
|
|
35 |
public static void main(String args[]) { |
|
36 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
37 |
} |
|
38 |
|
|
39 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org.gvsig.vcsgis.main/src/main/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 2 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
28 |
|
|
29 |
<!-- |
|
30 |
Log4J configuration file for unit tests execution. |
|
31 |
--> |
|
32 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
33 |
|
|
34 |
<!-- Appender configuration to show logging messages through the console --> |
|
35 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
36 |
<layout class="org.apache.log4j.PatternLayout"> |
|
37 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()] %m%n" /> |
|
38 |
</layout> |
|
39 |
</appender> |
|
40 |
|
|
41 |
<!-- |
|
42 |
Activate logging messages of DEBUG level of higher only for the |
|
43 |
org.gvsig.tools packages. |
|
44 |
You can put full classes names or packages instead, to configure |
|
45 |
logging for all the classes and subpackages of the package. |
|
46 |
--> |
|
47 |
<category name="org.gvsig"> |
|
48 |
<priority value="WARN" /> |
|
49 |
</category> |
|
50 |
<category name="org.cresques"> |
|
51 |
<priority value="WARN" /> |
|
52 |
</category> |
|
53 |
|
|
54 |
<!-- |
|
55 |
By default, show only logging messages of INFO level or higher, |
|
56 |
through the previously configured CONSOLE appender. |
|
57 |
--> |
|
58 |
<root> |
|
59 |
<priority value="INFO" /> |
|
60 |
<appender-ref ref="CONSOLE" /> |
|
61 |
</root> |
|
62 |
</log4j:configuration> |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org.gvsig.vcsgis.main/src/main/resources/README.txt | ||
---|---|---|
1 |
==== |
|
2 |
gvSIG. Desktop Geographic Information System. |
|
3 |
|
|
4 |
Copyright (C) 2007-2012 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 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 |
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 |
Put into this folder the resources needed by your classes. |
|
26 |
|
|
27 |
This folder is added to the classpath, so you can load any resources |
|
28 |
through the ClassLoader. |
|
29 |
|
|
30 |
By default, in this folder you can find an example of log4j configuration, |
|
31 |
prepared to log messages through the console, so logging works when you |
|
32 |
run your classes. |
|
0 | 33 |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/VCSGisServlet.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.vcsgis.server.lib; |
|
24 |
|
|
25 |
import javax.servlet.http.HttpServlet; |
|
26 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
27 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
28 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
29 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
30 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
|
31 |
|
|
32 |
/** |
|
33 |
* |
|
34 |
* @author gvSIG Team |
|
35 |
*/ |
|
36 |
public abstract class VCSGisServlet extends HttpServlet { |
|
37 |
|
|
38 |
protected VCSGisServerController createVCSGisServerController() { |
|
39 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
40 |
JDBCServerExplorerParameters dbconn = (JDBCServerExplorerParameters) this.getServletContext().getAttribute(VCSGisServerUtils.VCSGIS_CONFIG_DBPARAMS); |
|
41 |
VCSGisRepository repository = manager.openRepository(dbconn); |
|
42 |
VCSGisServerController serverController = manager.createServerController(repository); |
|
43 |
return serverController; |
|
44 |
} |
|
45 |
|
|
46 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/VCSGisServerUtils.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.vcsgis.server.lib; |
|
24 |
|
|
25 |
import java.io.File; |
|
26 |
import java.net.URL; |
|
27 |
import org.apache.commons.io.FileUtils; |
|
28 |
import org.apache.commons.math.stat.inference.TestUtils; |
|
29 |
import org.eclipse.jetty.server.Server; |
|
30 |
import org.eclipse.jetty.server.handler.ShutdownHandler; |
|
31 |
import org.eclipse.jetty.servlet.ServletContextHandler; |
|
32 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
33 |
import org.eclipse.jetty.server.handler.HandlerCollection; |
|
34 |
import org.gvsig.fmap.dal.DALLocator; |
|
35 |
import org.gvsig.fmap.dal.DataManager; |
|
36 |
import org.gvsig.fmap.dal.DataStore; |
|
37 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
38 |
import org.gvsig.tools.util.HasAFile; |
|
39 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
40 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
* @author gvSIG Team |
|
45 |
*/ |
|
46 |
public class VCSGisServerUtils { |
|
47 |
|
|
48 |
/* |
|
49 |
https://www.eclipse.org/jetty/documentation/current/ |
|
50 |
|
|
51 |
*/ |
|
52 |
public static final String VCSGIS_CONFIG_DBPARAMS = "org.gvsig.vcsgis.server.params"; |
|
53 |
|
|
54 |
public static final String PROVIDER_NAME = DataStore.H2SPATIAL_PROVIDER_NAME; |
|
55 |
public static final String DB_NAME = "vcsgisserver"; |
|
56 |
public static final int SERVER_PORT = 9810; |
|
57 |
|
|
58 |
public static Server createServer( |
|
59 |
JDBCServerExplorerParameters dbparams, |
|
60 |
String shutdownpass |
|
61 |
) { |
|
62 |
return createServer(SERVER_PORT, dbparams, shutdownpass); |
|
63 |
} |
|
64 |
|
|
65 |
public static Server createServer(JDBCServerExplorerParameters dbparams) { |
|
66 |
return createServer(SERVER_PORT, dbparams, null); |
|
67 |
} |
|
68 |
|
|
69 |
public static Server createServer( |
|
70 |
int port, |
|
71 |
JDBCServerExplorerParameters dbparams, |
|
72 |
String shutdownpass |
|
73 |
) { |
|
74 |
Server server = new Server(port); |
|
75 |
|
|
76 |
ServletContextHandler context = new ServletContextHandler( |
|
77 |
ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS |
|
78 |
); |
|
79 |
|
|
80 |
context.setAttribute(VCSGIS_CONFIG_DBPARAMS, dbparams); |
|
81 |
|
|
82 |
context.addServlet(HelloServlet.class, "/hello"); |
|
83 |
|
|
84 |
context.addServlet(VCSGisEntitiesServlet.class, "/entities"); |
|
85 |
context.addServlet(VCSGisCommitServlet.class, "/commit"); |
|
86 |
context.addServlet(VCSGisCheckoutServlet.class, "/checkout"); |
|
87 |
|
|
88 |
context.addServlet(VCSGisRowCreateServlet.class, "/rowcreate"); |
|
89 |
context.addServlet(VCSGisRowUpdateServlet.class, "/rowupdate"); |
|
90 |
context.addServlet(VCSGisRowDeleteServlet.class, "/rowdelete"); |
|
91 |
|
|
92 |
HandlerCollection handlers = new HandlerCollection(); |
|
93 |
handlers.addHandler(context); |
|
94 |
if( shutdownpass!=null ) { |
|
95 |
handlers.addHandler(new ShutdownHandler(shutdownpass)); |
|
96 |
} |
|
97 |
server.setHandler(handlers); |
|
98 |
|
|
99 |
return server; |
|
100 |
} |
|
101 |
|
|
102 |
public static void main(String[] args) throws Exception |
|
103 |
{ |
|
104 |
|
|
105 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
106 |
|
|
107 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
108 |
JDBCServerExplorerParameters dbparams = getDBParameters(DB_NAME); |
|
109 |
manager.initRepository(dbparams, null); |
|
110 |
|
|
111 |
Server server = createServer( |
|
112 |
SERVER_PORT, |
|
113 |
dbparams, |
|
114 |
"pass" |
|
115 |
); |
|
116 |
server.start(); |
|
117 |
server.join(); |
|
118 |
} |
|
119 |
|
|
120 |
private static JDBCServerExplorerParameters getDBParameters(String dbname) { |
|
121 |
try { |
|
122 |
DataManager dataManager = DALLocator.getDataManager(); |
|
123 |
JDBCServerExplorerParameters conn = (JDBCServerExplorerParameters) dataManager.createServerExplorerParameters(PROVIDER_NAME); |
|
124 |
|
|
125 |
File dbfile = getResource(String.format("test-dbs/%s",dbname)); |
|
126 |
FileUtils.forceMkdir(dbfile.getParentFile()); |
|
127 |
((HasAFile)conn).setFile(dbfile); |
|
128 |
return conn; |
|
129 |
} catch (Exception ex) { |
|
130 |
return null; |
|
131 |
} |
|
132 |
} |
|
133 |
|
|
134 |
private static File getTargetFolder() throws Exception { |
|
135 |
URL url = TestUtils.class.getResource("/"); |
|
136 |
File x = new File(url.toURI()); |
|
137 |
File target = x.getParentFile(); |
|
138 |
return target; |
|
139 |
} |
|
140 |
|
|
141 |
private static File getResource(String name) throws Exception { |
|
142 |
File x = new File(getTargetFolder(), name); |
|
143 |
return x; |
|
144 |
} |
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/VCSGisUpdateServlet.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.server.lib; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author gvSIG Team |
|
27 |
*/ |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import javax.servlet.http.HttpServletRequest; |
|
31 |
import javax.servlet.http.HttpServletResponse; |
|
32 |
import org.apache.commons.io.IOUtils; |
|
33 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
|
34 |
import org.gvsig.vcsgis.lib.server.VCSGisServerHandler; |
|
35 |
|
|
36 |
|
|
37 |
public class VCSGisUpdateServlet extends VCSGisServlet { |
|
38 |
|
|
39 |
@Override |
|
40 |
protected void doPost(HttpServletRequest request, |
|
41 |
HttpServletResponse response) throws IOException { |
|
42 |
try { |
|
43 |
VCSGisServerController vcsgisserver = this.createVCSGisServerController(); |
|
44 |
VCSGisServerHandler handler = vcsgisserver.createUpdateHandler(); |
|
45 |
|
|
46 |
InputStream response_stream = handler.handle(request.getInputStream()); |
|
47 |
|
|
48 |
IOUtils.copy(response_stream, response.getWriter()); |
|
49 |
|
|
50 |
// vcsgisserver.dispose(); |
|
51 |
|
|
52 |
response.setStatus(HttpServletResponse.SC_OK); |
|
53 |
response.setContentType("application/json"); |
|
54 |
response.setCharacterEncoding("utf-8"); |
|
55 |
} catch (Exception ex) { |
|
56 |
throw new IOException(ex); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/HelloServlet.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.server.lib; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author gvSIG Team |
|
27 |
*/ |
|
28 |
import java.io.IOException; |
|
29 |
import javax.naming.InitialContext; |
|
30 |
import javax.naming.NamingException; |
|
31 |
import javax.servlet.http.HttpServlet; |
|
32 |
import javax.servlet.http.HttpServletRequest; |
|
33 |
import javax.servlet.http.HttpServletResponse; |
|
34 |
|
|
35 |
public class HelloServlet extends HttpServlet { |
|
36 |
|
|
37 |
@Override |
|
38 |
protected void doGet(HttpServletRequest request, |
|
39 |
HttpServletResponse response) throws IOException { |
|
40 |
|
|
41 |
response.setStatus(HttpServletResponse.SC_OK); |
|
42 |
response.setContentType("text/html"); |
|
43 |
response.setCharacterEncoding("utf-8"); |
|
44 |
response.getWriter().println("<h1>Hello from HelloServlet</h1>"); |
|
45 |
response.getWriter().println(this.getServletContext().getClass().getName()+"<br>"); |
|
46 |
response.getWriter().println("VCSGisDatabaseParameters="+(this.getServletContext().getAttribute(VCSGisServerUtils.VCSGIS_CONFIG_DBPARAMS))+"<br>"); |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/VCSGisEntitiesServlet.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.server.lib; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author gvSIG Team |
|
27 |
*/ |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import javax.servlet.http.HttpServletRequest; |
|
31 |
import javax.servlet.http.HttpServletResponse; |
|
32 |
import org.apache.commons.io.IOUtils; |
|
33 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
|
34 |
import org.gvsig.vcsgis.lib.server.VCSGisServerHandler; |
|
35 |
|
|
36 |
|
|
37 |
public class VCSGisEntitiesServlet extends VCSGisServlet { |
|
38 |
|
|
39 |
|
|
40 |
@Override |
|
41 |
protected void doGet(HttpServletRequest request, |
|
42 |
HttpServletResponse response) throws IOException { |
|
43 |
try { |
|
44 |
VCSGisServerController vcsgisserver = this.createVCSGisServerController(); |
|
45 |
VCSGisServerHandler handler = vcsgisserver.createEntitiesHandler(); |
|
46 |
|
|
47 |
InputStream response_stream = handler.handle(request.getInputStream()); |
|
48 |
|
|
49 |
IOUtils.copy(response_stream, response.getWriter()); |
|
50 |
|
|
51 |
// vcsgisserver.dispose(); |
|
52 |
|
|
53 |
response.setStatus(HttpServletResponse.SC_OK); |
|
54 |
response.setContentType("application/json"); |
|
55 |
response.setCharacterEncoding("utf-8"); |
|
56 |
} catch (Exception ex) { |
|
57 |
throw new IOException(ex); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
protected void doPost(HttpServletRequest request, |
|
63 |
HttpServletResponse response) throws IOException { |
|
64 |
try { |
|
65 |
VCSGisServerController vcsgisserver = this.createVCSGisServerController(); |
|
66 |
VCSGisServerHandler handler = vcsgisserver.createEntitiesHandler(); |
|
67 |
|
|
68 |
InputStream response_stream = handler.handle(request.getInputStream()); |
|
69 |
|
|
70 |
IOUtils.copy(response_stream, response.getWriter()); |
|
71 |
|
|
72 |
// vcsgisserver.dispose(); |
|
73 |
|
|
74 |
response.setStatus(HttpServletResponse.SC_OK); |
|
75 |
response.setContentType("application/json"); |
|
76 |
response.setCharacterEncoding("utf-8"); |
|
77 |
} catch (Exception ex) { |
|
78 |
throw new IOException(ex); |
|
79 |
} |
|
80 |
} |
|
81 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/VCSGisCheckoutServlet.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.server.lib; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author gvSIG Team |
|
27 |
*/ |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import javax.servlet.http.HttpServletRequest; |
|
31 |
import javax.servlet.http.HttpServletResponse; |
|
32 |
import org.apache.commons.io.IOUtils; |
|
33 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
|
34 |
import org.gvsig.vcsgis.lib.server.VCSGisServerHandler; |
|
35 |
|
|
36 |
|
|
37 |
public class VCSGisCheckoutServlet extends VCSGisServlet { |
|
38 |
|
|
39 |
@Override |
|
40 |
protected void doPost(HttpServletRequest request, |
|
41 |
HttpServletResponse response) throws IOException { |
|
42 |
try { |
|
43 |
VCSGisServerController vcsgisserver = this.createVCSGisServerController(); |
|
44 |
VCSGisServerHandler handler = vcsgisserver.createCheckoutHandler(); |
|
45 |
|
|
46 |
InputStream response_stream = handler.handle(request.getInputStream()); |
|
47 |
|
|
48 |
IOUtils.copy(response_stream, response.getWriter()); |
|
49 |
|
|
50 |
// vcsgisserver.dispose(); |
|
51 |
|
|
52 |
response.setStatus(HttpServletResponse.SC_OK); |
|
53 |
response.setContentType("application/json"); |
|
54 |
response.setCharacterEncoding("utf-8"); |
|
55 |
} catch (Exception ex) { |
|
56 |
throw new IOException(ex); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/VCSGisCommitServlet.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.server.lib; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author gvSIG Team |
|
27 |
*/ |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import javax.servlet.http.HttpServletRequest; |
|
31 |
import javax.servlet.http.HttpServletResponse; |
|
32 |
import org.apache.commons.io.IOUtils; |
|
33 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
|
34 |
import org.gvsig.vcsgis.lib.server.VCSGisServerHandler; |
|
35 |
|
|
36 |
|
|
37 |
public class VCSGisCommitServlet extends VCSGisServlet { |
|
38 |
|
|
39 |
@Override |
|
40 |
protected void doPost(HttpServletRequest request, |
|
41 |
HttpServletResponse response) throws IOException { |
|
42 |
try { |
|
43 |
VCSGisServerController vcsgisserver = this.createVCSGisServerController(); |
|
44 |
VCSGisServerHandler handler = vcsgisserver.createCommitHandler(); |
|
45 |
|
|
46 |
InputStream response_stream = handler.handle(request.getInputStream()); |
|
47 |
|
|
48 |
IOUtils.copy(response_stream, response.getWriter()); |
|
49 |
|
|
50 |
// vcsgisserver.dispose(); |
|
51 |
|
|
52 |
response.setStatus(HttpServletResponse.SC_OK); |
|
53 |
response.setContentType("application/json"); |
|
54 |
response.setCharacterEncoding("utf-8"); |
|
55 |
} catch (Exception ex) { |
|
56 |
throw new IOException(ex); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/VCSGisRowDeleteServlet.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.server.lib; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author gvSIG Team |
|
27 |
*/ |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import javax.servlet.http.HttpServletRequest; |
|
31 |
import javax.servlet.http.HttpServletResponse; |
|
32 |
import org.apache.commons.io.IOUtils; |
|
33 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
|
34 |
import org.gvsig.vcsgis.lib.server.VCSGisServerHandler; |
|
35 |
|
|
36 |
|
|
37 |
public class VCSGisRowDeleteServlet extends VCSGisServlet { |
|
38 |
|
|
39 |
@Override |
|
40 |
protected void doPost(HttpServletRequest request, |
|
41 |
HttpServletResponse response) throws IOException { |
|
42 |
try { |
|
43 |
VCSGisServerController vcsgisserver = this.createVCSGisServerController(); |
|
44 |
VCSGisServerHandler handler = vcsgisserver.createRowUpdateHandler(); |
|
45 |
|
|
46 |
InputStream response_stream = handler.handle(request.getInputStream()); |
|
47 |
|
|
48 |
IOUtils.copy(response_stream, response.getWriter()); |
|
49 |
|
|
50 |
// vcsgisserver.dispose(); |
|
51 |
|
|
52 |
response.setStatus(HttpServletResponse.SC_OK); |
|
53 |
response.setContentType("application/json"); |
|
54 |
response.setCharacterEncoding("utf-8"); |
|
55 |
} catch (Exception ex) { |
|
56 |
throw new IOException(ex); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/VCSGisRowUpdateServlet.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.server.lib; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author gvSIG Team |
|
27 |
*/ |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import javax.servlet.http.HttpServletRequest; |
|
31 |
import javax.servlet.http.HttpServletResponse; |
|
32 |
import org.apache.commons.io.IOUtils; |
|
33 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
|
34 |
import org.gvsig.vcsgis.lib.server.VCSGisServerHandler; |
|
35 |
|
|
36 |
|
|
37 |
public class VCSGisRowUpdateServlet extends VCSGisServlet { |
|
38 |
|
|
39 |
@Override |
|
40 |
protected void doPost(HttpServletRequest request, |
|
41 |
HttpServletResponse response) throws IOException { |
|
42 |
try { |
|
43 |
VCSGisServerController vcsgisserver = this.createVCSGisServerController(); |
|
44 |
VCSGisServerHandler handler = vcsgisserver.createRowUpdateHandler(); |
|
45 |
|
|
46 |
InputStream response_stream = handler.handle(request.getInputStream()); |
|
47 |
|
|
48 |
IOUtils.copy(response_stream, response.getWriter()); |
|
49 |
|
|
50 |
// vcsgisserver.dispose(); |
|
51 |
|
|
52 |
response.setStatus(HttpServletResponse.SC_OK); |
|
53 |
response.setContentType("application/json"); |
|
54 |
response.setCharacterEncoding("utf-8"); |
|
55 |
} catch (Exception ex) { |
|
56 |
throw new IOException(ex); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org/gvsig/vcsgis/server/lib/VCSGisRowCreateServlet.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.server.lib; |
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author gvSIG Team |
|
27 |
*/ |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import javax.servlet.http.HttpServletRequest; |
|
31 |
import javax.servlet.http.HttpServletResponse; |
|
32 |
import org.apache.commons.io.IOUtils; |
|
33 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
|
34 |
import org.gvsig.vcsgis.lib.server.VCSGisServerHandler; |
|
35 |
|
|
36 |
|
|
37 |
public class VCSGisRowCreateServlet extends VCSGisServlet { |
|
38 |
|
|
39 |
@Override |
|
40 |
protected void doPost(HttpServletRequest request, |
|
41 |
HttpServletResponse response) throws IOException { |
|
42 |
try { |
|
43 |
VCSGisServerController vcsgisserver = this.createVCSGisServerController(); |
|
44 |
VCSGisServerHandler handler = vcsgisserver.createRowCreateHandler(); |
|
45 |
|
|
46 |
InputStream response_stream = handler.handle(request.getInputStream()); |
|
47 |
|
|
48 |
IOUtils.copy(response_stream, response.getWriter()); |
|
49 |
|
|
50 |
// vcsgisserver.dispose(); |
|
51 |
|
|
52 |
response.setStatus(HttpServletResponse.SC_OK); |
|
53 |
response.setContentType("application/json"); |
|
54 |
response.setCharacterEncoding("utf-8"); |
|
55 |
} catch (Exception ex) { |
|
56 |
throw new IOException(ex); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.api/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/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<artifactId>org.gvsig.vcsgis.lib.api</artifactId> |
|
4 |
<name>${project.artifactId}</name> |
|
5 |
<parent> |
|
6 |
<groupId>org.gvsig</groupId> |
|
7 |
<artifactId>org.gvsig.vcsgis.lib</artifactId> |
|
8 |
<version>1.0.1</version> |
|
9 |
</parent> |
|
10 |
|
|
11 |
<build> |
|
12 |
<plugins> |
|
13 |
<plugin> |
|
14 |
<groupId>org.apache.maven.plugins</groupId> |
|
15 |
<artifactId>maven-jar-plugin</artifactId> |
|
16 |
<configuration> |
|
17 |
</configuration> |
|
18 |
<executions> |
|
19 |
<!-- Generates a jar file only with the test classes --> |
|
20 |
<execution> |
|
21 |
<goals> |
|
22 |
<goal>test-jar</goal> |
|
23 |
</goals> |
|
24 |
</execution> |
|
25 |
</executions> |
|
26 |
</plugin> |
|
27 |
</plugins> |
|
28 |
</build> |
|
29 |
|
|
30 |
<dependencies> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
34 |
<scope>compile</scope> |
|
35 |
</dependency> |
|
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.fmap.dal.db.jdbc</artifactId> |
|
39 |
<scope>compile</scope> |
|
40 |
</dependency> |
|
41 |
</dependencies> |
|
42 |
</project> |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.1/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.api/src/main/resources/org/gvsig/vcsgis/lib/vcsgisapiservices.yaml | ||
---|---|---|
1 |
# |
|
2 |
# https://editor.swagger.io/ |
|
3 |
# |
|
4 |
openapi: 3.0.1 |
|
5 |
info: |
|
6 |
title: VCSGis Simple API |
|
7 |
description: >- |
|
8 |
Simple API to access VCSGis services |
|
9 |
version: 1.0.0 |
|
10 |
tags: |
|
11 |
- name: Application API |
|
12 |
description: > |
|
13 |
They provide the commands necessary to implement a |
|
14 |
desktop client of a VCS. |
|
15 |
- name: Developers API |
|
16 |
description: > |
|
17 |
It exposes services to facilitate integration with |
|
18 |
third-party applications. |
|
19 |
paths: |
|
20 |
/rowcreate: |
|
21 |
post: |
|
22 |
tags: |
|
23 |
- Develeloppers API |
|
24 |
summary: > |
|
25 |
Create a new record in a table/entity |
|
26 |
operationId: RowCreate |
|
27 |
requestBody: |
|
28 |
description: > |
|
29 |
Data for creating the new record |
|
30 |
content: |
|
31 |
application/json: |
|
32 |
schema: |
|
33 |
$ref: '#/components/schemas/RowCreateRequest' |
|
34 |
required: true |
|
35 |
responses: |
|
36 |
'200': |
|
37 |
description: successful operation |
|
38 |
content: |
|
39 |
application/json: |
|
40 |
schema: |
|
41 |
$ref: '#/components/schemas/RowCreateResponse' |
|
42 |
/rowupdate: |
|
43 |
post: |
|
44 |
tags: |
|
45 |
- Develeloppers API |
|
46 |
summary: > |
|
47 |
Update a record in a table/entity |
|
48 |
operationId: RowUpdate |
|
49 |
requestBody: |
|
50 |
description: > |
|
51 |
Data for updating a record |
|
52 |
content: |
|
53 |
application/json: |
|
54 |
schema: |
|
55 |
$ref: '#/components/schemas/RowUpdateRequest' |
|
56 |
required: true |
|
57 |
responses: |
|
58 |
'200': |
|
59 |
description: successful operation |
|
60 |
content: |
|
61 |
application/json: |
|
62 |
schema: |
|
63 |
$ref: '#/components/schemas/RowUpdateResponse' |
|
64 |
/rowdelete: |
|
65 |
post: |
|
66 |
tags: |
|
67 |
- Develeloppers API |
|
68 |
summary: > |
|
69 |
Delete a record in a table/entity |
|
70 |
operationId: RowDelete |
|
71 |
requestBody: |
|
72 |
description: > |
|
73 |
Data for deletion of a record |
|
74 |
content: |
|
75 |
application/json: |
|
76 |
schema: |
|
77 |
$ref: '#/components/schemas/RowDeleteRequest' |
|
78 |
required: true |
|
79 |
responses: |
|
80 |
'200': |
|
81 |
description: successful operation |
|
82 |
content: |
|
83 |
application/json: |
|
84 |
schema: |
|
85 |
$ref: '#/components/schemas/RowDeleteResponse' |
|
86 |
/update: |
|
87 |
post: |
|
88 |
tags: |
|
89 |
- Application API |
|
90 |
summary: > |
|
91 |
Brings changes from the repository to your working copy. |
|
92 |
operationId: Update |
|
93 |
requestBody: |
|
94 |
description: > |
|
95 |
It contains the information to determine what data should be sent to the client. |
|
96 |
content: |
|
97 |
application/json: |
|
98 |
schema: |
|
99 |
$ref: '#/components/schemas/UpdateRequest' |
|
100 |
required: true |
|
101 |
responses: |
|
102 |
'200': |
|
103 |
description: successful operation |
|
104 |
content: |
|
105 |
application/json: |
|
106 |
schema: |
|
107 |
$ref: '#/components/schemas/UpdateResponse' |
|
108 |
components: |
|
109 |
examples: |
|
110 |
ObjectEntity: |
|
111 |
summary: Entity example |
|
112 |
value: |
|
113 |
EntityCode: "00000000000002abcdef0123456789" |
|
114 |
EntityName: "test" |
|
115 |
DatatableName: "VCSGIS_DATA" |
|
116 |
Description: "" |
|
117 |
FeatureIdFieldName: "VCSGISCODE" |
|
118 |
FeatureTypeAsJson: "..." |
|
119 |
FieldForLabel: "text" |
|
120 |
GeometryFieldName: "" |
|
121 |
RevisionCode: "00000000000034abcdef0123456789" |
|
122 |
TopologyPlanCode: "" |
|
123 |
UserCode: "00000000000001abcdef0123456789" |
|
124 |
|
|
125 |
ObjectUpdateEntry: |
|
126 |
summary: UpdateEntry example |
|
127 |
value: |
|
128 |
DataCode: "00000000000100abcdef0123456789" |
|
129 |
EntityCode: "00000000000002abcdef0123456789" |
|
130 |
RevisionCode: "00000000000034abcdef0123456789" |
|
131 |
Operation: 1 |
|
132 |
RevisionNumber: 4 |
|
133 |
EfectiveDate: "2020-02-19 10:11:12.123" |
|
134 |
FeatureRelatedCode: "00000000000022abcdef0123456789" |
|
135 |
Data: "{ \"id\": 4, \"text\": \"DD2\", \"VCSGISCODE\": \"00000000000022abcdef0123456789\"}" |
|
136 |
|
|
137 |
schemas: |
|
138 |
RowCreateRequest: |
|
139 |
required: |
|
140 |
- EntityName |
|
141 |
- LocalRevisionCode |
|
142 |
- Data |
|
143 |
type: object |
|
144 |
description: > |
|
145 |
This object represents a request to create a new record in a |
|
146 |
table. |
|
147 |
|
|
148 |
When the record is created, a unique code will be assigned with |
|
149 |
the VCS, overwriting the value of the VCSGISCODE attribute with the new |
|
150 |
value. |
|
151 |
|
|
152 |
example: |
|
153 |
EntityName: "test" |
|
154 |
LocalRevisionCode: "00000000000014abcdef0123456789" |
|
155 |
EfectiveDate: "2020-02-18 10:11:12.123" |
|
156 |
Comment: "test row create (4, ddd)" |
|
157 |
Data: "{ \"id\": 4, \"text\": \"DDD\", \"VCSGISCODE\": \"\"}" |
|
158 |
properties: |
|
159 |
EntityName: |
|
160 |
type: string |
|
161 |
description: > |
|
162 |
Name of the table in which to create the new record |
|
163 |
LocalRevisionCode: |
|
164 |
type: string |
|
165 |
format: string40 |
|
166 |
description: > |
|
167 |
Code of the revision in which the client data is found |
|
168 |
EfectiveDate: |
|
169 |
type: string |
|
170 |
format: timestamp |
|
171 |
description: > |
|
172 |
Efective date of the operation, in the format yyyy-mm-dd |
|
173 |
hh: MM: ss.LLL. In case of being null, the current date will be assigned. |
|
174 |
Comment: |
|
175 |
type: string |
|
176 |
description: > |
|
177 |
Comment associated with the operation to be performed. It can be null. |
|
178 |
Data: |
|
179 |
type: string |
|
180 |
description: > |
|
181 |
The feature data to create in the table coded as a |
|
182 |
string json. If the feature has the VCSGISCODE field it will be |
|
183 |
overwritten, assigning a new code to it. |
|
184 |
|
|
185 |
RowCreateResponse: |
|
186 |
type: object |
|
187 |
description: > |
|
188 |
This object represents the response to a request to create a new |
|
189 |
record in a table. |
|
190 |
|
|
191 |
|
|
192 |
You will inform us of the status of the request, as well as: |
|
193 |
- The code of the new record created. |
|
194 |
- The code of the revision in which the |
|
195 |
table on the server. |
|
196 |
|
|
197 |
example: |
|
198 |
StatusCode: 0 |
|
199 |
StatusMessage: "" |
|
200 |
RelatedFeatureCode: "00000000000022abcdef0123456789" |
|
201 |
EntityName: "test" |
|
202 |
EntityCode: "00000000000002abcdef0123456789" |
|
203 |
RevisionCode: "00000000000024abcdef0123456789" |
|
204 |
|
|
205 |
properties: |
|
206 |
StatusCode: |
|
207 |
type: integer |
|
208 |
description: > |
|
209 |
Status code of the operation. Zero when the operation has been |
|
210 |
done correctly. |
|
211 |
StatusMessage: |
|
212 |
type: string |
|
213 |
description: > |
|
214 |
In case the operation did not go well, a message describing |
|
215 |
the problem. |
|
216 |
RelatedFeatureCode: |
|
217 |
type: string |
|
218 |
format: string40 |
|
219 |
description: > |
|
220 |
Code assigned to the VCSGISCODE field of the new record, which |
|
221 |
represents the identifier of this in the VCS. |
|
222 |
EntityName: |
|
223 |
type: string |
|
224 |
description: > |
|
225 |
Name of the table in which the new one was requested to be created |
|
226 |
registry |
|
227 |
EntityCode: |
|
228 |
type: string |
|
229 |
format: string40 |
|
230 |
description: > |
|
231 |
Internal code associated with the table to identify it in a way |
|
232 |
Unique. |
|
233 |
RevisionCode: |
|
234 |
type: string |
|
235 |
format: string40 |
|
236 |
description: > |
|
237 |
Code of the revision in which the data is found in the |
|
238 |
server after the operation is performed. |
|
239 |
|
|
240 |
|
|
241 |
RowUpdateRequest: |
|
242 |
required: |
|
243 |
- EntityName |
|
244 |
- LocalRevisionCode |
|
245 |
- Data |
|
246 |
type: object |
|
247 |
description: > |
|
248 |
This object represents a request to update a record in a |
|
249 |
table. |
|
250 |
|
|
251 |
It is essential that the value of the VCSGISCODE attribute of the |
|
252 |
data of the record that we want to update has the correct code, |
|
253 |
since it is used to identify the record we want to update. |
|
254 |
|
|
255 |
example: |
|
256 |
EntityName: "test" |
|
257 |
LocalRevisionCode: "00000000000024abcdef0123456789" |
|
258 |
EfectiveDate: null |
|
259 |
Comment: "test row update (4, dd2)" |
|
260 |
Data: "{ \"id\": 4, \"text\": \"DD2\", \"VCSGISCODE\": \"00000000000022abcdef0123456789\"}" |
|
261 |
properties: |
|
262 |
EntityName: |
|
263 |
type: string |
|
264 |
description: > |
|
265 |
Name of the table in which the record is requested to be updated |
|
266 |
LocalRevisionCode: |
|
267 |
type: string |
|
268 |
format: string40 |
|
269 |
description: > |
|
270 |
Code of the revision in which the client data is located |
|
271 |
EfectiveDate: |
|
272 |
type: string |
|
273 |
format: timestamp |
|
274 |
description: > |
|
275 |
Efective date of the operation, in the format yyyy-mm-dd |
|
276 |
hh:MM:ss.LLL. In case of being null, the current date will be assigned. |
|
277 |
Comment: |
|
278 |
type: string |
|
279 |
description: > |
|
280 |
Comment associated with the operation to be performed. It can be null. |
|
281 |
Data: |
|
282 |
type: string |
|
283 |
description: > |
|
284 |
The feature data to create in the table coded as a |
|
285 |
string json. The VCSGISCODE attribute must have a valid code and |
|
286 |
It will identify the record that is being updated. |
|
287 |
|
|
288 |
RowUpdateResponse: |
|
289 |
type: object |
|
290 |
description: > |
|
291 |
This object represents the response to a request to update a |
|
292 |
record in a table. |
|
293 |
|
|
294 |
example: |
|
295 |
StatusCode: 0 |
|
296 |
StatusMessage: "" |
|
297 |
EntityName: "test" |
|
298 |
EntityCode: "00000000000002abcdef0123456789" |
|
299 |
RevisionCode: "00000000000029abcdef0123456789" |
|
300 |
properties: |
|
301 |
StatusCode: |
|
302 |
type: integer |
|
303 |
description: > |
|
304 |
Operation status code. Zero when the operation has |
|
305 |
done correctly. |
|
306 |
StatusMessage: |
|
307 |
type: string |
|
308 |
description: > |
|
309 |
In case the operation did not go well, a message describing |
|
310 |
the problem. |
|
311 |
EntityName: |
|
312 |
type: string |
|
313 |
description: > |
|
314 |
Name of the table in which the requested was create the new record |
|
315 |
EntityCode: |
|
316 |
type: string |
|
317 |
format: string40 |
|
318 |
description: > |
|
319 |
Internal code associated with the table to identify. |
|
320 |
RevisionCode: |
|
321 |
type: string |
|
322 |
format: string40 |
|
323 |
description: > |
|
324 |
Code of the revision in which the data is found in the |
|
325 |
server after the operation is performed. |
|
326 |
|
|
327 |
RowDeleteRequest: |
|
328 |
required: |
|
329 |
- EntityName |
|
330 |
- LocalRevisionCode |
|
331 |
- RelatedFeatureCode |
|
332 |
type: object |
|
333 |
description: > |
|
334 |
This object represents a request to delete a record in a |
|
335 |
table. |
|
336 |
|
|
337 |
|
|
338 |
The record to be deleted will be identified by the value of the |
|
339 |
*RelatedFeatureCode* attribute. |
|
340 |
|
|
341 |
example: |
|
342 |
EntityName: "test" |
|
343 |
LocalRevisionCode: "00000000000029abcdef0123456789" |
|
344 |
RelatedFeatureCode: "00000000000022abcdef0123456789" |
|
345 |
EfectiveDate: "2020-02-19 10:11:12.123" |
|
346 |
Comment: "test row delete (4, dd2)" |
|
347 |
properties: |
|
348 |
EntityName: |
|
349 |
type: string |
|
350 |
description: > |
|
351 |
Name of the table in which to delete the record |
|
352 |
LocalRevisionCode: |
|
353 |
type: string |
|
354 |
format: string40 |
|
355 |
description: > |
|
356 |
Code of the revision in which the client data is located |
|
357 |
EfectiveDate: |
Also available in: Unified diff