This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch workflow
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit 31aee85f6eb7fed506e648cf8b1e1d5ea3ec82eb
Author: Bertil Chapuis <[email protected]>
AuthorDate: Fri Nov 17 16:49:19 2023 +0100

    Replace UnzipFile by DecompressFile task in workflows
---
 .../baremaps/workflow/tasks/DecompressFile.java     |  3 ++-
 basemap/import.js                                   | 21 ++++++++++++---------
 examples/geocoding/workflow.js                      |  2 +-
 examples/ip-to-location/workflow.js                 |  7 ++++---
 examples/naturalearth/workflow.json                 |  7 ++++---
 examples/shadedrelief/workflow.json                 |  7 ++++---
 6 files changed, 27 insertions(+), 20 deletions(-)

diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressFile.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressFile.java
index e5a4108b..f9398307 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressFile.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressFile.java
@@ -181,7 +181,8 @@ public class DecompressFile implements Task {
         var entry = entries.nextElement();
         var path = target.resolve(entry.getName());
         Files.createDirectories(path.getParent());
-        Files.write(path, new byte[] {}, StandardOpenOption.CREATE,
+        Files.write(path, new byte[] {},
+            StandardOpenOption.CREATE,
             StandardOpenOption.TRUNCATE_EXISTING);
         try (var input = new 
BufferedInputStream(zipFile.getInputStream(entry));
             var output = new BufferedOutputStream(new 
FileOutputStream(path.toFile()))) {
diff --git a/basemap/import.js b/basemap/import.js
index fec1e00a..d887461e 100644
--- a/basemap/import.js
+++ b/basemap/import.js
@@ -28,9 +28,10 @@ export default {
           "path": "data/natural_earth_vector.gpkg.zip"
         },
         {
-          "type": "UnzipFile",
-          "file": "data/natural_earth_vector.gpkg.zip",
-          "directory": "data/natural_earth_vector"
+          "type": "DecompressFile",
+          "source": "data/natural_earth_vector.gpkg.zip",
+          "target": "data/natural_earth_vector",
+          "compression": "zip"
         },
         {
           "type": "ImportGeoPackage",
@@ -57,9 +58,10 @@ export default {
           "path": "data/water-polygons-split-3857.zip"
         },
         {
-          "type": "UnzipFile",
-          "file": "data/water-polygons-split-3857.zip",
-          "directory": "data"
+          "type": "DecompressFile",
+          "source": "data/water-polygons-split-3857.zip",
+          "target": "data",
+          "compression": "zip"
         },
         {
           "type": "ImportShapefile",
@@ -80,9 +82,10 @@ export default {
           "path": "data/simplified-water-polygons-split-3857.zip"
         },
         {
-          "type": "UnzipFile",
-          "file": "data/simplified-water-polygons-split-3857.zip",
-          "directory": "data"
+          "type": "DecompressFile",
+          "source": "data/simplified-water-polygons-split-3857.zip",
+          "target": "data",
+          "compression": "zip"
         },
         {
           "type": "ImportShapefile",
diff --git a/examples/geocoding/workflow.js b/examples/geocoding/workflow.js
index bee197f8..ba54fcc0 100644
--- a/examples/geocoding/workflow.js
+++ b/examples/geocoding/workflow.js
@@ -19,7 +19,7 @@ const geonamesUrl = 
"https://download.geonames.org/export/dump/allCountries.zip";
 // Fetch and unzip Geonames
 const FetchAndUnzipGeonames = {id: "fetch-geonames-allcountries", needs: [], 
tasks: [
     {type: "DownloadUrl", url: geonamesUrl, path: 
"downloads/geonames-allcountries.zip", force: true},
-    {type: "UnzipFile", file: "downloads/geonames-allcountries.zip", 
directory: "archives"}
+    {type: "DecompressFile", source: "downloads/geonames-allcountries.zip", 
target: "archives", compression: "zip"}
 ]};
 
 // Create the Geocoder index
diff --git a/examples/ip-to-location/workflow.js 
b/examples/ip-to-location/workflow.js
index c262e179..67c5d9db 100644
--- a/examples/ip-to-location/workflow.js
+++ b/examples/ip-to-location/workflow.js
@@ -77,9 +77,10 @@ export default {"steps": [
                 force: true
             },
             {
-                type: "UnzipFile",
-                file: "downloads/geonames-allcountries.zip",
-                directory: "archives"
+                type: "DecompressFile",
+                source: "downloads/geonames-allcountries.zip",
+                target: "archives",
+                compression: "zip"
             },
             {
                 type: "CreateGeonamesIndex",
diff --git a/examples/naturalearth/workflow.json 
b/examples/naturalearth/workflow.json
index bd9d6444..b7a66864 100644
--- a/examples/naturalearth/workflow.json
+++ b/examples/naturalearth/workflow.json
@@ -10,9 +10,10 @@
           "path": "natural_earth_vector.gpkg.zip"
         },
         {
-          "type": "UnzipFile",
-          "file": "natural_earth_vector.gpkg.zip",
-          "directory": "natural_earth_vector"
+          "type": "DecompressFile",
+          "source": "natural_earth_vector.gpkg.zip",
+          "target": "natural_earth_vector",
+          "compression": "zip"
         },
         {
           "type": "ImportGeoPackage",
diff --git a/examples/shadedrelief/workflow.json 
b/examples/shadedrelief/workflow.json
index 48407d52..f88c5d06 100644
--- a/examples/shadedrelief/workflow.json
+++ b/examples/shadedrelief/workflow.json
@@ -10,9 +10,10 @@
           "path": "shadedrelief.zip"
         },
         {
-          "type": "UnzipFile",
-          "file": "shadedrelief.zip",
-          "directory": "shadedrelief"
+          "type": "DecompressFile",
+          "source": "shadedrelief.zip",
+          "target": "shadedrelief",
+          "compression": "zip"
         }
       ]
     }

Reply via email to