From c7f808476621c8c2d0ee88c8abb3fde100c2cfa5 Mon Sep 17 00:00:00 2001 From: ebocher Date: Wed, 25 Sep 2024 15:55:40 +0200 Subject: [PATCH] Fix module info --- pom.xml | 3 +- src/main/java/module-info.java | 11 ++++ .../java/org/orbisgis/demat/FileUtils.java | 51 ++++++------------- 3 files changed, 29 insertions(+), 36 deletions(-) create mode 100644 src/main/java/module-info.java diff --git a/pom.xml b/pom.xml index 08b191d..6b18816 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.orbisgis demat 1.0.1-SNAPSHOT - pom + bundle Demat is breton word to said "Hello". Demat is library to run Vega-lite specifications. @@ -76,6 +76,7 @@ org.apache.groovy groovy ${groovy-version} + test org.junit.jupiter diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..bbb80ba --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,11 @@ +module demat { + requires com.kitfox.svg; + requires data.api; + requires h2gis.utilities; + requires org.locationtech.jts; + requires com.fasterxml.jackson.databind; + requires java.sql; + requires com.caoccao.javet; + requires java.desktop; + requires com.j2html; +} \ No newline at end of file diff --git a/src/main/java/org/orbisgis/demat/FileUtils.java b/src/main/java/org/orbisgis/demat/FileUtils.java index ffc7473..1947a8e 100755 --- a/src/main/java/org/orbisgis/demat/FileUtils.java +++ b/src/main/java/org/orbisgis/demat/FileUtils.java @@ -68,8 +68,8 @@ public class FileUtils { /** * Deploy the vega js files into a script folder - * @param scriptDir - * @throws IOException + * @param scriptDir directory to store the js scripts + * @throws IOException an exception if the js files cannot be deployed */ public static void deployJSFiles(File scriptDir) throws IOException { File jsFolder = new File(scriptDir, JS_FOLDER); @@ -119,9 +119,9 @@ public static void copyStream(InputStream inputStream, OutputStream outputStream /** * Check if the file has the good extension - * @param file - * @param prefixes - * @return + * @param file input file + * @param prefixes file extension + * @return true is the extension is supported */ public static boolean isExtensionWellFormated(File file, String... prefixes) { if(file==null){ @@ -144,26 +144,11 @@ public static boolean isExtensionWellFormated(File file, String... prefixes) { return false; } - /** - * - * @param reader - * @return - * @throws IOException - */ - public static Object json(InputStream reader) { - ObjectMapper mapper = new ObjectMapper(); - try { - return mapper.readValue(reader, Object.class); - } catch (IOException e) { - throw new RuntimeException(e); - } - } /** - * - * @param jsonFile - * @return - * @throws IOException + * Read a json file + * @param jsonFile input json file + * @return a map with all json values */ public static Object json(File jsonFile) throws IOException { if(FileUtils.isExtensionWellFormated(jsonFile, "json", "geojson")) { @@ -174,10 +159,9 @@ public static Object json(File jsonFile) throws IOException { } /** - * - * @param jsonFile - * @return - * @throws IOException + * Read a geojson file + * @param jsonFile input geojson file + * @return a map with all json values */ public static Object geojson(File jsonFile) throws IOException { if(FileUtils.isExtensionWellFormated(jsonFile, "json", "geojson")) { @@ -190,9 +174,8 @@ public static Object geojson(File jsonFile) throws IOException { /** * Read a CSV {@link File} and convert it to a Data object - * @param csvFile - * @return - * @throws IOException + * @param csvFile input csv file + * @return csv data as list */ public static List csv(File csvFile) throws IOException { if(FileUtils.isExtensionWellFormated(csvFile, "csv")) { @@ -226,9 +209,8 @@ public static List csv(File csvFile) throws IOException { } /** * Read a CSV {@link File} and convert it to a Data object - * @param tsvFile - * @return - * @throws IOException + * @param tsvFile input tsv file + * @return tsv data as list */ public static List tsv(File tsvFile) throws IOException { if(FileUtils.isExtensionWellFormated(tsvFile, "tsv")) { @@ -262,8 +244,7 @@ public static List tsv(File tsvFile) throws IOException { * Method to open a browser * Used by ImageJ * - * @param url - * @throws Exception + * @param url to open the browser */ public static void openBrowser(String url) throws Exception { if (url == null || url.isEmpty()) {