From 6b4a60d30d717ec4aecc91ff06c6cbaad6fee256 Mon Sep 17 00:00:00 2001 From: Anis Koubaa <mohamed.koubaa@kit.edu> Date: Thu, 27 Mar 2025 16:02:08 +0100 Subject: [PATCH] Add Source interface, actual and manager. --- README.md | 23 ++++++++++++++--- services/metify/.gitignore | 1 + .../product/source/DataSourceController.java | 25 +++++++++++++++++++ .../java/iai/product/source/MetaSource.java | 6 +++++ .../iai/product/source/MetaSourceManager.java | 21 ++++++++++++++++ .../java/iai/product/source/RDFSource.java | 14 +++++++++++ 6 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 services/metify/src/main/java/iai/product/source/DataSourceController.java create mode 100644 services/metify/src/main/java/iai/product/source/MetaSource.java create mode 100644 services/metify/src/main/java/iai/product/source/MetaSourceManager.java create mode 100644 services/metify/src/main/java/iai/product/source/RDFSource.java diff --git a/README.md b/README.md index 966c5dc..210e7f7 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,26 @@ ## Use Cases -### Use Case #1 (Main use case) +### Use Case #UC1 (Main use case) A user plugs in the EDR at a certain location, connects it with its laptop and starts the recording of a campaign. At the same time the user starts the publishing tool REGIMO (from this git repository). -All new created files are tracked by the tool and automatically uploaded to the cloud and then published to the databus using its cloud URL. +All new created files are tracked by the tool and automatically uploaded to the cloud and then published to the databus +using its cloud URL. -### Use Case #2 (Secondary use case) -The existing database of the EDR is analyzed and all existing valid data sets (correct filesystem structure and metadata json files exist) get published to the cloud and registered in the databus. +### Use Case #UC2 (Secondary use case) +The existing database of the EDR is analyzed and all existing valid data sets (correct filesystem structure and metadata +json files exist) get published to the cloud and registered in the databus. +### Use Case #UC_US01_01 (Display already defined Metadata Sources) +The menu Configure/Data Sources displays the existent already configured Data Sources and a button to add a new one. + + +## User Stories + +### User Story #01 +As an admin I want to add a metadata source. + +### User Story #02 +As an admin I want to configure a metadata source. +Properties of a metadata source are the ip, the adapter and the sink. +The front end should display the already configured metadata sources. diff --git a/services/metify/.gitignore b/services/metify/.gitignore index 549e00a..e52a6f3 100644 --- a/services/metify/.gitignore +++ b/services/metify/.gitignore @@ -18,6 +18,7 @@ target/ *.iws *.iml *.ipr +.DS_Store ### NetBeans ### /nbproject/private/ diff --git a/services/metify/src/main/java/iai/product/source/DataSourceController.java b/services/metify/src/main/java/iai/product/source/DataSourceController.java new file mode 100644 index 0000000..1a77701 --- /dev/null +++ b/services/metify/src/main/java/iai/product/source/DataSourceController.java @@ -0,0 +1,25 @@ +package iai.product.source; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/api") +public class DataSourceController { + + private final MetaSourceManager dataSourceManager; + + @Autowired + public DataSourceController(MetaSourceManager dataSourceManager) { + this.dataSourceManager = dataSourceManager; + } + + @GetMapping("/metaSources") + public List<MetaSource> getDataSources() { + return dataSourceManager.getDataSources(); + } +} diff --git a/services/metify/src/main/java/iai/product/source/MetaSource.java b/services/metify/src/main/java/iai/product/source/MetaSource.java new file mode 100644 index 0000000..dca631d --- /dev/null +++ b/services/metify/src/main/java/iai/product/source/MetaSource.java @@ -0,0 +1,6 @@ +package iai.product.source; + +public interface MetaSource { + String name = null; + String getName(); +} diff --git a/services/metify/src/main/java/iai/product/source/MetaSourceManager.java b/services/metify/src/main/java/iai/product/source/MetaSourceManager.java new file mode 100644 index 0000000..0299f30 --- /dev/null +++ b/services/metify/src/main/java/iai/product/source/MetaSourceManager.java @@ -0,0 +1,21 @@ +package iai.product.source; + +import java.util.ArrayList; +import java.util.List; + +public class MetaSourceManager { + private final List<MetaSource> dataSources; + + public MetaSourceManager() { + this.dataSources = new ArrayList<>(); + } + + public void addDataSource(MetaSource dataSource) { + dataSources.add(dataSource); + } + + public List<MetaSource> getDataSources() { + return dataSources; + } + +} diff --git a/services/metify/src/main/java/iai/product/source/RDFSource.java b/services/metify/src/main/java/iai/product/source/RDFSource.java new file mode 100644 index 0000000..0c9bcfa --- /dev/null +++ b/services/metify/src/main/java/iai/product/source/RDFSource.java @@ -0,0 +1,14 @@ +package iai.product.source; + +public class RDFSource implements MetaSource{ + String name; + public RDFSource(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } + +} -- GitLab