fixed importer to execute the import contextually
This commit is contained in:
parent
9f9a022e79
commit
f2caea5724
23
pom.xml
23
pom.xml
@ -232,6 +232,17 @@
|
|||||||
<artifactId>jdom</artifactId>
|
<artifactId>jdom</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.json-lib</groupId>
|
||||||
|
<artifactId>json-lib</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
<classifier>jdk15</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.servicemix.bundles</groupId>
|
||||||
|
<artifactId>org.apache.servicemix.bundles.restlet</artifactId>
|
||||||
|
<version>1.1.10_3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
@ -243,6 +254,7 @@
|
|||||||
<artifactId>jcl-over-slf4j</artifactId>
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
<version>${slf4j.version}</version>
|
<version>${slf4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- commons-logging can be rather simply and conveniently excluded as
|
<!-- commons-logging can be rather simply and conveniently excluded as
|
||||||
a dependency by declaring it in the provided scope within the pom.xml file
|
a dependency by declaring it in the provided scope within the pom.xml file
|
||||||
of your project. The actual commons-logging classes would be provided by
|
of your project. The actual commons-logging classes would be provided by
|
||||||
@ -275,16 +287,7 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.geoserver.importer</groupId>
|
|
||||||
<artifactId>gs-importer-core</artifactId>
|
|
||||||
<version>${gs.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.geoserver</groupId>
|
|
||||||
<artifactId>gs-restconfig</artifactId>
|
|
||||||
<version>${gs.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.restlet</groupId>
|
<groupId>org.restlet</groupId>
|
||||||
<artifactId>org.restlet.ext.fileupload</artifactId>
|
<artifactId>org.restlet.ext.fileupload</artifactId>
|
||||||
|
|||||||
@ -25,7 +25,6 @@ import java.net.URL;
|
|||||||
import net.sf.json.JSON;
|
import net.sf.json.JSON;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
import org.geoserver.importer.VFSWorker;
|
|
||||||
import org.restlet.data.MediaType;
|
import org.restlet.data.MediaType;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -152,6 +151,23 @@ public class GeoServerRESTImporterManager extends GeoServerRESTAbstractManager {
|
|||||||
public void putTaskLayer(int imp, int task, final String json) throws Exception {
|
public void putTaskLayer(int imp, int task, final String json) throws Exception {
|
||||||
HTTPUtils.putJson(String.format(buildUrl()+"/%d/tasks/%d/layer", imp, task), json, gsuser, gspass);
|
HTTPUtils.putJson(String.format(buildUrl()+"/%d/tasks/%d/layer", imp, task), json, gsuser, gspass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Just update the Layers properties associated to a Task (t) in the Importer Context (i).
|
||||||
|
*
|
||||||
|
* e.g.:
|
||||||
|
* <pre>
|
||||||
|
* putTaskLayer(i, t, "{\"title\":\"Archsites\", \"abstract\":\"Archeological Sites\"}");
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param imp int: Import context number ID
|
||||||
|
* @param task int: Task number
|
||||||
|
* @param json String: JSON containing the Layer properties to be updated
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void postTaskTransform(int imp, int task, final String json) throws Exception {
|
||||||
|
HTTPUtils.postJson(String.format(buildUrl()+"/%d/tasks/%d/transforms", imp, task), json, gsuser, gspass);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty Importer Context.
|
* Creates an empty Importer Context.
|
||||||
@ -199,7 +215,7 @@ public class GeoServerRESTImporterManager extends GeoServerRESTAbstractManager {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void postImport(int imp) throws Exception {
|
public void postImport(int imp) throws Exception {
|
||||||
HTTPUtils.post(buildUrl()+"/" + imp, "", "text/plain", gsuser, gspass);
|
HTTPUtils.post(buildUrl()+"/" + imp + "?exec=true", "", "text/plain", gsuser, gspass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -286,7 +302,7 @@ public class GeoServerRESTImporterManager extends GeoServerRESTAbstractManager {
|
|||||||
|
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
|
|
||||||
new VFSWorker().extractTo(file, dir);
|
//new VFSWorker().extractTo(file, dir);
|
||||||
if (!file.delete()) {
|
if (!file.delete()) {
|
||||||
// fail early as tests will expect it's deleted
|
// fail early as tests will expect it's deleted
|
||||||
throw new IOException("deletion failed during extraction");
|
throw new IOException("deletion failed during extraction");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user