package org.simantics.district.maps.server;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.HashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
+import org.zeroturnaround.exec.InvalidExitValueException;
import org.zeroturnaround.exec.ProcessExecutor;
import org.zeroturnaround.exec.StartedProcess;
import org.zeroturnaround.exec.stream.slf4j.Slf4jDebugOutputStream;
public class TileserverMapnik {
private static final Logger LOGGER = LoggerFactory.getLogger(TileserverMapnik.class);
- private static final String[] ADDITIONAL_DEPENDENCIES = new String[] { "tilelive-vector@3.9.4", "tilelive-tmstyle@0.6.0" };
private SystemProcess process;
private Path serverRoot;
if (Files.exists(getPid())) {
String pid = new String(Files.readAllBytes(getPid()));
PidProcess pr = Processes.newPidProcess(Integer.parseInt(pid));
- pr.destroyForcefully();
+ try {
+ pr.destroyForcefully();
+ } catch (InvalidExitValueException e) {
+ // ignore,
+ } catch (Exception e) {
+ LOGGER.error("Could not destroy process with pid {}", pid, e);
+ }
}
// check that npm dependencies are satisfied
// }
- private Path tileserverMapnikRoot() {
+ @SuppressWarnings("unused")
+ private Path tileserverMapnikRoot() {
return serverRoot.resolve("tileserver-mapnik").toAbsolutePath();
}
return serverRoot.resolve("dist/share/icu").toAbsolutePath();
}
- private Path getTessera() {
+ @SuppressWarnings("unused")
+ private Path getTessera() {
return serverRoot.resolve("tileserver-mapnik/bin/tessera.js").toAbsolutePath();
}
return getDataDirectory().resolve(MapsServerPreferences.currentMBTiles());
}
+ @SuppressWarnings("unchecked")
public void checkTm2Styles() {
Path tm2 = getStyleDirectory();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(tm2)) {