Skip to content

Commit

Permalink
Merge branch 'restAPI-v2' of https://github.com/Cambio-Project/resili…
Browse files Browse the repository at this point in the history
…ence-simulator into restAPI-v2
  • Loading branch information
ArefMT committed Mar 18, 2024
2 parents ad4e6ee + 7c59ff8 commit f7ab95c
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 68 deletions.
129 changes: 65 additions & 64 deletions restAPI/pom.xml
Original file line number Diff line number Diff line change
@@ -1,75 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>restAPI</groupId>
<artifactId>restAPI</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>restAPI</name>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>cambio.simulator</groupId>
<artifactId>misim</artifactId>
<version>3.4.0</version>
</dependency>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>restAPI</groupId>
<artifactId>restAPI</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>restAPI</name>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<!-- Take care of the order of dependencies. Tablesaw must come first -->
<dependency>
<groupId>tech.tablesaw</groupId>
<artifactId>tablesaw-core</artifactId>
<version>0.43.1</version>
</dependency>

<dependency>
<groupId>tech.tablesaw</groupId>
<artifactId>tablesaw-core</artifactId>
<version>0.43.1</version>
</dependency>
<dependency>
<groupId>cambio.simulator</groupId>
<artifactId>misim</artifactId>
<version>3.4.0</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.1</version>
</dependency>

<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.9</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.9</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
9 changes: 5 additions & 4 deletions src/main/java/cambio/simulator/misc/FileUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ public static void copyFolderFromResources(String folderName, File destFolder, C
boolean ignored = destFolder.mkdirs();
}

File fullPath = null;
File fullPath;
String path = FileUtilities.class.getProtectionDomain().getCodeSource().getLocation().getPath();
path = path.split("!")[0]; // handle case of misim jar inside of another jar

try {
if (!path.startsWith("file")) {
Expand Down Expand Up @@ -102,7 +103,7 @@ public static void copyFolderFromResources(String folderName, File destFolder, C
}

private static void copyFromJar(String folderName, File destFolder, CopyOption option, File fullPath)
throws IOException {
throws IOException {

byte[] buffer = new byte[8096];

Expand Down Expand Up @@ -139,8 +140,8 @@ private static void copyFromJar(String folderName, File destFolder, CopyOption o
}

private static void copyFromDirectory(String folderName, File destFolder, CopyOption option, File fullPath)
throws IOException {
Files.walkFileTree(Paths.get(fullPath.getPath(), folderName), new SimpleFileVisitor<Path>() {
throws IOException {
Files.walkFileTree(Paths.get(fullPath.getPath(), folderName), new SimpleFileVisitor<>() {
@Override
public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {
String sourceFullPath = path.toAbsolutePath().toString();
Expand Down

0 comments on commit f7ab95c

Please sign in to comment.