You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@baremaps.apache.org by bc...@apache.org on 2023/11/17 13:06:36 UTC
(incubator-baremaps) branch workflow updated (df4fa4aa -> e8198440)
This is an automated email from the ASF dual-hosted git repository.
bchapuis pushed a change to branch workflow
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
omit df4fa4aa Format code
omit 8cd22e2f Remove unused method
omit a8d8939e Add javadoc
omit 7b061068 Move the type name in the sub classes
omit 8b814828 Improve workflow and replace records by classes
add ac8d8c80 Add documentation for the cache flag (#803)
new 817d1d29 Improve workflow and replace records by classes
new 378b12f3 Move the type name in the sub classes
new 30b7eed7 Add javadoc
new 501fa522 Remove unused method
new aa75b7a6 Format code
new 8ad99cf2 Add dependency to hk2
new e8198440 Remove unused methods
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (df4fa4aa)
\
N -- N -- N refs/heads/workflow (e8198440)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/baremaps/cli/database/UpdateOsm.java | 6 +-
.../java/org/apache/baremaps/cli/map/Serve.java | 5 +-
baremaps-core/pom.xml | 8 ++
.../tasks/CreateGeocoderOpenStreetMap.java | 18 ----
.../workflow/tasks/CreateGeonamesIndex.java | 20 ----
.../baremaps/workflow/tasks/CreateIplocIndex.java | 26 -----
.../baremaps/workflow/tasks/DecompressFile.java | 59 -----------
.../baremaps/workflow/tasks/DownloadUrl.java | 29 ------
.../baremaps/workflow/tasks/ExecuteCommand.java | 23 -----
.../apache/baremaps/workflow/tasks/ExecuteSql.java | 61 -----------
.../baremaps/workflow/tasks/ExecuteSqlScript.java | 43 --------
.../baremaps/workflow/tasks/ExportVectorTiles.java | 44 --------
.../workflow/tasks/ImportDaylightFeatures.java | 43 --------
.../workflow/tasks/ImportDaylightTranslations.java | 43 --------
.../baremaps/workflow/tasks/ImportGeoPackage.java | 79 --------------
.../baremaps/workflow/tasks/ImportOsmOsc.java | 97 -----------------
.../baremaps/workflow/tasks/ImportOsmPbf.java | 115 ---------------------
.../baremaps/workflow/tasks/ImportShapefile.java | 79 --------------
.../apache/baremaps/workflow/tasks/LogMessage.java | 25 -----
.../apache/baremaps/workflow/tasks/UngzipFile.java | 43 --------
.../apache/baremaps/workflow/tasks/UnzipFile.java | 43 --------
.../baremaps/workflow/tasks/UpdateOsmDatabase.java | 52 +---------
pom.xml | 11 ++
23 files changed, 29 insertions(+), 943 deletions(-)
(incubator-baremaps) 05/07: Format code
Posted by bc...@apache.org.
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 aa75b7a602a8adfa911510fff22c7cd286bdc921
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Thu Nov 16 23:32:07 2023 +0100
Format code
---
.../apache/baremaps/workflow/tasks/UpdateOsmDatabase.java | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
index b6513d04..d374be1a 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
@@ -21,9 +21,6 @@ import static org.apache.baremaps.stream.ConsumerUtils.consumeThenReturn;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.BufferedInputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
import java.util.List;
import java.util.zip.GZIPInputStream;
import org.apache.baremaps.database.collection.DataMap;
@@ -118,13 +115,13 @@ public class UpdateOsmDatabase implements Task {
this.databaseSrid = databaseSrid;
}
- public String getReplicationUrl() {
- return replicationUrl;
- }
+ public String getReplicationUrl() {
+ return replicationUrl;
+ }
- public void setReplicationUrl(String replicationUrl) {
- this.replicationUrl = replicationUrl;
- }
+ public void setReplicationUrl(String replicationUrl) {
+ this.replicationUrl = replicationUrl;
+ }
/**
* {@inheritDoc}
(incubator-baremaps) 03/07: Add javadoc
Posted by bc...@apache.org.
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 30b7eed72674750f5fd21fa7b8583f70ebe546eb
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Mon Nov 13 16:33:29 2023 +0100
Add javadoc
---
.../baremaps/workflow/tasks/DecompressBZip2.java | 78 --------------
.../baremaps/workflow/tasks/DecompressFile.java | 117 ++++++++++++++++++---
.../baremaps/workflow/tasks/DownloadUrl.java | 17 ++-
.../baremaps/workflow/tasks/ExecuteCommand.java | 25 +++++
.../apache/baremaps/workflow/tasks/ExecuteSql.java | 50 ++++++++-
.../baremaps/workflow/tasks/ExecuteSqlScript.java | 35 ++++++
.../baremaps/workflow/tasks/ExportVectorTiles.java | 1 +
.../workflow/tasks/ImportDaylightFeatures.java | 44 ++++++--
.../workflow/tasks/ImportDaylightTranslations.java | 35 ++++++
.../baremaps/workflow/tasks/ImportGeoPackage.java | 57 ++++++++++
.../baremaps/workflow/tasks/ImportOsmOsc.java | 68 ++++++++++++
.../baremaps/workflow/tasks/ImportOsmPbf.java | 92 ++++++++++++++++
.../baremaps/workflow/tasks/ImportShapefile.java | 57 ++++++++++
.../apache/baremaps/workflow/tasks/LogMessage.java | 24 +++++
.../apache/baremaps/workflow/tasks/UngzipFile.java | 35 ++++++
.../apache/baremaps/workflow/tasks/UnzipFile.java | 35 ++++++
.../baremaps/workflow/tasks/UpdateOsmDatabase.java | 66 ++++++++++++
.../apache/baremaps/workflow/ObjectMapperTest.java | 2 +-
.../org/apache/baremaps/workflow/WorkflowTest.java | 15 +--
.../baremaps/workflow/tasks/DownloadUrlTest.java | 6 +-
20 files changed, 738 insertions(+), 121 deletions(-)
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java
deleted file mode 100644
index ef17fe00..00000000
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.baremaps.workflow.tasks;
-
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import java.io.BufferedInputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
-import org.apache.baremaps.workflow.Task;
-import org.apache.baremaps.workflow.WorkflowContext;
-import org.apache.baremaps.workflow.WorkflowException;
-import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@JsonTypeName("DecompressBZip2")
-public class DecompressBZip2 implements Task {
-
- private static final Logger logger = LoggerFactory.getLogger(DecompressBZip2.class);
-
- private Path source;
- private Path target;
-
- public DecompressBZip2() {}
-
- public DecompressBZip2(Path source, Path target) {
- this.source = source;
- this.target = target;
- }
-
- public Path getSource() {
- return source;
- }
-
- public void setSource(Path source) {
- this.source = source;
- }
-
- public Path getTarget() {
- return target;
- }
-
- public void setTarget(Path target) {
- this.target = target;
- }
-
- @Override
- public void execute(WorkflowContext context) throws Exception {
- var sourcePath = source.toAbsolutePath();
- try (var bufferedInputStream = new BufferedInputStream(Files.newInputStream(sourcePath));
- var compressedInputStream = new BZip2CompressorInputStream(bufferedInputStream)) {
- var targetPath = target.toAbsolutePath();
- if (!Files.exists(targetPath)) {
- Files.createDirectories(targetPath.getParent());
- Files.createFile(targetPath);
- }
- Files.copy(compressedInputStream, targetPath, StandardCopyOption.REPLACE_EXISTING);
- } catch (Exception e) {
- throw new WorkflowException(e);
- }
- }
-}
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 4d991077..37b0ac0e 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
@@ -33,11 +33,18 @@ import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Decompresses a file based on a given compression format. The supported formats are zip, targz,
+ * tarbz2, gzip and bzip2.
+ */
@JsonTypeName("DecompressFile")
public class DecompressFile implements Task {
private static final Logger logger = LoggerFactory.getLogger(DecompressFile.class);
+ /**
+ * The compression format.
+ */
public enum Compression {
zip,
targz,
@@ -47,43 +54,84 @@ public class DecompressFile implements Task {
}
private Path source;
-
private Path target;
-
private Compression compression;
+ /**
+ * Constructs a {@code DecompressFile}.
+ */
public DecompressFile() {}
+ /**
+ * Constructs a {@code DecompressFile}.
+ *
+ * @param source the source file
+ * @param target the target file
+ * @param compression the compression format (zip, targz, tarbz2, gzip or bzip2)
+ */
public DecompressFile(Path source, Path target, Compression compression) {
this.source = source;
this.target = target;
this.compression = compression;
}
+ /**
+ * Returns the source file.
+ *
+ * @return the source file
+ */
public Path getSource() {
return source;
}
+ /**
+ * Sets the source file.
+ *
+ * @param source the source file
+ */
public void setSource(Path source) {
this.source = source;
}
+ /**
+ * Returns the target file.
+ *
+ * @return the target file
+ */
public Path getTarget() {
return target;
}
+ /**
+ * Sets the target file.
+ *
+ * @param target the target file
+ */
public void setTarget(Path target) {
this.target = target;
}
+ /**
+ * Returns the compression format.
+ *
+ * @return the compression format
+ */
public Compression getCompression() {
return compression;
}
+ /**
+ * Sets the compression format.
+ *
+ * @param compression the compression format
+ */
public void setCompression(Compression compression) {
this.compression = compression;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var sourcePath = source.toAbsolutePath();
@@ -97,26 +145,47 @@ public class DecompressFile implements Task {
}
}
- public static void decompressBzip2(Path sourcePath, Path targetPath) throws IOException {
- try (var bufferedInputStream = new BufferedInputStream(Files.newInputStream(sourcePath));
+ /**
+ * Decompresses a bzip2 file.
+ *
+ * @param source the source file
+ * @param target the target file
+ * @throws IOException if an I/O error occurs
+ */
+ protected static void decompressBzip2(Path source, Path target) throws IOException {
+ try (var bufferedInputStream = new BufferedInputStream(Files.newInputStream(source));
var bzip2InputStream = new BZip2CompressorInputStream(bufferedInputStream)) {
- Files.copy(bzip2InputStream, targetPath, StandardCopyOption.REPLACE_EXISTING);
+ Files.copy(bzip2InputStream, target, StandardCopyOption.REPLACE_EXISTING);
}
}
- public static void decompressGzip(Path sourcePath, Path targetPath) throws IOException {
- try (var zis = new GZIPInputStream(new BufferedInputStream(Files.newInputStream(sourcePath)))) {
- Files.copy(zis, targetPath, StandardCopyOption.REPLACE_EXISTING);
+ /**
+ * Decompresses a gzip file.
+ *
+ * @param source the source file
+ * @param target the target file
+ * @throws IOException if an I/O error occurs
+ */
+ protected static void decompressGzip(Path source, Path target) throws IOException {
+ try (var zis = new GZIPInputStream(new BufferedInputStream(Files.newInputStream(source)))) {
+ Files.copy(zis, target, StandardCopyOption.REPLACE_EXISTING);
}
}
- public static void decompressTarGz(Path sourcePath, Path targetPath) throws IOException {
- try (var bufferedInputStream = new BufferedInputStream(Files.newInputStream(sourcePath));
+ /**
+ * Decompresses a tar.gz file.
+ *
+ * @param source the source file
+ * @param target the target file
+ * @throws IOException if an I/O error occurs
+ */
+ protected static void decompressTarGz(Path source, Path target) throws IOException {
+ try (var bufferedInputStream = new BufferedInputStream(Files.newInputStream(source));
var gzipInputStream = new GZIPInputStream(bufferedInputStream);
var tarInputStream = new TarArchiveInputStream(gzipInputStream)) {
TarArchiveEntry entry;
while ((entry = (TarArchiveEntry) tarInputStream.getNextEntry()) != null) {
- var path = targetPath.resolve(entry.getName());
+ var path = target.resolve(entry.getName());
if (entry.isDirectory()) {
Files.createDirectories(path);
} else {
@@ -134,13 +203,20 @@ public class DecompressFile implements Task {
}
}
- public static void decompressTarBz2(Path sourcePath, Path targetPath) throws IOException {
- try (var bufferedInputStream = new BufferedInputStream(Files.newInputStream(sourcePath));
+ /**
+ * Decompresses a tar.bz2 file.
+ *
+ * @param source the source file
+ * @param target the target file
+ * @throws IOException if an I/O error occurs
+ */
+ protected static void decompressTarBz2(Path source, Path target) throws IOException {
+ try (var bufferedInputStream = new BufferedInputStream(Files.newInputStream(source));
var bzip2InputStream = new BZip2CompressorInputStream(bufferedInputStream);
var tarInputStream = new TarArchiveInputStream(bzip2InputStream)) {
TarArchiveEntry entry;
while ((entry = (TarArchiveEntry) tarInputStream.getNextEntry()) != null) {
- var path = targetPath.resolve(entry.getName());
+ var path = target.resolve(entry.getName());
if (entry.isDirectory()) {
Files.createDirectories(path);
} else {
@@ -158,12 +234,19 @@ public class DecompressFile implements Task {
}
}
- public static void decompressZip(Path sourcePath, Path targetPath) throws IOException {
- try (var zipFile = new ZipFile(sourcePath.toFile())) {
+ /**
+ * Decompresses a zip file.
+ *
+ * @param source the source file
+ * @param target the target file
+ * @throws IOException if an I/O error occurs
+ */
+ protected static void decompressZip(Path source, Path target) throws IOException {
+ try (var zipFile = new ZipFile(source.toFile())) {
var entries = zipFile.entries();
while (entries.hasMoreElements()) {
var entry = entries.nextElement();
- var path = targetPath.resolve(entry.getName());
+ var path = target.resolve(entry.getName());
Files.createDirectories(path.getParent());
Files.write(path, new byte[] {}, StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
index 3b7bd5b6..767de347 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
@@ -30,6 +30,9 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Downloads a file from a URL.
+ */
@JsonTypeName("DownloadUrl")
public class DownloadUrl implements Task {
@@ -47,12 +50,18 @@ public class DownloadUrl implements Task {
private Boolean replaceExisting;
+ /**
+ * Constructs an {@code DownloadUrl}.
+ */
public DownloadUrl() {}
- public DownloadUrl(String url, Path path) {
- this(url, path, false);
- }
-
+ /**
+ * Constructs an {@code DownloadUrl}.
+ *
+ * @param url the url
+ * @param path the path
+ * @param replaceExisting whether to replace existing files
+ */
public DownloadUrl(String url, Path path, boolean replaceExisting) {
this.url = url;
this.path = path;
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
index 6ccd6ddb..6d273a09 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
@@ -23,6 +23,9 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Execute a bash command.
+ */
@JsonTypeName("ExecuteCommand")
public class ExecuteCommand implements Task {
@@ -30,22 +33,44 @@ public class ExecuteCommand implements Task {
private String command;
+ /**
+ * Constructs an {@code ExecuteCommand}.
+ */
public ExecuteCommand() {}
+ /**
+ * Constructs an {@code ExecuteCommand}.
+ *
+ * @param command the bash command
+ */
public ExecuteCommand(String command) {
this.command = command;
}
+ /**
+ * Returns the bash command.
+ *
+ * @return the bash command
+ */
public String getCommand() {
return command;
}
+ /**
+ * Sets the bash command.
+ *
+ * @param command the bash command
+ */
public void setCommand(String command) {
this.command = command;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
new ProcessBuilder().command("/bin/sh", "-c", command).start().waitFor();
}
+
}
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
index f405250c..96bb151e 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
@@ -30,6 +30,9 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Execute a SQL query (single statement).
+ */
@JsonTypeName("ExecuteSql")
public class ExecuteSql implements Task {
@@ -39,42 +42,85 @@ public class ExecuteSql implements Task {
private Path file;
- private boolean parallel;
+ private Boolean parallel;
+ /**
+ * Constructs an {@code ExecuteSql}.
+ */
public ExecuteSql() {
}
- public ExecuteSql(Object database, Path file, boolean parallel) {
+ /**
+ * Constructs an {@code ExecuteSql}.
+ *
+ * @param database the database
+ * @param file the SQL file
+ * @param parallel whether to execute the queries in parallel
+ */
+ public ExecuteSql(Object database, Path file, Boolean parallel) {
this.database = database;
this.file = file;
this.parallel = parallel;
}
+ /**
+ * Returns the database.
+ *
+ * @return the database
+ */
public Object getDatabase() {
return database;
}
+ /**
+ * Sets the database.
+ *
+ * @param database the database
+ */
public void setDatabase(Object database) {
this.database = database;
}
+ /**
+ * Returns the SQL file.
+ *
+ * @return the SQL file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the SQL file.
+ *
+ * @param file the SQL file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * Returns whether to execute the queries in parallel.
+ *
+ * @return whether to execute the queries in parallel
+ */
public boolean isParallel() {
return parallel;
}
+ /**
+ * Sets whether to execute the queries in parallel.
+ *
+ * @param parallel whether to execute the queries in parallel
+ */
public void setParallel(boolean parallel) {
this.parallel = parallel;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var script = clean(Files.readString(file));
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
index e8b95e82..af8dff0d 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
@@ -27,6 +27,9 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Execute a SQL script (multiple statements).
+ */
@JsonTypeName("ExecuteSqlScript")
public class ExecuteSqlScript implements Task {
@@ -36,31 +39,63 @@ public class ExecuteSqlScript implements Task {
private Path file;
+ /**
+ * Constructs an {@code ExecuteSqlScript}.
+ */
public ExecuteSqlScript() {
}
+ /**
+ * Constructs an {@code ExecuteSqlScript}.
+ *
+ * @param database the database
+ * @param file the SQL file
+ */
public ExecuteSqlScript(Object database, Path file) {
this.database = database;
this.file = file;
}
+ /**
+ * Returns the database.
+ *
+ * @return the database
+ */
public Object getDatabase() {
return database;
}
+ /**
+ * Sets the database.
+ *
+ * @param database the database
+ */
public void setDatabase(Object database) {
this.database = database;
}
+ /**
+ * Returns the SQL file.
+ *
+ * @return the SQL file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the SQL file.
+ *
+ * @param file the SQL file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var script = Files.readString(file);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
index cf6c7202..7e54476a 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
@@ -44,6 +44,7 @@ import org.locationtech.jts.geom.Envelope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
@JsonTypeName("ExportVectorTiles")
public class ExportVectorTiles implements Task {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
index ba00a255..d116e339 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
@@ -32,6 +32,9 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Import daylight features.
+ */
@JsonTypeName("ImportDaylightFeatures")
public class ImportDaylightFeatures implements Task {
@@ -49,31 +52,63 @@ public class ImportDaylightFeatures implements Task {
private Object database;
+ /**
+ * Constructs an {@code ImportDaylightFeatures}.
+ */
public ImportDaylightFeatures() {
}
+ /**
+ * Constructs an {@code ImportDaylightFeatures}.
+ *
+ * @param file the daylight file
+ * @param database the database
+ */
public ImportDaylightFeatures(Path file, Object database) {
this.file = file;
this.database = database;
}
+ /**
+ * Returns the daylight file.
+ *
+ * @return the daylight file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the daylight file.
+ *
+ * @param file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * Returns the database.
+ *
+ * @return
+ */
public Object getDatabase() {
return database;
}
+ /**
+ * Sets the database.
+ *
+ * @param database
+ */
public void setDatabase(Object database) {
this.database = database;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var datasource = context.getDataSource(database);
@@ -95,42 +130,33 @@ public class ImportDaylightFeatures implements Task {
case "node" -> {
var node = nodeRepository.get(feature.id());
if (node != null) {
- // Merge the tags
var tags = new HashMap<>(feature.tags());
if (node.getTags() != null) {
tags.putAll(node.getTags());
}
node.setTags(tags);
-
- // Update the node
nodeRepository.put(node);
}
}
case "way" -> {
var way = wayRepository.get(feature.id());
if (way != null) {
- // Merge the tags
var tags = new HashMap<>(feature.tags());
if (way.getTags() != null) {
tags.putAll(way.getTags());
}
way.setTags(tags);
-
- // Update the way
wayRepository.put(way);
}
}
case "relation" -> {
var relation = relationRepository.get(feature.id());
if (relation != null) {
- // Merge the tags
var tags = new HashMap<>(feature.tags());
if (relation.getTags() != null) {
tags.putAll(relation.getTags());
}
relation.setTags(tags);
-
- // Update the relation
relationRepository.put(relation);
}
}
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
index dc6dc619..93ef1b09 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
@@ -30,6 +30,9 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Import daylight translations.
+ */
@JsonTypeName("ImportDaylightTranslations")
public class ImportDaylightTranslations implements Task {
@@ -61,31 +64,63 @@ public class ImportDaylightTranslations implements Task {
private Object database;
+ /**
+ * Constructs an {@code ImportDaylightTranslations}.
+ */
public ImportDaylightTranslations() {
}
+ /**
+ * Constructs an {@code ImportDaylightTranslations}.
+ *
+ * @param file the daylight file
+ * @param database the database
+ */
public ImportDaylightTranslations(Path file, Object database) {
this.file = file;
this.database = database;
}
+ /**
+ * Returns the daylight file.
+ *
+ * @return the daylight file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the daylight file.
+ *
+ * @param file the daylight file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * Returns the database.
+ *
+ * @return the database
+ */
public Object getDatabase() {
return database;
}
+ /**
+ * Sets the database.
+ *
+ * @param database the database
+ */
public void setDatabase(Object database) {
this.database = database;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var datasource = context.getDataSource(database);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
index 882f8548..c2e73f5a 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
@@ -30,6 +30,9 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Import a GeoPackage into a database.
+ */
@JsonTypeName("ImportGeoPackage")
public class ImportGeoPackage implements Task {
@@ -40,10 +43,21 @@ public class ImportGeoPackage implements Task {
private Integer sourceSRID;
private Integer targetSRID;
+ /**
+ * Constructs an {@code ImportGeoPackage}.
+ */
public ImportGeoPackage() {
}
+ /**
+ * Constructs an {@code ImportGeoPackage}.
+ *
+ * @param file the GeoPackage file
+ * @param database the database
+ * @param sourceSRID the source SRID
+ * @param targetSRID the target SRID
+ */
public ImportGeoPackage(Path file, Object database, Integer sourceSRID, Integer targetSRID) {
this.file = file;
this.database = database;
@@ -51,38 +65,81 @@ public class ImportGeoPackage implements Task {
this.targetSRID = targetSRID;
}
+ /**
+ * Returns the GeoPackage file.
+ *
+ * @return the GeoPackage file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the GeoPackage file.
+ *
+ * @param file the GeoPackage file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * Returns the database.
+ *
+ * @return the database
+ */
public Object getDatabase() {
return database;
}
+ /**
+ * Sets the database.
+ *
+ * @param database the database
+ */
public void setDatabase(Object database) {
this.database = database;
}
+ /**
+ * Returns the source SRID.
+ *
+ * @return the source SRID
+ */
public Integer getSourceSRID() {
return sourceSRID;
}
+ /**
+ * Sets the source SRID.
+ *
+ * @param sourceSRID the source SRID
+ */
public void setSourceSRID(Integer sourceSRID) {
this.sourceSRID = sourceSRID;
}
+ /**
+ * Returns the target SRID.
+ *
+ * @return the target SRID
+ */
public Integer getTargetSRID() {
return targetSRID;
}
+ /**
+ * Sets the target SRID.
+ *
+ * @param targetSRID the target SRID
+ */
public void setTargetSRID(Integer targetSRID) {
this.targetSRID = targetSRID;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var path = file.toAbsolutePath();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
index da65e523..045ce4c2 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
@@ -42,6 +42,9 @@ import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Import an OSM OSC file into a database.
+ */
@JsonTypeName("ImportOsmOsc")
public class ImportOsmOsc implements Task {
@@ -53,10 +56,22 @@ public class ImportOsmOsc implements Task {
private Integer srid;
private Compression compression;
+ /**
+ * Constructs an {@code ImportOsmOsc}.
+ */
public ImportOsmOsc() {
}
+ /**
+ * Constructs an {@code ImportOsmOsc}.
+ *
+ * @param file the OSM OSC file
+ * @param cache the cache directory
+ * @param database the database
+ * @param srid the database SRID
+ * @param compression the compression
+ */
public ImportOsmOsc(Path file, Path cache, Object database, Integer srid,
Compression compression) {
this.file = file;
@@ -66,46 +81,99 @@ public class ImportOsmOsc implements Task {
this.compression = compression;
}
+ /**
+ * Returns the OSM OSC file.
+ *
+ * @return the OSM OSC file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the OSM OSC file.
+ *
+ * @param file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * Returns the cache directory.
+ *
+ * @return the cache directory
+ */
public Path getCache() {
return cache;
}
+ /**
+ * Sets the cache directory.
+ *
+ * @param cache the cache directory
+ */
public void setCache(Path cache) {
this.cache = cache;
}
+ /**
+ * Returns the database.
+ *
+ * @return the database
+ */
public Object getDatabase() {
return database;
}
+ /**
+ * Sets the database.
+ *
+ * @param database the database
+ */
public void setDatabase(Object database) {
this.database = database;
}
+ /**
+ * Returns the database SRID.
+ *
+ * @return the database SRID
+ */
public Integer getSrid() {
return srid;
}
+ /**
+ * Sets the database SRID.
+ *
+ * @param srid the database SRID
+ */
public void setSrid(Integer srid) {
this.srid = srid;
}
+ /**
+ * Returns the compression.
+ *
+ * @return the compression
+ */
public Compression getCompression() {
return compression;
}
+ /**
+ * Sets the compression.
+ *
+ * @param compression the compression
+ */
public void setCompression(Compression compression) {
this.compression = compression;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var datasource = context.getDataSource(database);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
index 8a14d78c..d996037c 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
@@ -47,6 +47,9 @@ import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Import an OSM PBF file into a database.
+ */
@JsonTypeName("ImportOsmPbf")
public class ImportOsmPbf implements Task {
@@ -59,10 +62,23 @@ public class ImportOsmPbf implements Task {
private Integer databaseSrid;
private Boolean replaceExisting;
+ /**
+ * Constructs an {@code ImportOsmPbf}.
+ */
public ImportOsmPbf() {
}
+ /**
+ * Constructs an {@code ImportOsmPbf}.
+ *
+ * @param file the OSM PBF file
+ * @param cache the cache directory
+ * @param cleanCache whether to clean the cache directory
+ * @param database the database
+ * @param databaseSrid the database SRID
+ * @param replaceExisting whether to replace the existing tables
+ */
public ImportOsmPbf(Path file, Path cache, Boolean cleanCache, Object database,
Integer databaseSrid, Boolean replaceExisting) {
this.file = file;
@@ -73,54 +89,117 @@ public class ImportOsmPbf implements Task {
this.replaceExisting = replaceExisting;
}
+ /**
+ * Returns the OSM PBF file.
+ *
+ * @return the OSM PBF file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the OSM PBF file.
+ *
+ * @param file the OSM PBF file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * Returns the cache directory.
+ *
+ * @return the cache directory
+ */
public Path getCache() {
return cache;
}
+ /**
+ * Sets the cache directory.
+ *
+ * @param cache the cache directory
+ */
public void setCache(Path cache) {
this.cache = cache;
}
+ /**
+ * Returns whether to clean the cache directory.
+ *
+ * @return whether to clean the cache directory
+ */
public Boolean getCleanCache() {
return cleanCache;
}
+ /**
+ * Sets whether to clean the cache directory.
+ *
+ * @param cleanCache whether to clean the cache directory
+ */
public void setCleanCache(Boolean cleanCache) {
this.cleanCache = cleanCache;
}
+ /**
+ * Returns the database.
+ *
+ * @return the database
+ */
public Object getDatabase() {
return database;
}
+ /**
+ * Sets the database.
+ *
+ * @param database the database
+ */
public void setDatabase(Object database) {
this.database = database;
}
+ /**
+ * Returns the database SRID.
+ *
+ * @return the database SRID
+ */
public Integer getDatabaseSrid() {
return databaseSrid;
}
+ /**
+ * Sets the database SRID.
+ *
+ * @param databaseSrid the database SRID
+ */
public void setDatabaseSrid(Integer databaseSrid) {
this.databaseSrid = databaseSrid;
}
+ /**
+ * Returns whether to replace the existing tables.
+ *
+ * @return whether to replace the existing tables
+ */
public Boolean getReplaceExisting() {
return replaceExisting;
}
+ /**
+ * Sets whether to replace the existing tables.
+ *
+ * @param replaceExisting whether to replace the existing tables
+ */
public void setReplaceExisting(Boolean replaceExisting) {
this.replaceExisting = replaceExisting;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var dataSource = context.getDataSource(database);
@@ -189,6 +268,19 @@ public class ImportOsmPbf implements Task {
}
}
+ /**
+ * Imports an OSM PBF file into a database.
+ *
+ * @param path the OSM PBF file
+ * @param coordinateMap the coordinate map
+ * @param referenceMap the reference map
+ * @param headerRepository the header repository
+ * @param nodeRepository the node repository
+ * @param wayRepository the way repository
+ * @param relationRepository the relation repository
+ * @param databaseSrid the database SRID
+ * @throws IOException
+ */
public static void execute(
Path path,
DataMap<Long, Coordinate> coordinateMap,
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
index 5a68ce03..d67cad51 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
@@ -30,6 +30,9 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Import a shapefile into a database.
+ */
@JsonTypeName("ImportShapefile")
public class ImportShapefile implements Task {
@@ -40,10 +43,21 @@ public class ImportShapefile implements Task {
private Integer sourceSRID;
private Integer targetSRID;
+ /**
+ * Constructs an {@code ImportShapefile}.
+ */
public ImportShapefile() {
}
+ /**
+ * Constructs an {@code ImportShapefile}.
+ *
+ * @param file the shapefile file
+ * @param database the database
+ * @param sourceSRID the source SRID
+ * @param targetSRID the target SRID
+ */
public ImportShapefile(Path file, Object database, Integer sourceSRID, Integer targetSRID) {
this.file = file;
this.database = database;
@@ -51,38 +65,81 @@ public class ImportShapefile implements Task {
this.targetSRID = targetSRID;
}
+ /**
+ * Returns the shapefile file.
+ *
+ * @return the shapefile file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the shapefile file.
+ *
+ * @param file the shapefile file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * Returns the database.
+ *
+ * @return the database
+ */
public Object getDatabase() {
return database;
}
+ /**
+ * Sets the database.
+ *
+ * @param database the database
+ */
public void setDatabase(Object database) {
this.database = database;
}
+ /**
+ * Returns the source SRID.
+ *
+ * @return the source SRID
+ */
public Integer getSourceSRID() {
return sourceSRID;
}
+ /**
+ * Sets the source SRID.
+ *
+ * @param sourceSRID the source SRID
+ */
public void setSourceSRID(Integer sourceSRID) {
this.sourceSRID = sourceSRID;
}
+ /**
+ * Returns the target SRID.
+ *
+ * @return the target SRID
+ */
public Integer getTargetSRID() {
return targetSRID;
}
+ /**
+ * Sets the target SRID.
+ *
+ * @param targetSRID the target SRID
+ */
public void setTargetSRID(Integer targetSRID) {
this.targetSRID = targetSRID;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var path = file.toAbsolutePath();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
index f57387bd..2261d3f6 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
@@ -23,6 +23,9 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Log a message.
+ */
@JsonTypeName("LogMessage")
public class LogMessage implements Task {
@@ -30,22 +33,43 @@ public class LogMessage implements Task {
private String message;
+ /**
+ * Constructs an {@code LogMessage}.
+ */
public LogMessage() {
}
+ /**
+ * Constructs an {@code LogMessage}.
+ *
+ * @param message the message
+ */
public LogMessage(String message) {
this.message = message;
}
+ /**
+ * Returns the message.
+ *
+ * @return the message
+ */
public String getMessage() {
return message;
}
+ /**
+ * Sets the message.
+ *
+ * @param message the message
+ */
public void setMessage(String message) {
this.message = message;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
logger.info(message);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
index cd9d3f8c..c34bcb1d 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
@@ -29,6 +29,9 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Ungzip a file.
+ */
@JsonTypeName("UngzipFile")
public class UngzipFile implements Task {
@@ -37,31 +40,63 @@ public class UngzipFile implements Task {
private Path file;
private Path directory;
+ /**
+ * Constructs an {@code UngzipFile}.
+ */
public UngzipFile() {
}
+ /**
+ * Constructs an {@code UngzipFile}.
+ *
+ * @param file the file
+ * @param directory the directory
+ */
public UngzipFile(Path file, Path directory) {
this.file = file;
this.directory = directory;
}
+ /**
+ * Returns the file.
+ *
+ * @return the file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the file.
+ *
+ * @param file the file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * Returns the directory.
+ *
+ * @return the directory
+ */
public Path getDirectory() {
return directory;
}
+ /**
+ * Sets the directory.
+ *
+ * @param directory the directory
+ */
public void setDirectory(Path directory) {
this.directory = directory;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var filePath = file.toAbsolutePath();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
index 4c95f599..02185a90 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
@@ -26,6 +26,9 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Unzip a file.
+ */
@JsonTypeName("UnzipFile")
public class UnzipFile implements Task {
@@ -34,31 +37,63 @@ public class UnzipFile implements Task {
private Path file;
private Path directory;
+ /**
+ * Constructs an {@code UnzipFile}.
+ */
public UnzipFile() {
}
+ /**
+ * Constructs an {@code UnzipFile}.
+ *
+ * @param file the file
+ * @param directory the directory
+ */
public UnzipFile(Path file, Path directory) {
this.file = file;
this.directory = directory;
}
+ /**
+ * Returns the file.
+ *
+ * @return the file
+ */
public Path getFile() {
return file;
}
+ /**
+ * Sets the file.
+ *
+ * @param file the file
+ */
public void setFile(Path file) {
this.file = file;
}
+ /**
+ * Returns the directory.
+ *
+ * @return the directory
+ */
public Path getDirectory() {
return directory;
}
+ /**
+ * Sets the directory.
+ *
+ * @param directory the directory
+ */
public void setDirectory(Path directory) {
this.directory = directory;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var filePath = file.toAbsolutePath();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
index b11e8449..9dce1563 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
@@ -21,6 +21,9 @@ import static org.apache.baremaps.stream.ConsumerUtils.consumeThenReturn;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.BufferedInputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
import java.util.List;
import java.util.zip.GZIPInputStream;
import org.apache.baremaps.database.collection.DataMap;
@@ -47,6 +50,9 @@ import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Update an OSM database based on the header data stored in the database.
+ */
@JsonTypeName("UpdateOsmDatabase")
public class UpdateOsmDatabase implements Task {
@@ -58,27 +64,56 @@ public class UpdateOsmDatabase implements Task {
private String replicationUrl;
+ /**
+ * Constructs an {@code UpdateOsmDatabase}.
+ */
public UpdateOsmDatabase() {
}
+ /**
+ * Constructs an {@code UpdateOsmDatabase}.
+ *
+ * @param database the database
+ * @param databaseSrid the database SRID
+ */
public UpdateOsmDatabase(Object database, Integer databaseSrid) {
this.database = database;
this.databaseSrid = databaseSrid;
}
+ /**
+ * Returns the database.
+ *
+ * @return the database
+ */
public Object getDatabase() {
return database;
}
+ /**
+ * Sets the database.
+ *
+ * @param database the database
+ */
public void setDatabase(Object database) {
this.database = database;
}
+ /**
+ * Returns the database SRID.
+ *
+ * @return the database SRID
+ */
public Integer getDatabaseSrid() {
return databaseSrid;
}
+ /**
+ * Sets the database SRID.
+ *
+ * @param databaseSrid the database SRID
+ */
public void setDatabaseSrid(Integer databaseSrid) {
this.databaseSrid = databaseSrid;
}
@@ -91,6 +126,9 @@ public class UpdateOsmDatabase implements Task {
this.replicationUrl = replicationUrl;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void execute(WorkflowContext context) throws Exception {
var datasource = context.getDataSource(database);
@@ -111,6 +149,18 @@ public class UpdateOsmDatabase implements Task {
replicationUrl);
}
+ /**
+ * Executes the task.
+ *
+ * @param coordinateMap the coordinate map
+ * @param referenceMap the reference map
+ * @param headerRepository the header repository
+ * @param nodeRepository the node repository
+ * @param wayRepository the way repository
+ * @param relationRepository the relation repository
+ * @param databaseSrid the SRID
+ * @throws Exception if something went wrong
+ */
public static void execute(DataMap<Long, Coordinate> coordinateMap,
DataMap<Long, List<Long>> referenceMap,
HeaderRepository headerRepository, Repository<Long, Node> nodeRepository,
@@ -160,4 +210,20 @@ public class UpdateOsmDatabase implements Task {
}
}
+ /**
+ * Returns the URL of the file with the given sequence number.
+ *
+ * @param replicationUrl the replication URL
+ * @param sequenceNumber the sequence number
+ * @param extension the file extension
+ * @return the URL of the file
+ * @throws MalformedURLException if the URL is malformed
+ */
+ public static URL resolve(String replicationUrl, Long sequenceNumber, String extension)
+ throws MalformedURLException {
+ var s = String.format("%09d", sequenceNumber);
+ var uri = String.format("%s/%s/%s/%s.%s", replicationUrl, s.substring(0, 3), s.substring(3, 6),
+ s.substring(6, 9), extension);
+ return URI.create(uri).toURL();
+ }
}
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java
index 0bfd1dab..a754c92d 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java
@@ -39,7 +39,7 @@ public class ObjectMapperTest {
new Step("download", List.of(),
List.of(new DownloadUrl(
"https://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf",
- Paths.get("liechtenstein-latest.osm.pbf")))),
+ Paths.get("liechtenstein-latest.osm.pbf"), false))),
new Step("import", List.of("download"),
List.of(new ImportOsmPbf(Paths.get("liechtenstein-latest.osm.pbf"),
null,
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java
index d52a27b6..c8ba01d8 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java
@@ -37,7 +37,7 @@ class WorkflowTest extends PostgresContainerTest {
void naturalearthGeoPackage() {
var workflow = new Workflow(List.of(new Step("fetch-geopackage", List.of(), List.of(
new DownloadUrl("https://naciscdn.org/naturalearth/packages/natural_earth_vector.gpkg.zip",
- Paths.get("natural_earth_vector.gpkg.zip")),
+ Paths.get("natural_earth_vector.gpkg.zip"), false),
new UnzipFile(Paths.get("natural_earth_vector.gpkg.zip"),
Paths.get("natural_earth_vector")),
new ImportGeoPackage(Paths.get("natural_earth_vector/packages/natural_earth_vector.gpkg"),
@@ -52,7 +52,7 @@ class WorkflowTest extends PostgresContainerTest {
var workflow = new Workflow(List.of(new Step("fetch-geopackage", List.of(),
List.of(
new DownloadUrl("https://osmdata.openstreetmap.de/download/coastlines-split-4326.zip",
- Paths.get("coastlines-split-4326.zip")),
+ Paths.get("coastlines-split-4326.zip"), false),
new UnzipFile(Paths.get("coastlines-split-4326.zip"),
Paths.get("coastlines-split-4326")),
new ImportShapefile(Paths.get("coastlines-split-4326/coastlines-split-4326/lines.shp"),
@@ -84,7 +84,7 @@ class WorkflowTest extends PostgresContainerTest {
void workflow() {
var workflow = new Workflow(List.of(new Step("fetch-geopackage", List.of(), List.of(
new DownloadUrl("https://naciscdn.org/naturalearth/packages/natural_earth_vector.gpkg.zip",
- Paths.get("downloads/import_db.gpkg")),
+ Paths.get("downloads/import_db.gpkg"), false),
new ImportShapefile(Paths.get("downloads/import_db.gpkg"), jdbcUrl(), 4326, 3857)))));
new WorkflowExecutor(workflow).execute();
}
@@ -95,20 +95,20 @@ class WorkflowTest extends PostgresContainerTest {
var workflow = new Workflow(List.of(
new Step("fetch-geopackage", List.of(),
List.of(new DownloadUrl("https://tiles.baremaps.com/samples/import_db.gpkg",
- Paths.get("downloads/import_db.gpkg")))),
+ Paths.get("downloads/import_db.gpkg"), false))),
new Step("import-geopackage", List.of("fetch-geopackage"),
List.of(new ImportGeoPackage(Paths.get("downloads/import_db.gpkg"), jdbcUrl(), 4326,
3857))),
new Step("fetch-osmpbf", List.of(),
List.of(new DownloadUrl("https://tiles.baremaps.com/samples/liechtenstein.osm.pbf",
- Paths.get("downloads/liechtenstein.osm.pbf")))),
+ Paths.get("downloads/liechtenstein.osm.pbf"), false))),
new Step("import-osmpbf", List.of("fetch-osmpbf"),
List.of(new ImportOsmPbf(Paths.get("downloads/liechtenstein.osm.pbf"), null, true,
jdbcUrl(),
3857, true))),
new Step("fetch-shapefile", List.of(), List.of(new DownloadUrl(
"https://osmdata.openstreetmap.de/download/simplified-water-polygons-split-3857.zip",
- Paths.get("downloads/simplified-water-polygons-split-3857.zip")))),
+ Paths.get("downloads/simplified-water-polygons-split-3857.zip"), false))),
new Step("unzip-shapefile", List.of("fetch-shapefile"),
List.of(
new UnzipFile(Paths.get("downloads/simplified-water-polygons-split-3857.zip"),
@@ -116,7 +116,8 @@ class WorkflowTest extends PostgresContainerTest {
new Step("fetch-projection", List.of("unzip-shapefile"),
List.of(new DownloadUrl("https://spatialreference.org/ref/sr-org/epsg3857/prj/",
Paths.get(
- "archives/simplified-water-polygons-split-3857/simplified_water_polygons.prj")))),
+ "archives/simplified-water-polygons-split-3857/simplified_water_polygons.prj"),
+ false))),
new Step("import-shapefile", List.of("fetch-projection"),
List.of(new ImportShapefile(
Paths.get(
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/DownloadUrlTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/DownloadUrlTest.java
index ac8c68b7..1c2526f1 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/DownloadUrlTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/DownloadUrlTest.java
@@ -49,7 +49,7 @@ class DownloadUrlTest {
var file = directory.resolve("file");
// TODO: do not use a 3rd party server, replaces test URL to a baremaps owned test resource.
var task = new DownloadUrl("ftp://whois.in.bell.ca/bell.db.gz",
- file);
+ file, false);
task.execute(new WorkflowContext());
assertTrue(file.toFile().length() > 50, "file is less than 50 bytes");
FileUtils.deleteRecursively(directory);
@@ -62,7 +62,7 @@ class DownloadUrlTest {
var file = directory.resolve("file");
assertThrows(IllegalArgumentException.class, () -> {
var task = new DownloadUrl("file://not-existing-file-243jhks",
- file);
+ file, false);
task.execute(new WorkflowContext());
}, "Unsupported protocol throws IOException");
FileUtils.deleteRecursively(directory);
@@ -74,7 +74,7 @@ class DownloadUrlTest {
var directory = Files.createTempDirectory("tmp_");
var file = directory.resolve("README.md");
var task = new DownloadUrl("https://raw.githubusercontent.com/baremaps/baremaps/main/README.md",
- file.toAbsolutePath());
+ file.toAbsolutePath(), false);
task.execute(new WorkflowContext());
assertTrue(Files.readString(file).contains("Baremaps"));
FileUtils.deleteRecursively(directory);
(incubator-baremaps) 01/07: Improve workflow and replace records by classes
Posted by bc...@apache.org.
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 817d1d291a21ebd3070384c2c925dbeab15b091a
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Mon Nov 13 14:46:21 2023 +0100
Improve workflow and replace records by classes
---
.../org/apache/baremaps/cli/workflow/Execute.java | 2 +-
.../apache/baremaps/workflow/WorkflowExecutor.java | 40 ++++++-----
.../tasks/CreateGeocoderOpenStreetMap.java | 33 ++++++++--
.../workflow/tasks/CreateGeonamesIndex.java | 31 ++++++++-
.../baremaps/workflow/tasks/CreateIplocIndex.java | 41 ++++++++++--
.../baremaps/workflow/tasks/DecompressBZip2.java | 32 ++++++++-
.../baremaps/workflow/tasks/DecompressFile.java | 42 +++++++++++-
.../baremaps/workflow/tasks/DownloadUrl.java | 44 ++++++++++++-
.../baremaps/workflow/tasks/ExecuteCommand.java | 18 ++++-
.../apache/baremaps/workflow/tasks/ExecuteSql.java | 42 +++++++++++-
.../baremaps/workflow/tasks/ExecuteSqlScript.java | 35 +++++++++-
.../baremaps/workflow/tasks/ExportVectorTiles.java | 68 +++++++++++++++++--
.../workflow/tasks/ImportDaylightFeatures.java | 35 +++++++++-
.../workflow/tasks/ImportDaylightTranslations.java | 36 +++++++++-
.../baremaps/workflow/tasks/ImportGeoPackage.java | 52 ++++++++++++++-
.../baremaps/workflow/tasks/ImportOsmOsc.java | 66 +++++++++++++++++--
.../baremaps/workflow/tasks/ImportOsmPbf.java | 77 ++++++++++++++++++++--
.../baremaps/workflow/tasks/ImportShapefile.java | 52 ++++++++++++++-
.../apache/baremaps/workflow/tasks/LogMessage.java | 20 +++++-
.../apache/baremaps/workflow/tasks/UngzipFile.java | 30 ++++++++-
.../apache/baremaps/workflow/tasks/UnzipFile.java | 34 +++++++++-
.../baremaps/workflow/tasks/UpdateOsmDatabase.java | 40 ++++++++++-
.../org/apache/baremaps/workflow/WorkflowTest.java | 10 +--
23 files changed, 805 insertions(+), 75 deletions(-)
diff --git a/baremaps-cli/src/main/java/org/apache/baremaps/cli/workflow/Execute.java b/baremaps-cli/src/main/java/org/apache/baremaps/cli/workflow/Execute.java
index b19c70aa..6e67645e 100644
--- a/baremaps-cli/src/main/java/org/apache/baremaps/cli/workflow/Execute.java
+++ b/baremaps-cli/src/main/java/org/apache/baremaps/cli/workflow/Execute.java
@@ -50,7 +50,7 @@ public class Execute implements Callable<Integer> {
var configReader = new ConfigReader();
var workflow = mapper.readValue(configReader.read(file.toAbsolutePath()), Workflow.class);
try (var executor = new WorkflowExecutor(workflow)) {
- executor.execute().get();
+ executor.execute();
}
logger.info("Finished executing the workflow {}", file);
return 0;
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/WorkflowExecutor.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/WorkflowExecutor.java
index 43de015c..6d37e270 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/WorkflowExecutor.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/WorkflowExecutor.java
@@ -105,17 +105,21 @@ public class WorkflowExecutor implements AutoCloseable {
/**
* Executes the workflow.
*/
- public CompletableFuture<Void> execute() {
- // Create futures for each end step
- var endSteps = graph.nodes().stream()
- .filter(this::isEndStep)
- .map(this::getFutureStep)
- .toArray(CompletableFuture[]::new);
-
- // Create a future that logs the stepMeasures when all the futures are completed
- var future = CompletableFuture.allOf(endSteps).thenRun(this::logStepMeasures);
-
- return future;
+ public void execute() {
+ try {
+ // Create futures for each end step
+ var endSteps = graph.nodes().stream()
+ .filter(this::isEndStep)
+ .map(this::getStep)
+ .toArray(CompletableFuture[]::new);
+
+ // Wait for all the end steps to complete
+ CompletableFuture.allOf(endSteps).join();
+ logStepMeasures();
+
+ } catch (Exception e) {
+ logger.error("Error while executing the workflow", e);
+ }
}
/**
@@ -125,8 +129,8 @@ public class WorkflowExecutor implements AutoCloseable {
* @param step the step id
* @return the future step
*/
- private CompletableFuture<Void> getFutureStep(String step) {
- return futures.computeIfAbsent(step, this::createFutureStep);
+ private CompletableFuture<Void> getStep(String step) {
+ return futures.computeIfAbsent(step, this::createStep);
}
/**
@@ -135,10 +139,10 @@ public class WorkflowExecutor implements AutoCloseable {
* @param stepId the step id
* @return the future step
*/
- private CompletableFuture<Void> createFutureStep(String stepId) {
+ private CompletableFuture<Void> createStep(String stepId) {
// Initialize the future step with the previous future step
// as it depends on its completion.
- var future = getPreviousFutureStep(stepId);
+ var future = getPreviousStep(stepId);
// Time the execution of the tasks
var measures = new ArrayList<TaskMeasure>();
@@ -182,7 +186,7 @@ public class WorkflowExecutor implements AutoCloseable {
* @param stepId the step id
* @return the future step
*/
- private CompletableFuture<Void> getPreviousFutureStep(String stepId) {
+ private CompletableFuture<Void> getPreviousStep(String stepId) {
var predecessors = graph.predecessors(stepId).stream().toList();
// If the step has no predecessor,
@@ -194,13 +198,13 @@ public class WorkflowExecutor implements AutoCloseable {
// If the step has one predecessor,
// return the future step associated to it.
if (predecessors.size() == 1) {
- return getFutureStep(predecessors.get(0));
+ return getStep(predecessors.get(0));
}
// If the step has multiple predecessors,
// return a future step that completes when all the predecessors complete.
var futurePredecessors = predecessors.stream()
- .map(this::getFutureStep)
+ .map(this::getStep)
.toArray(CompletableFuture[]::new);
return CompletableFuture.allOf(futurePredecessors);
}
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java
index 055ed5cb..41f72d65 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java
@@ -48,15 +48,40 @@ import org.slf4j.LoggerFactory;
/**
* Experimental feature.
- *
+ *
* @see org.apache.baremaps.geocoderosm
*/
-public record CreateGeocoderOpenStreetMap(Path file, Path indexDirectory)
- implements
- Task {
+public class CreateGeocoderOpenStreetMap implements Task {
private static final Logger logger = LoggerFactory.getLogger(CreateGeocoderOpenStreetMap.class);
+ private Path file;
+
+ private Path indexDirectory;
+
+ public CreateGeocoderOpenStreetMap() {}
+
+ public CreateGeocoderOpenStreetMap(Path file, Path indexDirectory) {
+ this.file = file;
+ this.indexDirectory = indexDirectory;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public Path getIndexDirectory() {
+ return indexDirectory;
+ }
+
+ public void setIndexDirectory(Path indexDirectory) {
+ this.indexDirectory = indexDirectory;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java
index 79ed1158..3c4d974d 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java
@@ -35,10 +35,39 @@ import org.slf4j.LoggerFactory;
/**
* A task that creates a geonames index.
*/
-public record CreateGeonamesIndex(Path dataFile, Path indexDirectory) implements Task {
+public class CreateGeonamesIndex implements Task {
private static final Logger logger = LoggerFactory.getLogger(CreateGeonamesIndex.class);
+ private Path dataFile;
+
+ private Path indexDirectory;
+
+ public CreateGeonamesIndex() {
+
+ }
+
+ public CreateGeonamesIndex(Path dataFile, Path indexDirectory) {
+ this.dataFile = dataFile;
+ this.indexDirectory = indexDirectory;
+ }
+
+ public Path getDataFile() {
+ return dataFile;
+ }
+
+ public void setDataFile(Path dataFile) {
+ this.dataFile = dataFile;
+ }
+
+ public Path getIndexDirectory() {
+ return indexDirectory;
+ }
+
+ public void setIndexDirectory(Path indexDirectory) {
+ this.indexDirectory = indexDirectory;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var directory = MMapDirectory.open(indexDirectory);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java
index bfbd5d9b..9ae4fe6f 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java
@@ -36,13 +36,46 @@ import org.slf4j.LoggerFactory;
import org.sqlite.SQLiteConfig;
import org.sqlite.SQLiteDataSource;
-public record CreateIplocIndex(
- Path geonamesIndexPath,
- List<Path> nicPaths,
- Path targetIplocIndexPath) implements Task {
+public class CreateIplocIndex implements Task {
private static final Logger logger = LoggerFactory.getLogger(CreateIplocIndex.class);
+ private Path geonamesIndexPath;
+ private List<Path> nicPaths;
+ private Path targetIplocIndexPath;
+
+ public CreateIplocIndex() {}
+
+ public CreateIplocIndex(Path geonamesIndexPath, List<Path> nicPaths, Path targetIplocIndexPath) {
+ this.geonamesIndexPath = geonamesIndexPath;
+ this.nicPaths = nicPaths;
+ this.targetIplocIndexPath = targetIplocIndexPath;
+ }
+
+ public Path getGeonamesIndexPath() {
+ return geonamesIndexPath;
+ }
+
+ public void setGeonamesIndexPath(Path geonamesIndexPath) {
+ this.geonamesIndexPath = geonamesIndexPath;
+ }
+
+ public List<Path> getNicPaths() {
+ return nicPaths;
+ }
+
+ public void setNicPaths(List<Path> nicPaths) {
+ this.nicPaths = nicPaths;
+ }
+
+ public Path getTargetIplocIndexPath() {
+ return targetIplocIndexPath;
+ }
+
+ public void setTargetIplocIndexPath(Path targetIplocIndexPath) {
+ this.targetIplocIndexPath = targetIplocIndexPath;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
try (var directory = MMapDirectory.open(geonamesIndexPath);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java
index 9ed96630..9217f077 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java
@@ -25,8 +25,38 @@ import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.apache.baremaps.workflow.WorkflowException;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public record DecompressBZip2(Path source, Path target) implements Task {
+public class DecompressBZip2 implements Task {
+
+ private static final Logger logger = LoggerFactory.getLogger(DecompressBZip2.class);
+
+ private Path source;
+ private Path target;
+
+ public DecompressBZip2() {}
+
+ public DecompressBZip2(Path source, Path target) {
+ this.source = source;
+ this.target = target;
+ }
+
+ public Path getSource() {
+ return source;
+ }
+
+ public void setSource(Path source) {
+ this.source = source;
+ }
+
+ public Path getTarget() {
+ return target;
+ }
+
+ public void setTarget(Path target) {
+ this.target = target;
+ }
@Override
public void execute(WorkflowContext context) throws Exception {
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 4aa1bb38..2551389a 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
@@ -32,7 +32,9 @@ import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record DecompressFile(Path source, Path target, Compression compression) implements Task {
+public class DecompressFile implements Task {
+
+ private static final Logger logger = LoggerFactory.getLogger(DecompressFile.class);
public enum Compression {
zip,
@@ -42,7 +44,43 @@ public record DecompressFile(Path source, Path target, Compression compression)
bzip2;
}
- private static final Logger logger = LoggerFactory.getLogger(UngzipFile.class);
+ private Path source;
+
+ private Path target;
+
+ private Compression compression;
+
+ public DecompressFile() {}
+
+ public DecompressFile(Path source, Path target, Compression compression) {
+ this.source = source;
+ this.target = target;
+ this.compression = compression;
+ }
+
+ public Path getSource() {
+ return source;
+ }
+
+ public void setSource(Path source) {
+ this.source = source;
+ }
+
+ public Path getTarget() {
+ return target;
+ }
+
+ public void setTarget(Path target) {
+ this.target = target;
+ }
+
+ public Compression getCompression() {
+ return compression;
+ }
+
+ public void setCompression(Compression compression) {
+ this.compression = compression;
+ }
@Override
public void execute(WorkflowContext context) throws Exception {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
index c6362ea5..1955fbfb 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
@@ -29,17 +29,57 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record DownloadUrl(String url, Path path, boolean replaceExisting) implements Task {
+public class DownloadUrl implements Task {
+
+ private static final Logger logger = LoggerFactory.getLogger(DownloadUrl.class);
private static final String PROTOCOL_FTP = "ftp";
+
private static final String PROTOCOL_HTTP = "http";
+
private static final String PROTOCOL_HTTPS = "https";
+ private String url;
+
+ private Path path;
+
+ private Boolean replaceExisting;
+
+ public DownloadUrl() {}
+
public DownloadUrl(String url, Path path) {
this(url, path, false);
}
- private static final Logger logger = LoggerFactory.getLogger(DownloadUrl.class);
+ public DownloadUrl(String url, Path path, boolean replaceExisting) {
+ this.url = url;
+ this.path = path;
+ this.replaceExisting = replaceExisting;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public Path getPath() {
+ return path;
+ }
+
+ public void setPath(Path path) {
+ this.path = path;
+ }
+
+ public Boolean getReplaceExisting() {
+ return replaceExisting;
+ }
+
+ public void setReplaceExisting(Boolean replaceExisting) {
+ this.replaceExisting = replaceExisting;
+ }
@Override
public void execute(WorkflowContext context) throws Exception {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
index 4cb4218b..4c21502c 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
@@ -22,10 +22,26 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record ExecuteCommand(String command) implements Task {
+public class ExecuteCommand implements Task {
private static final Logger logger = LoggerFactory.getLogger(ExecuteCommand.class);
+ private String command;
+
+ public ExecuteCommand() {}
+
+ public ExecuteCommand(String command) {
+ this.command = command;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
new ProcessBuilder().command("/bin/sh", "-c", command).start().waitFor();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
index 25058c8d..12c35844 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
@@ -29,10 +29,50 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record ExecuteSql(Object database, Path file, boolean parallel) implements Task {
+public class ExecuteSql implements Task {
private static final Logger logger = LoggerFactory.getLogger(ExecuteSql.class);
+ private Object database;
+
+ private Path file;
+
+ private boolean parallel;
+
+ public ExecuteSql() {
+
+ }
+
+ public ExecuteSql(Object database, Path file, boolean parallel) {
+ this.database = database;
+ this.file = file;
+ this.parallel = parallel;
+ }
+
+ public Object getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(Object database) {
+ this.database = database;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public boolean isParallel() {
+ return parallel;
+ }
+
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var script = clean(Files.readString(file));
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
index 50341a47..432d9ef9 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
@@ -23,8 +23,41 @@ import java.sql.SQLException;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.apache.baremaps.workflow.WorkflowException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public record ExecuteSqlScript(Object database, Path file) implements Task {
+public class ExecuteSqlScript implements Task {
+
+ private static final Logger logger = LoggerFactory.getLogger(ExecuteSqlScript.class);
+
+ private Object database;
+
+ private Path file;
+
+ public ExecuteSqlScript() {
+
+ }
+
+ public ExecuteSqlScript(Object database, Path file) {
+ this.database = database;
+ this.file = file;
+ }
+
+ public Object getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(Object database) {
+ this.database = database;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
@Override
public void execute(WorkflowContext context) throws Exception {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
index 3f5e1854..8437acbf 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
@@ -43,19 +43,73 @@ import org.locationtech.jts.geom.Envelope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record ExportVectorTiles(
- Path tileset,
- Path repository,
- int batchArraySize,
- int batchArrayIndex,
- Format format) implements Task {
+public class ExportVectorTiles implements Task {
+
+ private static final Logger logger = LoggerFactory.getLogger(ExportVectorTiles.class);
public enum Format {
file,
mbtiles
}
- private static final Logger logger = LoggerFactory.getLogger(ExportVectorTiles.class);
+ private Path tileset;
+ private Path repository;
+ private Integer batchArraySize;
+ private Integer batchArrayIndex;
+ private Format format;
+
+ public ExportVectorTiles() {
+
+ }
+
+ public ExportVectorTiles(Path tileset, Path repository, Integer batchArraySize,
+ Integer batchArrayIndex, Format format) {
+ this.tileset = tileset;
+ this.repository = repository;
+ this.batchArraySize = batchArraySize;
+ this.batchArrayIndex = batchArrayIndex;
+ this.format = format;
+ }
+
+ public Path getTileset() {
+ return tileset;
+ }
+
+ public void setTileset(Path tileset) {
+ this.tileset = tileset;
+ }
+
+ public Path getRepository() {
+ return repository;
+ }
+
+ public void setRepository(Path repository) {
+ this.repository = repository;
+ }
+
+ public Integer getBatchArraySize() {
+ return batchArraySize;
+ }
+
+ public void setBatchArraySize(Integer batchArraySize) {
+ this.batchArraySize = batchArraySize;
+ }
+
+ public Integer getBatchArrayIndex() {
+ return batchArrayIndex;
+ }
+
+ public void setBatchArrayIndex(Integer batchArrayIndex) {
+ this.batchArrayIndex = batchArrayIndex;
+ }
+
+ public Format getFormat() {
+ return format;
+ }
+
+ public void setFormat(Format format) {
+ this.format = format;
+ }
@Override
public void execute(WorkflowContext context) throws Exception {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
index 8422d8fc..495d15c3 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
@@ -28,8 +28,12 @@ import org.apache.baremaps.openstreetmap.postgres.PostgresRelationRepository;
import org.apache.baremaps.openstreetmap.postgres.PostgresWayRepository;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public record ImportDaylightFeatures(Path file, Object database) implements Task {
+public class ImportDaylightFeatures implements Task {
+
+ private static final Logger logger = LoggerFactory.getLogger(ImportDaylightFeatures.class);
record Feature(
@JsonProperty("osm_type") String type,
@@ -39,6 +43,35 @@ public record ImportDaylightFeatures(Path file, Object database) implements Task
@JsonProperty("category") String category) {
}
+ private Path file;
+
+ private Object database;
+
+ public ImportDaylightFeatures() {
+
+ }
+
+ public ImportDaylightFeatures(Path file, Object database) {
+ this.file = file;
+ this.database = database;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public Object getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(Object database) {
+ this.database = database;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var datasource = context.getDataSource(database);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
index c5e9d86a..63b4a013 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
@@ -26,8 +26,12 @@ import org.apache.baremaps.openstreetmap.postgres.PostgresRelationRepository;
import org.apache.baremaps.openstreetmap.postgres.PostgresWayRepository;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public record ImportDaylightTranslations(Path file, Object database) implements Task {
+public class ImportDaylightTranslations implements Task {
+
+ private static final Logger logger = LoggerFactory.getLogger(ImportDaylightTranslations.class);
record Group(String type, Long id, String name) {
@@ -50,6 +54,36 @@ public record ImportDaylightTranslations(Path file, Object database) implements
}
}
+
+ private Path file;
+
+ private Object database;
+
+ public ImportDaylightTranslations() {
+
+ }
+
+ public ImportDaylightTranslations(Path file, Object database) {
+ this.file = file;
+ this.database = database;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public Object getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(Object database) {
+ this.database = database;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var datasource = context.getDataSource(database);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
index a8a6b52c..47713383 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
@@ -29,12 +29,58 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record ImportGeoPackage(Path file, Object database, Integer sourceSRID, Integer targetSRID)
- implements
- Task {
+public class ImportGeoPackage implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportGeoPackage.class);
+ private Path file;
+ private Object database;
+ private Integer sourceSRID;
+ private Integer targetSRID;
+
+ public ImportGeoPackage() {
+
+ }
+
+ public ImportGeoPackage(Path file, Object database, Integer sourceSRID, Integer targetSRID) {
+ this.file = file;
+ this.database = database;
+ this.sourceSRID = sourceSRID;
+ this.targetSRID = targetSRID;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public Object getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(Object database) {
+ this.database = database;
+ }
+
+ public Integer getSourceSRID() {
+ return sourceSRID;
+ }
+
+ public void setSourceSRID(Integer sourceSRID) {
+ this.sourceSRID = sourceSRID;
+ }
+
+ public Integer getTargetSRID() {
+ return targetSRID;
+ }
+
+ public void setTargetSRID(Integer targetSRID) {
+ this.targetSRID = targetSRID;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var path = file.toAbsolutePath();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
index b16fff32..69baa168 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
@@ -41,15 +41,69 @@ import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record ImportOsmOsc(
- Path file,
- Path cache,
- Object database,
- Integer srid,
- Compression compression) implements Task {
+public class ImportOsmOsc implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportOsmOsc.class);
+ private Path file;
+ private Path cache;
+ private Object database;
+ private Integer srid;
+ private Compression compression;
+
+ public ImportOsmOsc() {
+
+ }
+
+ public ImportOsmOsc(Path file, Path cache, Object database, Integer srid,
+ Compression compression) {
+ this.file = file;
+ this.cache = cache;
+ this.database = database;
+ this.srid = srid;
+ this.compression = compression;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public Path getCache() {
+ return cache;
+ }
+
+ public void setCache(Path cache) {
+ this.cache = cache;
+ }
+
+ public Object getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(Object database) {
+ this.database = database;
+ }
+
+ public Integer getSrid() {
+ return srid;
+ }
+
+ public void setSrid(Integer srid) {
+ this.srid = srid;
+ }
+
+ public Compression getCompression() {
+ return compression;
+ }
+
+ public void setCompression(Compression compression) {
+ this.compression = compression;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var datasource = context.getDataSource(database);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
index 499d244f..4cf69326 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
@@ -46,16 +46,79 @@ import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record ImportOsmPbf(
- Path file,
- Path cache,
- Boolean cleanCache,
- Object database,
- Integer databaseSrid,
- Boolean replaceExisting) implements Task {
+public class ImportOsmPbf implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportOsmPbf.class);
+ private Path file;
+ private Path cache;
+ private Boolean cleanCache;
+ private Object database;
+ private Integer databaseSrid;
+ private Boolean replaceExisting;
+
+ public ImportOsmPbf() {
+
+ }
+
+ public ImportOsmPbf(Path file, Path cache, Boolean cleanCache, Object database,
+ Integer databaseSrid, Boolean replaceExisting) {
+ this.file = file;
+ this.cache = cache;
+ this.cleanCache = cleanCache;
+ this.database = database;
+ this.databaseSrid = databaseSrid;
+ this.replaceExisting = replaceExisting;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public Path getCache() {
+ return cache;
+ }
+
+ public void setCache(Path cache) {
+ this.cache = cache;
+ }
+
+ public Boolean getCleanCache() {
+ return cleanCache;
+ }
+
+ public void setCleanCache(Boolean cleanCache) {
+ this.cleanCache = cleanCache;
+ }
+
+ public Object getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(Object database) {
+ this.database = database;
+ }
+
+ public Integer getDatabaseSrid() {
+ return databaseSrid;
+ }
+
+ public void setDatabaseSrid(Integer databaseSrid) {
+ this.databaseSrid = databaseSrid;
+ }
+
+ public Boolean getReplaceExisting() {
+ return replaceExisting;
+ }
+
+ public void setReplaceExisting(Boolean replaceExisting) {
+ this.replaceExisting = replaceExisting;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var dataSource = context.getDataSource(database);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
index b37f56b7..693f9c4c 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
@@ -29,12 +29,58 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record ImportShapefile(Path file, Object database, Integer sourceSRID, Integer targetSRID)
- implements
- Task {
+public class ImportShapefile implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportShapefile.class);
+ private Path file;
+ private Object database;
+ private Integer sourceSRID;
+ private Integer targetSRID;
+
+ public ImportShapefile() {
+
+ }
+
+ public ImportShapefile(Path file, Object database, Integer sourceSRID, Integer targetSRID) {
+ this.file = file;
+ this.database = database;
+ this.sourceSRID = sourceSRID;
+ this.targetSRID = targetSRID;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public Object getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(Object database) {
+ this.database = database;
+ }
+
+ public Integer getSourceSRID() {
+ return sourceSRID;
+ }
+
+ public void setSourceSRID(Integer sourceSRID) {
+ this.sourceSRID = sourceSRID;
+ }
+
+ public Integer getTargetSRID() {
+ return targetSRID;
+ }
+
+ public void setTargetSRID(Integer targetSRID) {
+ this.targetSRID = targetSRID;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var path = file.toAbsolutePath();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
index a3f6b852..d548dbcd 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
@@ -22,10 +22,28 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record LogMessage(String message) implements Task {
+public class LogMessage implements Task {
private static final Logger logger = LoggerFactory.getLogger(LogMessage.class);
+ private String message;
+
+ public LogMessage() {
+
+ }
+
+ public LogMessage(String message) {
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
logger.info(message);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
index d55d7662..40935dcf 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
@@ -28,10 +28,38 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record UngzipFile(Path file, Path directory) implements Task {
+public class UngzipFile implements Task {
private static final Logger logger = LoggerFactory.getLogger(UngzipFile.class);
+ private Path file;
+ private Path directory;
+
+ public UngzipFile() {
+
+ }
+
+ public UngzipFile(Path file, Path directory) {
+ this.file = file;
+ this.directory = directory;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public Path getDirectory() {
+ return directory;
+ }
+
+ public void setDirectory(Path directory) {
+ this.directory = directory;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var filePath = file.toAbsolutePath();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
index dc89d9c5..4e45aafe 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
@@ -22,8 +22,40 @@ import java.nio.file.*;
import java.util.zip.ZipFile;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public record UnzipFile(Path file, Path directory) implements Task {
+public class UnzipFile implements Task {
+
+ private static final Logger logger = LoggerFactory.getLogger(UnzipFile.class);
+
+ private Path file;
+ private Path directory;
+
+ public UnzipFile() {
+
+ }
+
+ public UnzipFile(Path file, Path directory) {
+ this.file = file;
+ this.directory = directory;
+ }
+
+ public Path getFile() {
+ return file;
+ }
+
+ public void setFile(Path file) {
+ this.file = file;
+ }
+
+ public Path getDirectory() {
+ return directory;
+ }
+
+ public void setDirectory(Path directory) {
+ this.directory = directory;
+ }
@Override
public void execute(WorkflowContext context) throws Exception {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
index 1a2005d2..43b15614 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
@@ -46,15 +46,49 @@ import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public record UpdateOsmDatabase(Object database, Integer databaseSrid,
- String replicationUrl) implements Task {
+public class UpdateOsmDatabase implements Task {
private static final Logger logger = LoggerFactory.getLogger(UpdateOsmDatabase.class);
+ private Object database;
+
+ private Integer databaseSrid;
+
+ private String replicationUrl;
+
+ public UpdateOsmDatabase() {
+
+ }
+
public UpdateOsmDatabase(Object database, Integer databaseSrid) {
- this(database, databaseSrid, null);
+ this.database = database;
+ this.databaseSrid = databaseSrid;
+ }
+
+ public Object getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(Object database) {
+ this.database = database;
+ }
+
+ public Integer getDatabaseSrid() {
+ return databaseSrid;
+ }
+
+ public void setDatabaseSrid(Integer databaseSrid) {
+ this.databaseSrid = databaseSrid;
}
+ public String getReplicationUrl() {
+ return replicationUrl;
+ }
+
+ public void setReplicationUrl(String replicationUrl) {
+ this.replicationUrl = replicationUrl;
+ }
+
@Override
public void execute(WorkflowContext context) throws Exception {
var datasource = context.getDataSource(database);
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java
index 4fb5b32d..d52a27b6 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java
@@ -43,7 +43,7 @@ class WorkflowTest extends PostgresContainerTest {
new ImportGeoPackage(Paths.get("natural_earth_vector/packages/natural_earth_vector.gpkg"),
jdbcUrl(),
4326, 3857)))));
- new WorkflowExecutor(workflow).execute().join();
+ new WorkflowExecutor(workflow).execute();
}
@Test
@@ -58,7 +58,7 @@ class WorkflowTest extends PostgresContainerTest {
new ImportShapefile(Paths.get("coastlines-split-4326/coastlines-split-4326/lines.shp"),
jdbcUrl(),
4326, 3857)))));
- new WorkflowExecutor(workflow).execute().join();
+ new WorkflowExecutor(workflow).execute();
}
@Test
@@ -76,7 +76,7 @@ class WorkflowTest extends PostgresContainerTest {
"simplified-water-polygons-split-3857/simplified-water-polygons-split-3857/simplified_water_polygons.shp"),
"jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps", 3857,
3857)))));
- new WorkflowExecutor(workflow).execute().join();
+ new WorkflowExecutor(workflow).execute();
}
@Test
@@ -86,7 +86,7 @@ class WorkflowTest extends PostgresContainerTest {
new DownloadUrl("https://naciscdn.org/naturalearth/packages/natural_earth_vector.gpkg.zip",
Paths.get("downloads/import_db.gpkg")),
new ImportShapefile(Paths.get("downloads/import_db.gpkg"), jdbcUrl(), 4326, 3857)))));
- new WorkflowExecutor(workflow).execute().join();
+ new WorkflowExecutor(workflow).execute();
}
@Test
@@ -122,6 +122,6 @@ class WorkflowTest extends PostgresContainerTest {
Paths.get(
"archives/simplified-water-polygons-split-3857/simplified_water_polygons.shp"),
jdbcUrl(), 3857, 3857)))));
- new WorkflowExecutor(workflow).execute().join();
+ new WorkflowExecutor(workflow).execute();
}
}
(incubator-baremaps) 07/07: Remove unused methods
Posted by bc...@apache.org.
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 e8198440a8153ca546e4d64485973ee72ea1578b
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Fri Nov 17 14:06:23 2023 +0100
Remove unused methods
---
.../apache/baremaps/cli/database/UpdateOsm.java | 6 +-
.../tasks/CreateGeocoderOpenStreetMap.java | 18 ----
.../workflow/tasks/CreateGeonamesIndex.java | 20 ----
.../baremaps/workflow/tasks/CreateIplocIndex.java | 26 -----
.../baremaps/workflow/tasks/DecompressFile.java | 59 -----------
.../baremaps/workflow/tasks/DownloadUrl.java | 29 ------
.../baremaps/workflow/tasks/ExecuteCommand.java | 23 -----
.../apache/baremaps/workflow/tasks/ExecuteSql.java | 61 -----------
.../baremaps/workflow/tasks/ExecuteSqlScript.java | 43 --------
.../baremaps/workflow/tasks/ExportVectorTiles.java | 44 --------
.../workflow/tasks/ImportDaylightFeatures.java | 43 --------
.../workflow/tasks/ImportDaylightTranslations.java | 43 --------
.../baremaps/workflow/tasks/ImportGeoPackage.java | 79 --------------
.../baremaps/workflow/tasks/ImportOsmOsc.java | 97 -----------------
.../baremaps/workflow/tasks/ImportOsmPbf.java | 115 ---------------------
.../baremaps/workflow/tasks/ImportShapefile.java | 79 --------------
.../apache/baremaps/workflow/tasks/LogMessage.java | 25 -----
.../apache/baremaps/workflow/tasks/UngzipFile.java | 43 --------
.../apache/baremaps/workflow/tasks/UnzipFile.java | 43 --------
.../baremaps/workflow/tasks/UpdateOsmDatabase.java | 52 +---------
20 files changed, 6 insertions(+), 942 deletions(-)
diff --git a/baremaps-cli/src/main/java/org/apache/baremaps/cli/database/UpdateOsm.java b/baremaps-cli/src/main/java/org/apache/baremaps/cli/database/UpdateOsm.java
index 886fd0a6..832a6f72 100644
--- a/baremaps-cli/src/main/java/org/apache/baremaps/cli/database/UpdateOsm.java
+++ b/baremaps-cli/src/main/java/org/apache/baremaps/cli/database/UpdateOsm.java
@@ -41,9 +41,13 @@ public class UpdateOsm implements Callable<Integer> {
description = "The projection used by the database.")
private int srid = 3857;
+ @Option(names = {"--replication-url"}, paramLabel = "REPLICATION_URL",
+ description = "The replication url of the OpenStreetMap server.")
+ private String replicationUrl = "https://planet.osm.org/replication/hour";
+
@Override
public Integer call() throws Exception {
- new UpdateOsmDatabase(database, srid)
+ new UpdateOsmDatabase(database, srid, replicationUrl)
.execute(new WorkflowContext());
return 0;
}
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java
index 81691994..c45cc086 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java
@@ -61,29 +61,11 @@ public class CreateGeocoderOpenStreetMap implements Task {
private Path indexDirectory;
- public CreateGeocoderOpenStreetMap() {}
-
public CreateGeocoderOpenStreetMap(Path file, Path indexDirectory) {
this.file = file;
this.indexDirectory = indexDirectory;
}
- public Path getFile() {
- return file;
- }
-
- public void setFile(Path file) {
- this.file = file;
- }
-
- public Path getIndexDirectory() {
- return indexDirectory;
- }
-
- public void setIndexDirectory(Path indexDirectory) {
- this.indexDirectory = indexDirectory;
- }
-
@Override
public void execute(WorkflowContext context) throws Exception {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java
index 884c39ab..49fc25cc 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java
@@ -45,31 +45,11 @@ public class CreateGeonamesIndex implements Task {
private Path indexDirectory;
- public CreateGeonamesIndex() {
-
- }
-
public CreateGeonamesIndex(Path dataFile, Path indexDirectory) {
this.dataFile = dataFile;
this.indexDirectory = indexDirectory;
}
- public Path getDataFile() {
- return dataFile;
- }
-
- public void setDataFile(Path dataFile) {
- this.dataFile = dataFile;
- }
-
- public Path getIndexDirectory() {
- return indexDirectory;
- }
-
- public void setIndexDirectory(Path indexDirectory) {
- this.indexDirectory = indexDirectory;
- }
-
@Override
public void execute(WorkflowContext context) throws Exception {
var directory = MMapDirectory.open(indexDirectory);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java
index a3da337a..01cedbfb 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java
@@ -46,38 +46,12 @@ public class CreateIplocIndex implements Task {
private List<Path> nicPaths;
private Path targetIplocIndexPath;
- public CreateIplocIndex() {}
-
public CreateIplocIndex(Path geonamesIndexPath, List<Path> nicPaths, Path targetIplocIndexPath) {
this.geonamesIndexPath = geonamesIndexPath;
this.nicPaths = nicPaths;
this.targetIplocIndexPath = targetIplocIndexPath;
}
- public Path getGeonamesIndexPath() {
- return geonamesIndexPath;
- }
-
- public void setGeonamesIndexPath(Path geonamesIndexPath) {
- this.geonamesIndexPath = geonamesIndexPath;
- }
-
- public List<Path> getNicPaths() {
- return nicPaths;
- }
-
- public void setNicPaths(List<Path> nicPaths) {
- this.nicPaths = nicPaths;
- }
-
- public Path getTargetIplocIndexPath() {
- return targetIplocIndexPath;
- }
-
- public void setTargetIplocIndexPath(Path targetIplocIndexPath) {
- this.targetIplocIndexPath = targetIplocIndexPath;
- }
-
@Override
public void execute(WorkflowContext context) throws Exception {
try (var directory = MMapDirectory.open(geonamesIndexPath);
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 37b0ac0e..272ad1a3 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
@@ -57,11 +57,6 @@ public class DecompressFile implements Task {
private Path target;
private Compression compression;
- /**
- * Constructs a {@code DecompressFile}.
- */
- public DecompressFile() {}
-
/**
* Constructs a {@code DecompressFile}.
*
@@ -75,60 +70,6 @@ public class DecompressFile implements Task {
this.compression = compression;
}
- /**
- * Returns the source file.
- *
- * @return the source file
- */
- public Path getSource() {
- return source;
- }
-
- /**
- * Sets the source file.
- *
- * @param source the source file
- */
- public void setSource(Path source) {
- this.source = source;
- }
-
- /**
- * Returns the target file.
- *
- * @return the target file
- */
- public Path getTarget() {
- return target;
- }
-
- /**
- * Sets the target file.
- *
- * @param target the target file
- */
- public void setTarget(Path target) {
- this.target = target;
- }
-
- /**
- * Returns the compression format.
- *
- * @return the compression format
- */
- public Compression getCompression() {
- return compression;
- }
-
- /**
- * Sets the compression format.
- *
- * @param compression the compression format
- */
- public void setCompression(Compression compression) {
- this.compression = compression;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
index 767de347..d25167d2 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
@@ -50,11 +50,6 @@ public class DownloadUrl implements Task {
private Boolean replaceExisting;
- /**
- * Constructs an {@code DownloadUrl}.
- */
- public DownloadUrl() {}
-
/**
* Constructs an {@code DownloadUrl}.
*
@@ -68,30 +63,6 @@ public class DownloadUrl implements Task {
this.replaceExisting = replaceExisting;
}
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public Path getPath() {
- return path;
- }
-
- public void setPath(Path path) {
- this.path = path;
- }
-
- public Boolean getReplaceExisting() {
- return replaceExisting;
- }
-
- public void setReplaceExisting(Boolean replaceExisting) {
- this.replaceExisting = replaceExisting;
- }
-
@Override
public void execute(WorkflowContext context) throws Exception {
var targetUrl = new URL(url);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
index 6d273a09..a19b23d6 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
@@ -33,11 +33,6 @@ public class ExecuteCommand implements Task {
private String command;
- /**
- * Constructs an {@code ExecuteCommand}.
- */
- public ExecuteCommand() {}
-
/**
* Constructs an {@code ExecuteCommand}.
*
@@ -47,24 +42,6 @@ public class ExecuteCommand implements Task {
this.command = command;
}
- /**
- * Returns the bash command.
- *
- * @return the bash command
- */
- public String getCommand() {
- return command;
- }
-
- /**
- * Sets the bash command.
- *
- * @param command the bash command
- */
- public void setCommand(String command) {
- this.command = command;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
index 96bb151e..7cd78544 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
@@ -44,13 +44,6 @@ public class ExecuteSql implements Task {
private Boolean parallel;
- /**
- * Constructs an {@code ExecuteSql}.
- */
- public ExecuteSql() {
-
- }
-
/**
* Constructs an {@code ExecuteSql}.
*
@@ -64,60 +57,6 @@ public class ExecuteSql implements Task {
this.parallel = parallel;
}
- /**
- * Returns the database.
- *
- * @return the database
- */
- public Object getDatabase() {
- return database;
- }
-
- /**
- * Sets the database.
- *
- * @param database the database
- */
- public void setDatabase(Object database) {
- this.database = database;
- }
-
- /**
- * Returns the SQL file.
- *
- * @return the SQL file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the SQL file.
- *
- * @param file the SQL file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
- /**
- * Returns whether to execute the queries in parallel.
- *
- * @return whether to execute the queries in parallel
- */
- public boolean isParallel() {
- return parallel;
- }
-
- /**
- * Sets whether to execute the queries in parallel.
- *
- * @param parallel whether to execute the queries in parallel
- */
- public void setParallel(boolean parallel) {
- this.parallel = parallel;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
index af8dff0d..efd3b3c2 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
@@ -39,13 +39,6 @@ public class ExecuteSqlScript implements Task {
private Path file;
- /**
- * Constructs an {@code ExecuteSqlScript}.
- */
- public ExecuteSqlScript() {
-
- }
-
/**
* Constructs an {@code ExecuteSqlScript}.
*
@@ -57,42 +50,6 @@ public class ExecuteSqlScript implements Task {
this.file = file;
}
- /**
- * Returns the database.
- *
- * @return the database
- */
- public Object getDatabase() {
- return database;
- }
-
- /**
- * Sets the database.
- *
- * @param database the database
- */
- public void setDatabase(Object database) {
- this.database = database;
- }
-
- /**
- * Returns the SQL file.
- *
- * @return the SQL file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the SQL file.
- *
- * @param file the SQL file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
index 7e54476a..d9bd63ae 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
@@ -61,10 +61,6 @@ public class ExportVectorTiles implements Task {
private Integer batchArrayIndex;
private Format format;
- public ExportVectorTiles() {
-
- }
-
public ExportVectorTiles(Path tileset, Path repository, Integer batchArraySize,
Integer batchArrayIndex, Format format) {
this.tileset = tileset;
@@ -74,46 +70,6 @@ public class ExportVectorTiles implements Task {
this.format = format;
}
- public Path getTileset() {
- return tileset;
- }
-
- public void setTileset(Path tileset) {
- this.tileset = tileset;
- }
-
- public Path getRepository() {
- return repository;
- }
-
- public void setRepository(Path repository) {
- this.repository = repository;
- }
-
- public Integer getBatchArraySize() {
- return batchArraySize;
- }
-
- public void setBatchArraySize(Integer batchArraySize) {
- this.batchArraySize = batchArraySize;
- }
-
- public Integer getBatchArrayIndex() {
- return batchArrayIndex;
- }
-
- public void setBatchArrayIndex(Integer batchArrayIndex) {
- this.batchArrayIndex = batchArrayIndex;
- }
-
- public Format getFormat() {
- return format;
- }
-
- public void setFormat(Format format) {
- this.format = format;
- }
-
@Override
public void execute(WorkflowContext context) throws Exception {
var configReader = new ConfigReader();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
index d116e339..af05f9f7 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
@@ -52,13 +52,6 @@ public class ImportDaylightFeatures implements Task {
private Object database;
- /**
- * Constructs an {@code ImportDaylightFeatures}.
- */
- public ImportDaylightFeatures() {
-
- }
-
/**
* Constructs an {@code ImportDaylightFeatures}.
*
@@ -70,42 +63,6 @@ public class ImportDaylightFeatures implements Task {
this.database = database;
}
- /**
- * Returns the daylight file.
- *
- * @return the daylight file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the daylight file.
- *
- * @param file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
- /**
- * Returns the database.
- *
- * @return
- */
- public Object getDatabase() {
- return database;
- }
-
- /**
- * Sets the database.
- *
- * @param database
- */
- public void setDatabase(Object database) {
- this.database = database;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
index 93ef1b09..f747f31f 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
@@ -64,13 +64,6 @@ public class ImportDaylightTranslations implements Task {
private Object database;
- /**
- * Constructs an {@code ImportDaylightTranslations}.
- */
- public ImportDaylightTranslations() {
-
- }
-
/**
* Constructs an {@code ImportDaylightTranslations}.
*
@@ -82,42 +75,6 @@ public class ImportDaylightTranslations implements Task {
this.database = database;
}
- /**
- * Returns the daylight file.
- *
- * @return the daylight file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the daylight file.
- *
- * @param file the daylight file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
- /**
- * Returns the database.
- *
- * @return the database
- */
- public Object getDatabase() {
- return database;
- }
-
- /**
- * Sets the database.
- *
- * @param database the database
- */
- public void setDatabase(Object database) {
- this.database = database;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
index c2e73f5a..9bfab836 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
@@ -43,13 +43,6 @@ public class ImportGeoPackage implements Task {
private Integer sourceSRID;
private Integer targetSRID;
- /**
- * Constructs an {@code ImportGeoPackage}.
- */
- public ImportGeoPackage() {
-
- }
-
/**
* Constructs an {@code ImportGeoPackage}.
*
@@ -65,78 +58,6 @@ public class ImportGeoPackage implements Task {
this.targetSRID = targetSRID;
}
- /**
- * Returns the GeoPackage file.
- *
- * @return the GeoPackage file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the GeoPackage file.
- *
- * @param file the GeoPackage file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
- /**
- * Returns the database.
- *
- * @return the database
- */
- public Object getDatabase() {
- return database;
- }
-
- /**
- * Sets the database.
- *
- * @param database the database
- */
- public void setDatabase(Object database) {
- this.database = database;
- }
-
- /**
- * Returns the source SRID.
- *
- * @return the source SRID
- */
- public Integer getSourceSRID() {
- return sourceSRID;
- }
-
- /**
- * Sets the source SRID.
- *
- * @param sourceSRID the source SRID
- */
- public void setSourceSRID(Integer sourceSRID) {
- this.sourceSRID = sourceSRID;
- }
-
- /**
- * Returns the target SRID.
- *
- * @return the target SRID
- */
- public Integer getTargetSRID() {
- return targetSRID;
- }
-
- /**
- * Sets the target SRID.
- *
- * @param targetSRID the target SRID
- */
- public void setTargetSRID(Integer targetSRID) {
- this.targetSRID = targetSRID;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
index 045ce4c2..b6a731d1 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
@@ -56,13 +56,6 @@ public class ImportOsmOsc implements Task {
private Integer srid;
private Compression compression;
- /**
- * Constructs an {@code ImportOsmOsc}.
- */
- public ImportOsmOsc() {
-
- }
-
/**
* Constructs an {@code ImportOsmOsc}.
*
@@ -81,96 +74,6 @@ public class ImportOsmOsc implements Task {
this.compression = compression;
}
- /**
- * Returns the OSM OSC file.
- *
- * @return the OSM OSC file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the OSM OSC file.
- *
- * @param file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
- /**
- * Returns the cache directory.
- *
- * @return the cache directory
- */
- public Path getCache() {
- return cache;
- }
-
- /**
- * Sets the cache directory.
- *
- * @param cache the cache directory
- */
- public void setCache(Path cache) {
- this.cache = cache;
- }
-
- /**
- * Returns the database.
- *
- * @return the database
- */
- public Object getDatabase() {
- return database;
- }
-
- /**
- * Sets the database.
- *
- * @param database the database
- */
- public void setDatabase(Object database) {
- this.database = database;
- }
-
- /**
- * Returns the database SRID.
- *
- * @return the database SRID
- */
- public Integer getSrid() {
- return srid;
- }
-
- /**
- * Sets the database SRID.
- *
- * @param srid the database SRID
- */
- public void setSrid(Integer srid) {
- this.srid = srid;
- }
-
- /**
- * Returns the compression.
- *
- * @return the compression
- */
- public Compression getCompression() {
- return compression;
- }
-
- /**
- * Sets the compression.
- *
- * @param compression the compression
- */
- public void setCompression(Compression compression) {
- this.compression = compression;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
index d996037c..34364056 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
@@ -62,13 +62,6 @@ public class ImportOsmPbf implements Task {
private Integer databaseSrid;
private Boolean replaceExisting;
- /**
- * Constructs an {@code ImportOsmPbf}.
- */
- public ImportOsmPbf() {
-
- }
-
/**
* Constructs an {@code ImportOsmPbf}.
*
@@ -89,114 +82,6 @@ public class ImportOsmPbf implements Task {
this.replaceExisting = replaceExisting;
}
- /**
- * Returns the OSM PBF file.
- *
- * @return the OSM PBF file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the OSM PBF file.
- *
- * @param file the OSM PBF file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
- /**
- * Returns the cache directory.
- *
- * @return the cache directory
- */
- public Path getCache() {
- return cache;
- }
-
- /**
- * Sets the cache directory.
- *
- * @param cache the cache directory
- */
- public void setCache(Path cache) {
- this.cache = cache;
- }
-
- /**
- * Returns whether to clean the cache directory.
- *
- * @return whether to clean the cache directory
- */
- public Boolean getCleanCache() {
- return cleanCache;
- }
-
- /**
- * Sets whether to clean the cache directory.
- *
- * @param cleanCache whether to clean the cache directory
- */
- public void setCleanCache(Boolean cleanCache) {
- this.cleanCache = cleanCache;
- }
-
- /**
- * Returns the database.
- *
- * @return the database
- */
- public Object getDatabase() {
- return database;
- }
-
- /**
- * Sets the database.
- *
- * @param database the database
- */
- public void setDatabase(Object database) {
- this.database = database;
- }
-
- /**
- * Returns the database SRID.
- *
- * @return the database SRID
- */
- public Integer getDatabaseSrid() {
- return databaseSrid;
- }
-
- /**
- * Sets the database SRID.
- *
- * @param databaseSrid the database SRID
- */
- public void setDatabaseSrid(Integer databaseSrid) {
- this.databaseSrid = databaseSrid;
- }
-
- /**
- * Returns whether to replace the existing tables.
- *
- * @return whether to replace the existing tables
- */
- public Boolean getReplaceExisting() {
- return replaceExisting;
- }
-
- /**
- * Sets whether to replace the existing tables.
- *
- * @param replaceExisting whether to replace the existing tables
- */
- public void setReplaceExisting(Boolean replaceExisting) {
- this.replaceExisting = replaceExisting;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
index d67cad51..864fd220 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
@@ -43,13 +43,6 @@ public class ImportShapefile implements Task {
private Integer sourceSRID;
private Integer targetSRID;
- /**
- * Constructs an {@code ImportShapefile}.
- */
- public ImportShapefile() {
-
- }
-
/**
* Constructs an {@code ImportShapefile}.
*
@@ -65,78 +58,6 @@ public class ImportShapefile implements Task {
this.targetSRID = targetSRID;
}
- /**
- * Returns the shapefile file.
- *
- * @return the shapefile file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the shapefile file.
- *
- * @param file the shapefile file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
- /**
- * Returns the database.
- *
- * @return the database
- */
- public Object getDatabase() {
- return database;
- }
-
- /**
- * Sets the database.
- *
- * @param database the database
- */
- public void setDatabase(Object database) {
- this.database = database;
- }
-
- /**
- * Returns the source SRID.
- *
- * @return the source SRID
- */
- public Integer getSourceSRID() {
- return sourceSRID;
- }
-
- /**
- * Sets the source SRID.
- *
- * @param sourceSRID the source SRID
- */
- public void setSourceSRID(Integer sourceSRID) {
- this.sourceSRID = sourceSRID;
- }
-
- /**
- * Returns the target SRID.
- *
- * @return the target SRID
- */
- public Integer getTargetSRID() {
- return targetSRID;
- }
-
- /**
- * Sets the target SRID.
- *
- * @param targetSRID the target SRID
- */
- public void setTargetSRID(Integer targetSRID) {
- this.targetSRID = targetSRID;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
index 2261d3f6..e0de8e00 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
@@ -33,13 +33,6 @@ public class LogMessage implements Task {
private String message;
- /**
- * Constructs an {@code LogMessage}.
- */
- public LogMessage() {
-
- }
-
/**
* Constructs an {@code LogMessage}.
*
@@ -49,24 +42,6 @@ public class LogMessage implements Task {
this.message = message;
}
- /**
- * Returns the message.
- *
- * @return the message
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Sets the message.
- *
- * @param message the message
- */
- public void setMessage(String message) {
- this.message = message;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
index c34bcb1d..79c89a81 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
@@ -40,13 +40,6 @@ public class UngzipFile implements Task {
private Path file;
private Path directory;
- /**
- * Constructs an {@code UngzipFile}.
- */
- public UngzipFile() {
-
- }
-
/**
* Constructs an {@code UngzipFile}.
*
@@ -58,42 +51,6 @@ public class UngzipFile implements Task {
this.directory = directory;
}
- /**
- * Returns the file.
- *
- * @return the file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the file.
- *
- * @param file the file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
- /**
- * Returns the directory.
- *
- * @return the directory
- */
- public Path getDirectory() {
- return directory;
- }
-
- /**
- * Sets the directory.
- *
- * @param directory the directory
- */
- public void setDirectory(Path directory) {
- this.directory = directory;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
index 02185a90..0804168b 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
@@ -37,13 +37,6 @@ public class UnzipFile implements Task {
private Path file;
private Path directory;
- /**
- * Constructs an {@code UnzipFile}.
- */
- public UnzipFile() {
-
- }
-
/**
* Constructs an {@code UnzipFile}.
*
@@ -55,42 +48,6 @@ public class UnzipFile implements Task {
this.directory = directory;
}
- /**
- * Returns the file.
- *
- * @return the file
- */
- public Path getFile() {
- return file;
- }
-
- /**
- * Sets the file.
- *
- * @param file the file
- */
- public void setFile(Path file) {
- this.file = file;
- }
-
- /**
- * Returns the directory.
- *
- * @return the directory
- */
- public Path getDirectory() {
- return directory;
- }
-
- /**
- * Sets the directory.
- *
- * @param directory the directory
- */
- public void setDirectory(Path directory) {
- this.directory = directory;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
index d374be1a..a2aa11bd 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
@@ -61,65 +61,15 @@ public class UpdateOsmDatabase implements Task {
private String replicationUrl;
- /**
- * Constructs an {@code UpdateOsmDatabase}.
- */
- public UpdateOsmDatabase() {
-
- }
-
/**
* Constructs an {@code UpdateOsmDatabase}.
*
* @param database the database
* @param databaseSrid the database SRID
*/
- public UpdateOsmDatabase(Object database, Integer databaseSrid) {
- this.database = database;
- this.databaseSrid = databaseSrid;
- }
-
- /**
- * Returns the database.
- *
- * @return the database
- */
- public Object getDatabase() {
- return database;
- }
-
- /**
- * Sets the database.
- *
- * @param database the database
- */
- public void setDatabase(Object database) {
+ public UpdateOsmDatabase(Object database, Integer databaseSrid, String replicationUrl) {
this.database = database;
- }
-
- /**
- * Returns the database SRID.
- *
- * @return the database SRID
- */
- public Integer getDatabaseSrid() {
- return databaseSrid;
- }
-
- /**
- * Sets the database SRID.
- *
- * @param databaseSrid the database SRID
- */
- public void setDatabaseSrid(Integer databaseSrid) {
this.databaseSrid = databaseSrid;
- }
-
- public String getReplicationUrl() {
- return replicationUrl;
- }
-
- public void setReplicationUrl(String replicationUrl) {
this.replicationUrl = replicationUrl;
}
(incubator-baremaps) 04/07: Remove unused method
Posted by bc...@apache.org.
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 501fa5229de2b55c2c44fb999d648df5eeaeba87
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Thu Nov 16 22:25:18 2023 +0100
Remove unused method
---
.../baremaps/workflow/tasks/UpdateOsmDatabase.java | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
index 9dce1563..b6513d04 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
@@ -209,21 +209,4 @@ public class UpdateOsmDatabase implements Task {
header.getReplicationUrl(), header.getSource(), header.getWritingProgram()));
}
}
-
- /**
- * Returns the URL of the file with the given sequence number.
- *
- * @param replicationUrl the replication URL
- * @param sequenceNumber the sequence number
- * @param extension the file extension
- * @return the URL of the file
- * @throws MalformedURLException if the URL is malformed
- */
- public static URL resolve(String replicationUrl, Long sequenceNumber, String extension)
- throws MalformedURLException {
- var s = String.format("%09d", sequenceNumber);
- var uri = String.format("%s/%s/%s/%s.%s", replicationUrl, s.substring(0, 3), s.substring(3, 6),
- s.substring(6, 9), extension);
- return URI.create(uri).toURL();
- }
}
(incubator-baremaps) 06/07: Add dependency to hk2
Posted by bc...@apache.org.
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 8ad99cf2702984c7df4bfe2da021a456d18c316d
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Thu Nov 16 23:36:42 2023 +0100
Add dependency to hk2
---
baremaps-core/pom.xml | 8 ++++++++
pom.xml | 11 +++++++++++
2 files changed, 19 insertions(+)
diff --git a/baremaps-core/pom.xml b/baremaps-core/pom.xml
index 2b40f130..bd424dc0 100644
--- a/baremaps-core/pom.xml
+++ b/baremaps-core/pom.xml
@@ -102,6 +102,14 @@ limitations under the License.
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial-extras</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.glassfish.hk2</groupId>
+ <artifactId>hk2-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.hk2</groupId>
+ <artifactId>hk2-locator</artifactId>
+ </dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
diff --git a/pom.xml b/pom.xml
index 7bb72aff..54a75195 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,6 +91,7 @@ limitations under the License.
<version.lib.graalvm>23.0.2</version.lib.graalvm>
<version.lib.guava>32.1.3-jre</version.lib.guava>
<version.lib.hikari>5.0.1</version.lib.hikari>
+ <version.lib.hk2>2.6.1</version.lib.hk2>
<version.lib.ipresource>1.52</version.lib.ipresource>
<version.lib.jackson>2.13.0</version.lib.jackson>
<version.lib.jakarta>2.1.6</version.lib.jakarta>
@@ -342,6 +343,16 @@ limitations under the License.
<version>${version.lib.awaitability}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.glassfish.hk2</groupId>
+ <artifactId>hk2-api</artifactId>
+ <version>${version.lib.hk2}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.hk2</groupId>
+ <artifactId>hk2-locator</artifactId>
+ <version>${version.lib.hk2}</version>
+ </dependency>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
(incubator-baremaps) 02/07: Move the type name in the sub classes
Posted by bc...@apache.org.
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 378b12f3fa77e70bf342cc66e690257d6b725f82
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Mon Nov 13 14:57:42 2023 +0100
Move the type name in the sub classes
---
.../java/org/apache/baremaps/workflow/Task.java | 22 ----------------------
.../tasks/CreateGeocoderOpenStreetMap.java | 2 ++
.../workflow/tasks/CreateGeonamesIndex.java | 2 ++
.../baremaps/workflow/tasks/CreateIplocIndex.java | 2 ++
.../baremaps/workflow/tasks/DecompressBZip2.java | 2 ++
.../baremaps/workflow/tasks/DecompressFile.java | 2 ++
.../baremaps/workflow/tasks/DownloadUrl.java | 2 ++
.../baremaps/workflow/tasks/ExecuteCommand.java | 2 ++
.../apache/baremaps/workflow/tasks/ExecuteSql.java | 2 ++
.../baremaps/workflow/tasks/ExecuteSqlScript.java | 2 ++
.../baremaps/workflow/tasks/ExportVectorTiles.java | 2 ++
.../workflow/tasks/ImportDaylightFeatures.java | 2 ++
.../workflow/tasks/ImportDaylightTranslations.java | 2 ++
.../baremaps/workflow/tasks/ImportGeoPackage.java | 2 ++
.../baremaps/workflow/tasks/ImportOsmOsc.java | 2 ++
.../baremaps/workflow/tasks/ImportOsmPbf.java | 2 ++
.../baremaps/workflow/tasks/ImportShapefile.java | 2 ++
.../apache/baremaps/workflow/tasks/LogMessage.java | 2 ++
.../apache/baremaps/workflow/tasks/UngzipFile.java | 2 ++
.../apache/baremaps/workflow/tasks/UnzipFile.java | 2 ++
.../baremaps/workflow/tasks/UpdateOsmDatabase.java | 2 ++
21 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/Task.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/Task.java
index 06fdad9e..68e36443 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/Task.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/Task.java
@@ -20,7 +20,6 @@ package org.apache.baremaps.workflow;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -32,27 +31,6 @@ import org.apache.baremaps.workflow.tasks.*;
@JsonSerialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
@JsonTypeInfo(use = Id.NAME, property = "type")
-@JsonSubTypes({@JsonSubTypes.Type(value = DownloadUrl.class, name = "DownloadUrl"),
- @JsonSubTypes.Type(value = ExecuteCommand.class, name = "ExecuteCommand"),
- @JsonSubTypes.Type(value = ExecuteSql.class, name = "ExecuteSql"),
- @JsonSubTypes.Type(value = ExecuteSqlScript.class, name = "ExecuteSqlScript"),
- @JsonSubTypes.Type(value = ExportVectorTiles.class, name = "ExportVectorTiles"),
- @JsonSubTypes.Type(value = ImportGeoPackage.class, name = "ImportGeoPackage"),
- @JsonSubTypes.Type(value = ImportOsmPbf.class, name = "ImportOsmPbf"),
- @JsonSubTypes.Type(value = ImportOsmOsc.class, name = "ImportOsmOsc"),
- @JsonSubTypes.Type(value = ImportShapefile.class, name = "ImportShapefile"),
- @JsonSubTypes.Type(value = LogMessage.class, name = "LogMessage"),
- @JsonSubTypes.Type(value = UnzipFile.class, name = "UnzipFile"),
- @JsonSubTypes.Type(value = UngzipFile.class, name = "UngzipFile"),
- @JsonSubTypes.Type(value = DecompressBZip2.class, name = "DecompressBZip2"),
- @JsonSubTypes.Type(value = DecompressFile.class, name = "DecompressFile"),
- @JsonSubTypes.Type(value = UpdateOsmDatabase.class, name = "UpdateOsmDatabase"),
- @JsonSubTypes.Type(value = CreateGeonamesIndex.class, name = "CreateGeonamesIndex"),
- @JsonSubTypes.Type(value = CreateIplocIndex.class, name = "CreateIplocIndex"),
- @JsonSubTypes.Type(value = ImportDaylightTranslations.class,
- name = "ImportDaylightTranslations"),
- @JsonSubTypes.Type(value = ImportDaylightFeatures.class, name = "ImportDaylightFeatures")
-})
public interface Task {
/**
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java
index 41f72d65..81691994 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeocoderOpenStreetMap.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -51,6 +52,7 @@ import org.slf4j.LoggerFactory;
*
* @see org.apache.baremaps.geocoderosm
*/
+@JsonTypeName("CreateGeocoderOpenStreetMap")
public class CreateGeocoderOpenStreetMap implements Task {
private static final Logger logger = LoggerFactory.getLogger(CreateGeocoderOpenStreetMap.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java
index 3c4d974d..884c39ab 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateGeonamesIndex.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -35,6 +36,7 @@ import org.slf4j.LoggerFactory;
/**
* A task that creates a geonames index.
*/
+@JsonTypeName("CreateGeonamesIndex")
public class CreateGeonamesIndex implements Task {
private static final Logger logger = LoggerFactory.getLogger(CreateGeonamesIndex.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java
index 9ae4fe6f..a3da337a 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/CreateIplocIndex.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -36,6 +37,7 @@ import org.slf4j.LoggerFactory;
import org.sqlite.SQLiteConfig;
import org.sqlite.SQLiteDataSource;
+@JsonTypeName("CreateIplocIndex")
public class CreateIplocIndex implements Task {
private static final Logger logger = LoggerFactory.getLogger(CreateIplocIndex.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java
index 9217f077..ef17fe00 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DecompressBZip2.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.BufferedInputStream;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -28,6 +29,7 @@ import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("DecompressBZip2")
public class DecompressBZip2 implements Task {
private static final Logger logger = LoggerFactory.getLogger(DecompressBZip2.class);
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 2551389a..4d991077 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
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -32,6 +33,7 @@ import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("DecompressFile")
public class DecompressFile implements Task {
private static final Logger logger = LoggerFactory.getLogger(DecompressFile.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
index 1955fbfb..3b7bd5b6 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/DownloadUrl.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -29,6 +30,7 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("DownloadUrl")
public class DownloadUrl implements Task {
private static final Logger logger = LoggerFactory.getLogger(DownloadUrl.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
index 4c21502c..6ccd6ddb 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteCommand.java
@@ -17,11 +17,13 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ExecuteCommand")
public class ExecuteCommand implements Task {
private static final Logger logger = LoggerFactory.getLogger(ExecuteCommand.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
index 12c35844..f405250c 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSql.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.SQLException;
@@ -29,6 +30,7 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ExecuteSql")
public class ExecuteSql implements Task {
private static final Logger logger = LoggerFactory.getLogger(ExecuteSql.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
index 432d9ef9..e8b95e82 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExecuteSqlScript.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.SQLException;
@@ -26,6 +27,7 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ExecuteSqlScript")
public class ExecuteSqlScript implements Task {
private static final Logger logger = LoggerFactory.getLogger(ExecuteSqlScript.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
index 8437acbf..cf6c7202 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
@@ -19,6 +19,7 @@ package org.apache.baremaps.workflow.tasks;
import static org.apache.baremaps.utils.ObjectMapperUtils.objectMapper;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -43,6 +44,7 @@ import org.locationtech.jts.geom.Envelope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ExportVectorTiles")
public class ExportVectorTiles implements Task {
private static final Logger logger = LoggerFactory.getLogger(ExportVectorTiles.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
index 495d15c3..ba00a255 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java
@@ -18,6 +18,7 @@
package org.apache.baremaps.workflow.tasks;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.nio.file.Path;
import java.util.HashMap;
@@ -31,6 +32,7 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ImportDaylightFeatures")
public class ImportDaylightFeatures implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportDaylightFeatures.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
index 63b4a013..dc6dc619 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
@@ -29,6 +30,7 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ImportDaylightTranslations")
public class ImportDaylightTranslations implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportDaylightTranslations.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
index 47713383..882f8548 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportGeoPackage.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.nio.file.Path;
import org.apache.baremaps.database.schema.DataTableAdapter;
import org.apache.baremaps.database.schema.DataTableGeometryTransformer;
@@ -29,6 +30,7 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ImportGeoPackage")
public class ImportGeoPackage implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportGeoPackage.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
index 69baa168..da65e523 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmOsc.java
@@ -19,6 +19,7 @@ package org.apache.baremaps.workflow.tasks;
import static org.apache.baremaps.stream.ConsumerUtils.consumeThenReturn;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.BufferedInputStream;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -41,6 +42,7 @@ import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ImportOsmOsc")
public class ImportOsmOsc implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportOsmOsc.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
index 4cf69326..8a14d78c 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -46,6 +47,7 @@ import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ImportOsmPbf")
public class ImportOsmPbf implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportOsmPbf.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
index 693f9c4c..5a68ce03 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportShapefile.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.nio.file.Path;
import org.apache.baremaps.database.schema.DataTableAdapter;
import org.apache.baremaps.database.schema.DataTableGeometryTransformer;
@@ -29,6 +30,7 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("ImportShapefile")
public class ImportShapefile implements Task {
private static final Logger logger = LoggerFactory.getLogger(ImportShapefile.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
index d548dbcd..f57387bd 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/LogMessage.java
@@ -17,11 +17,13 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("LogMessage")
public class LogMessage implements Task {
private static final Logger logger = LoggerFactory.getLogger(LogMessage.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
index 40935dcf..cd9d3f8c 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UngzipFile.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.BufferedInputStream;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -28,6 +29,7 @@ import org.apache.baremaps.workflow.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("UngzipFile")
public class UngzipFile implements Task {
private static final Logger logger = LoggerFactory.getLogger(UngzipFile.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
index 4e45aafe..4c95f599 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UnzipFile.java
@@ -17,6 +17,7 @@
package org.apache.baremaps.workflow.tasks;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.*;
import java.nio.file.*;
import java.util.zip.ZipFile;
@@ -25,6 +26,7 @@ import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("UnzipFile")
public class UnzipFile implements Task {
private static final Logger logger = LoggerFactory.getLogger(UnzipFile.class);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
index 43b15614..b11e8449 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOsmDatabase.java
@@ -19,6 +19,7 @@ package org.apache.baremaps.workflow.tasks;
import static org.apache.baremaps.stream.ConsumerUtils.consumeThenReturn;
+import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.BufferedInputStream;
import java.util.List;
import java.util.zip.GZIPInputStream;
@@ -46,6 +47,7 @@ import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@JsonTypeName("UpdateOsmDatabase")
public class UpdateOsmDatabase implements Task {
private static final Logger logger = LoggerFactory.getLogger(UpdateOsmDatabase.class);