Skip to content

Commit

Permalink
Merge pull request #28 from ebocher/use_bundle
Browse files Browse the repository at this point in the history
Fix module info
  • Loading branch information
ebocher authored Sep 25, 2024
2 parents e648a57 + c7f8084 commit 6a67f08
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 36 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.orbisgis</groupId>
<artifactId>demat</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<packaging>bundle</packaging>
<description>Demat is breton word to said "Hello". Demat is library to run Vega-lite specifications.</description>
<!-- Properties -->
<properties>
Expand Down Expand Up @@ -76,6 +76,7 @@
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -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;
}
51 changes: 16 additions & 35 deletions src/main/java/org/orbisgis/demat/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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){
Expand All @@ -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")) {
Expand All @@ -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")) {
Expand All @@ -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")) {
Expand Down Expand Up @@ -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")) {
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit 6a67f08

Please sign in to comment.