diff --git a/.gitignore b/.gitignore
index 0364181..627b66f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
postgres/docker-compose.yml
target/
+lib/
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index bdf7d03..1fb3a06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,12 +1,13 @@
-
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.2.1
-
+
ru.redrise
marinesco
@@ -59,7 +60,8 @@
-
+
org.thymeleaf.extras
thymeleaf-extras-springsecurity6
@@ -71,6 +73,13 @@
h2
runtime
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
@@ -90,4 +99,4 @@
-
+
\ No newline at end of file
diff --git a/src/main/java/ru/redrise/marinesco/library/InpxScanner.java b/src/main/java/ru/redrise/marinesco/library/InpxScanner.java
new file mode 100644
index 0000000..46587f2
--- /dev/null
+++ b/src/main/java/ru/redrise/marinesco/library/InpxScanner.java
@@ -0,0 +1,35 @@
+package ru.redrise.marinesco.library;
+
+import java.util.stream.Stream;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@Component
+@ConfigurationProperties(prefix = "marinesco.library")
+public class InpxScanner {
+
+ private String filesLocation = "";
+
+ private FileSystemResource inpxFile;
+
+ public void reScan() {
+ inpxFile = new FileSystemResource(filesLocation);
+
+ //todo
+ Stream.of(inpxFile.getFile().listFiles())
+ .forEach(file -> log.info(file.toString()));
+ }
+
+ public String getFilesLocation(){
+ return filesLocation;
+ }
+
+ public void setFilesLocation(String location){
+ filesLocation = location;
+ }
+}
diff --git a/src/main/java/ru/redrise/marinesco/settings/SettingsController.java b/src/main/java/ru/redrise/marinesco/settings/SettingsController.java
index 7049255..cacc1c8 100644
--- a/src/main/java/ru/redrise/marinesco/settings/SettingsController.java
+++ b/src/main/java/ru/redrise/marinesco/settings/SettingsController.java
@@ -7,6 +7,8 @@ import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
+import ru.redrise.marinesco.library.InpxScanner;
+
//@Slf4j
@Controller
@RequestMapping("/settings")
@@ -15,9 +17,12 @@ public class SettingsController {
private KeyValueRepository keyValueRepository;
private ApplicationSettings applicationSettings;
- public SettingsController(KeyValueRepository keyValueRepository, ApplicationSettings applicationSettings){
+ private InpxScanner inpxScanner;
+
+ public SettingsController(KeyValueRepository keyValueRepository, ApplicationSettings applicationSettings, InpxScanner inpxScanner){
this.keyValueRepository = keyValueRepository;
this.applicationSettings = applicationSettings;
+ this.inpxScanner = inpxScanner;
}
@GetMapping
@@ -39,4 +44,11 @@ public class SettingsController {
return "redirect:/settings";
}
+
+ @GetMapping("/rescan")
+ public String rescan(){
+ inpxScanner.reScan();
+
+ return "redirect:/settings";
+ }
}
diff --git a/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000..304a859
--- /dev/null
+++ b/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,9 @@
+{
+ "properties": [
+ {
+ "name": "marinesco.library.filesLocation",
+ "type": "java.lang.String",
+ "description": "All library files location"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 15da86f..4e53fab 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -21,3 +21,6 @@ spring:
settings:
web-allow-others: true
trace: false
+marinesco:
+ library:
+ filesLocation: "./lib"
\ No newline at end of file
diff --git a/src/main/resources/templates/settings.html b/src/main/resources/templates/settings.html
index 2b3ee11..e581f47 100644
--- a/src/main/resources/templates/settings.html
+++ b/src/main/resources/templates/settings.html
@@ -4,7 +4,7 @@
Marinesco - Application settings
-
+
@@ -12,8 +12,13 @@