From 919e13ab193b46a7ee365798e076f76423ed7a72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Apr 2022 12:00:07 +0000 Subject: [PATCH 01/24] Bump cxf.version from 3.5.1 to 3.5.2 Bumps `cxf.version` from 3.5.1 to 3.5.2. Updates `cxf-rt-frontend-jaxws` from 3.5.1 to 3.5.2 Updates `cxf-rt-transports-http-jetty` from 3.5.1 to 3.5.2 Updates `cxf-rt-transports-http-hc` from 3.5.1 to 3.5.2 --- updated-dependencies: - dependency-name: org.apache.cxf:cxf-rt-frontend-jaxws dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.apache.cxf:cxf-rt-transports-http-jetty dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.apache.cxf:cxf-rt-transports-http-hc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- context-core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context-core/pom.xml b/context-core/pom.xml index 844438a0..2128fcf8 100644 --- a/context-core/pom.xml +++ b/context-core/pom.xml @@ -16,7 +16,7 @@ ATB Context Extraction Core Lib - 3.5.1 + 3.5.2 4.4.0 From bbbf7fee5d15fc4b3fc4bd244d6a8d6a63cf4995 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Apr 2022 08:20:26 +0000 Subject: [PATCH 02/24] Bump lombok from 1.18.22 to 1.18.24 Bumps [lombok](https://github.com/projectlombok/lombok) from 1.18.22 to 1.18.24. - [Release notes](https://github.com/projectlombok/lombok/releases) - [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown) - [Commits](https://github.com/projectlombok/lombok/compare/v1.18.22...v1.18.24) --- updated-dependencies: - dependency-name: org.projectlombok:lombok dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- context-core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context-core/pom.xml b/context-core/pom.xml index 2128fcf8..1d0b60eb 100644 --- a/context-core/pom.xml +++ b/context-core/pom.xml @@ -107,7 +107,7 @@ org.projectlombok lombok - 1.18.22 + 1.18.24 From 394f54ee360c62e28fdcd87fe727da2d77ba16a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Apr 2022 11:35:55 +0000 Subject: [PATCH 03/24] Bump rabbitmq from 1.16.3 to 1.17.1 Bumps [rabbitmq](https://github.com/testcontainers/testcontainers-java) from 1.16.3 to 1.17.1. - [Release notes](https://github.com/testcontainers/testcontainers-java/releases) - [Changelog](https://github.com/testcontainers/testcontainers-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.16.3...1.17.1) --- updated-dependencies: - dependency-name: org.testcontainers:rabbitmq dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ec2ce6f..573be976 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ UTF-8 3.5.4 11 - 1.16.3 + 1.17.1 From 6d51f4f6ffbb00d098f7e485dab12d980fe860ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Apr 2022 08:21:30 +0000 Subject: [PATCH 04/24] Bump github/codeql-action from 1 to 2 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v1...v2) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 373d6af7..c5e5ba80 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -43,7 +43,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -54,7 +54,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -68,4 +68,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 From 873e9a786048062c22617b841469019efa524d99 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 08:21:03 +0000 Subject: [PATCH 05/24] Bump jena.version from 4.4.0 to 4.5.0 Bumps `jena.version` from 4.4.0 to 4.5.0. Updates `jena-arq` from 4.4.0 to 4.5.0 Updates `jena-tdb` from 4.4.0 to 4.5.0 --- updated-dependencies: - dependency-name: org.apache.jena:jena-arq dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.apache.jena:jena-tdb dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- context-core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context-core/pom.xml b/context-core/pom.xml index 1d0b60eb..6f13e6e4 100644 --- a/context-core/pom.xml +++ b/context-core/pom.xml @@ -17,7 +17,7 @@ 3.5.2 - 4.4.0 + 4.5.0 From f8dd5d9a97a709d05929b8c570f97c15a4bc6de3 Mon Sep 17 00:00:00 2001 From: scholze Date: Wed, 24 Nov 2021 13:46:05 +0100 Subject: [PATCH 06/24] start populating Readme --- README.md | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) diff --git a/README.md b/README.md index 9bf587b7..4854d97f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,228 @@ # smartclide-context SmartCLIDE Context Handling Component + +## Preconditions to build and run Context Handling + +To build and run Context Handling, the following software is required:# + +- Java (at least version ...) +- ... + +## How to build Context Handling + +1. ... TO DO + +## How to configure Context Handling + +### Monitoring Config + +In the following the xml schema for the monitoring configuration is listed. Below the xsd the configuration elements are described in detail. + +**monitoring-config.xsd** + +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +**monitoring-config.xml** +``` + + + + + + + + + + + + + + + + + + + + + +``` + +The "monitoring-config.xml" configuration file can also be changed by using the Admin UI. + + +### Description + +#### indexes + +Each index entry has the following mandatory attributes + +- id: The unique name of the index +- location: The URI of the location the index is stored + +#### datasources + +Each datasource entry has the following mandatory attributes + +- id:The unique name of the datasource +- type:The type of the datasource. Possible values are: file, webservice, database +- monitor:The class of the monitor to be used. Possible values are: + - package de.atb.context.monitoring.monitors.database.DatabaseMonitor + - package de.atb.context.monitoring.monitors.file.FileSystemMonitor + - package de.atb.context.monitoring.monitors.file.FilePairSystemMonitor + - package de.atb.context.monitoring.monitors.file.FileTripletSystemMonitor + - package de.atb.context.monitoring.monitors.webservice.WebServiceMonitor +- options: Options for the datasource can be entered using this value. The options are dependant on the datasource to be used +- uri:The uri of the data source to be monitored +- class:The following datasource implementations are available + - package de.atb.context.monitoring.config.models.datasources.DatabaseDataSource + - package de.atb.context.monitoring.config.models.datasources.FilePairSystemDataSource + - package de.atb.context.monitoring.config.models.datasources.FileSystemDataSource + - package de.atb.context.monitoring.config.models.datasources.FileTripletSystemDataSource + - package de.atb.context.monitoring.config.models.datasources.WebServiceDataSource + +#### interpreters + +Each interpreter entry has the following mandatory attributes + +- id: The unique name of the interpreter +- configuration + - analyser: The analyser class to be used. The following implementations are available: + - package de.atb.context.monitoring.analyser.database.DatabaseAnalyser + - package de.atb.context.monitoring.analyser.file.FileAnalyser + - package de.atb.context.monitoring.analyser.file.FilePairAnalyser + - package de.atb.context.monitoring.analyser.file.FileTripletAnalyser + - package de.atb.context.monitoring.analyser.webservice.WebServiceAnalyser + - parser: The parser class to be used. The following implementations are available: + - package de.atb.context.monitoring.parser.database.DatabaseParser + - package de.atb.context.monitoring.parser.file.FileParser + - package de.atb.context.monitoring.parser.file.FilePairParser + - package de.atb.context.monitoring.parser.file.FileTripletParser + - package de.atb.context.monitoring.parser.webservice.WebServiceParser + - type: Currently only used for File analyser and parser. Defines the file extensions to be used. + +#### monitors + +... + +### service configuration + +**services-config.xml** +``` + + + + + localhost + http://localhost:19001 + AmIMonitoringService + de.atb.context.services.AmIMonitoringService + de.atb.context.services.IAmIMonitoringService + + + localhost + http://localhost:19002 + AmIMonitoringDataRepositoryService + de.atb.context.services.AmIMonitoringDataRepositoryService + de.atb.context.services.IAmIMonitoringDataRepositoryService + + + localhost + http://localhost:19004 + PersistenceUnitService + de.atb.context.services.PersistenceUnitService + de.atb.core.services.IPersistenceUnitService + + + +``` + +The "services-config.xml" configuration file can also be changed by using the Admin UI. + + +## How to run Context Handling + +1. ... TO DO describe how the docker containers are started + From bc597458fa5b7b7aefed8e9385fb05d75e8e1a1c Mon Sep 17 00:00:00 2001 From: scholze Date: Wed, 24 Nov 2021 13:57:34 +0100 Subject: [PATCH 07/24] start populating Readme --- README.md | 46 +++++++++++-------- .../resources/config/monitoring-config.xml | 1 - 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 4854d97f..1b875339 100644 --- a/README.md +++ b/README.md @@ -107,26 +107,32 @@ In the following the xml schema for the monitoring configuration is listed. Belo ``` - - - - - - - - - - - - - - - - - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.atb-bremen.de monitoring-config.xsd"> + + + + + + + + + + + + + + + + + + ``` diff --git a/smartclide-monitoring/src/test/resources/config/monitoring-config.xml b/smartclide-monitoring/src/test/resources/config/monitoring-config.xml index 78990e25..ee36fae9 100644 --- a/smartclide-monitoring/src/test/resources/config/monitoring-config.xml +++ b/smartclide-monitoring/src/test/resources/config/monitoring-config.xml @@ -26,5 +26,4 @@ - From ebbbb781f10b86440b1e1401828a5bce3afcbb8d Mon Sep 17 00:00:00 2001 From: scholze Date: Wed, 24 Nov 2021 14:24:34 +0100 Subject: [PATCH 08/24] start populating Readme --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 1b875339..76e7bd7c 100644 --- a/README.md +++ b/README.md @@ -227,8 +227,6 @@ Each interpreter entry has the following mandatory attributes The "services-config.xml" configuration file can also be changed by using the Admin UI. - ## How to run Context Handling 1. ... TO DO describe how the docker containers are started - From 4a51044175559eaa6b6e1263da723405f8bb7c63 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Mon, 11 Apr 2022 15:58:39 +0200 Subject: [PATCH 09/24] prepapre structure --- .../analyser/GitlabCommitAnalyser.java | 67 +++++++++++ .../models/GitlabCommitDataModel.java | 111 ++++++++++++++++++ .../monitors/GitlabCommitMonitor.java | 38 ++++++ .../monitoring/parser/GitlabCommitParser.java | 37 ++++++ 4 files changed, 253 insertions(+) create mode 100644 smartclide-monitoring/src/main/java/de/atb/context/monitoring/analyser/GitlabCommitAnalyser.java create mode 100644 smartclide-monitoring/src/main/java/de/atb/context/monitoring/models/GitlabCommitDataModel.java create mode 100644 smartclide-monitoring/src/main/java/de/atb/context/monitoring/monitors/GitlabCommitMonitor.java create mode 100644 smartclide-monitoring/src/main/java/de/atb/context/monitoring/parser/GitlabCommitParser.java diff --git a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/analyser/GitlabCommitAnalyser.java b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/analyser/GitlabCommitAnalyser.java new file mode 100644 index 00000000..2c83879a --- /dev/null +++ b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/analyser/GitlabCommitAnalyser.java @@ -0,0 +1,67 @@ +package de.atb.context.monitoring.analyser; + +/* + * #%L + * SmartCLIDE Monitoring + * %% + * Copyright (C) 2022 ATB – Institut für angewandte Systemtechnik Bremen GmbH + * %% + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * #L% + */ + +import com.google.gson.Gson; +import de.atb.context.monitoring.analyser.webservice.WebServiceAnalyser; +import de.atb.context.monitoring.config.models.DataSource; +import de.atb.context.monitoring.config.models.InterpreterConfiguration; +import de.atb.context.monitoring.index.Indexer; +import de.atb.context.monitoring.models.GitMessage; +import de.atb.context.monitoring.models.GitlabCommitDataModel; +import de.atb.context.monitoring.models.IWebService; +import de.atb.context.tools.ontology.AmIMonitoringConfiguration; +import org.apache.lucene.document.Document; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.URI; +import java.util.Date; +import java.util.List; + +public class GitlabCommitAnalyser extends WebServiceAnalyser { + + private static final Logger logger = LoggerFactory.getLogger(GitlabCommitAnalyser.class); + + private static final Gson GSON = new Gson(); + + public GitlabCommitAnalyser(final DataSource dataSource, + final InterpreterConfiguration interpreterConfiguration, + final Indexer indexer, + final Document document, + final AmIMonitoringConfiguration amiConfiguration) { + super(dataSource, interpreterConfiguration, indexer, document, amiConfiguration); + } + + @Override + public List analyseObject(IWebService service) { + try { + final GitlabCommitDataModel model = new GitlabCommitDataModel(); + URI gitlabEndpoint = service.getURI(); + + // TODO "NEED TO BE IMPLEMENTED" + // * get list of projects where CH user has access to + // * iterate through projects and get last commits + // * for each identified "new" commit add a GitNessage below + model.addGitMessage(new GitMessage()); + + model.setMonitoredAt(new Date()); + return List.of(model); + } catch (Exception e) { + logger.error("Error analysing service: {}", service); + return List.of(); + } + } +} diff --git a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/models/GitlabCommitDataModel.java b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/models/GitlabCommitDataModel.java new file mode 100644 index 00000000..3fa8ee4a --- /dev/null +++ b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/models/GitlabCommitDataModel.java @@ -0,0 +1,111 @@ +package de.atb.context.monitoring.models; + +/* + * #%L + * SmartCLIDE Monitoring + * %% + * Copyright (C) 2022 ATB – Institut für angewandte Systemtechnik Bremen GmbH + * %% + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * #L% + */ + +import de.atb.context.common.Version; +import de.atb.context.common.util.ApplicationScenario; +import de.atb.context.common.util.BusinessCase; +import de.atb.context.monitoring.config.models.datasources.MessageBrokerDataSource; +import de.atb.context.monitoring.config.models.datasources.WebServiceDataSource; +import de.atb.context.monitoring.rdf.RdfHelper; +import de.atb.context.persistence.ModelOutputLanguage; +import lombok.Getter; +import lombok.Setter; +import org.apache.jena.rdf.model.Model; +import org.simpleframework.xml.Root; +import thewebsemantic.Id; +import thewebsemantic.Namespace; +import thewebsemantic.RdfType; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +@RdfType("GitlabCommitDataModel") +@Namespace(BusinessCase.NS_DUMMY_URL) +@Root +@Getter +@Setter +public class GitlabCommitDataModel implements IMonitoringDataModel { + private Date monitoredAt; + private String documentIndexId = "index/broker"; + private String documentUri; + @Id + private String identifier; + private MessageBrokerDataSource dataSource; + private String implementingClassName = GitlabCommitDataModel.class.getName(); + private String monitoringDataVersion = Version.MONITORING_DATA.getVersionString(); + private List gitMessages = new ArrayList<>(); + + public GitlabCommitDataModel() { + this.identifier = UUID.randomUUID().toString(); + } + + public void addGitMessage(GitMessage gitMessage) { + if (!this.gitMessages.contains(gitMessage)) { + this.gitMessages.add(gitMessage); + } + } + + @Override + public GitlabCommitDataModel fromRdfModel(String rdfModel) { + return RdfHelper.createMonitoringData(rdfModel, GitlabCommitDataModel.class); + } + + @Override + public GitlabCommitDataModel fromRdfModel(Model model) { + return RdfHelper.createMonitoringData(model, GitlabCommitDataModel.class); + } + + @Override + public String toRdfString() { + return ModelOutputLanguage.RDFXML.getModelAsString(this.toRdfModel()); + } + + @Override + public Model toRdfModel() { + return RdfHelper.createRdfModel(this); + } + + @Override + public String getContextIdentifierClassName() { + return null; + } + + @Override + public void setDataSource(WebServiceDataSource dataSource) { + } + + @Override + public BusinessCase getBusinessCase() { + return BusinessCase.getInstance(BusinessCase.NS_DUMMY_ID, BusinessCase.NS_DUMMY_URL); + } + + @Override + public ApplicationScenario getApplicationScenario() { + return ApplicationScenario.getInstance(getBusinessCase()); + } + + @Override + public boolean triggersContextChange() { + return false; + } + + @Override + public void initialize() { + + } +} diff --git a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/monitors/GitlabCommitMonitor.java b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/monitors/GitlabCommitMonitor.java new file mode 100644 index 00000000..a942d728 --- /dev/null +++ b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/monitors/GitlabCommitMonitor.java @@ -0,0 +1,38 @@ +package de.atb.context.monitoring.monitors; + +/* + * #%L + * SmartCLIDE Monitoring + * %% + * Copyright (C) 2022 ATB – Institut für angewandte Systemtechnik Bremen GmbH + * %% + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * #L% + */ + +import de.atb.context.monitoring.config.models.DataSource; +import de.atb.context.monitoring.config.models.Interpreter; +import de.atb.context.monitoring.config.models.Monitor; +import de.atb.context.monitoring.index.Indexer; +import de.atb.context.monitoring.monitors.webservice.WebServiceMonitor; +import de.atb.context.tools.ontology.AmIMonitoringConfiguration; + +import java.io.IOException; +import java.util.concurrent.TimeoutException; + +public class GitlabCommitMonitor extends WebServiceMonitor { + public GitlabCommitMonitor(final DataSource dataSource, + final Interpreter interpreter, + final Monitor monitor, + final Indexer indexer, + final AmIMonitoringConfiguration configuration) throws IOException, TimeoutException { + super(dataSource, interpreter, monitor, indexer, configuration); + + // FIXME: this is a temporary workaround and should be removed! + //addProgressListener(new DleGitMonitorProgressListener((WebServiceDataSource) dataSource)); + } +} diff --git a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/parser/GitlabCommitParser.java b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/parser/GitlabCommitParser.java new file mode 100644 index 00000000..3c350844 --- /dev/null +++ b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/parser/GitlabCommitParser.java @@ -0,0 +1,37 @@ +package de.atb.context.monitoring.parser; + +/* + * #%L + * SmartCLIDE Monitoring + * %% + * Copyright (C) 2021 ATB – Institut für angewandte Systemtechnik Bremen GmbH + * %% + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * #L% + */ + +import de.atb.context.monitoring.config.models.DataSource; +import de.atb.context.monitoring.config.models.InterpreterConfiguration; +import de.atb.context.monitoring.index.Indexer; +import de.atb.context.monitoring.models.IWebService; +import de.atb.context.monitoring.parser.webservice.WebServiceParser; +import de.atb.context.tools.ontology.AmIMonitoringConfiguration; +import org.apache.lucene.document.Document; + +public class GitlabCommitParser extends WebServiceParser { + public GitlabCommitParser(final DataSource dataSource, + final InterpreterConfiguration interpreterConfiguration, + final Indexer indexer, + final AmIMonitoringConfiguration amiConfiguration) { + super(dataSource, interpreterConfiguration, indexer, amiConfiguration); + } + + @Override + protected boolean parseObject(IWebService service, Document document) { + return true; + } +} From b834d1c68d737a30ad39403574e5e403e4976735 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Wed, 4 May 2022 12:11:40 +0200 Subject: [PATCH 10/24] Update README.md --- README.md | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 76e7bd7c..6fe7390f 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,41 @@ SmartCLIDE Context Handling Component To build and run Context Handling, the following software is required:# -- Java (at least version ...) -- ... +- Java (at least version 11) +- Apache Maven (min V3.6) +- Docker [Desktop] (for running Context Handling) ## How to build Context Handling -1. ... TO DO +Context Handling can be built using maven with the following command: + `mvn package` + +In order to build a docker container image that can be deployed to a docker host, the following command can be used: + + `mvn clean ...` + +Note: Currently the configuration files are packed into the container images, which means that on each configuration change a new container has to be created and deployed. + +## How to run Context Handling + +There are two possibilites to execute Context Handling. + +1. Building and runnning the locally built Context Handling can be done using the following command: + ``` + buildAndRunCHLocally.sh + ``` + +2. Executing Context Handling using the Docker container image from the ATB container registry: + ``` + docker run .... + ``` + ## How to configure Context Handling +The KEES configuration files are store in the following folder: +`./resources/` + ### Monitoring Config In the following the xml schema for the monitoring configuration is listed. Below the xsd the configuration elements are described in detail. @@ -226,7 +252,3 @@ Each interpreter entry has the following mandatory attributes ``` The "services-config.xml" configuration file can also be changed by using the Admin UI. - -## How to run Context Handling - -1. ... TO DO describe how the docker containers are started From 969adf01424bf2fc7bf1999cc4c8625882d6d941 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Wed, 4 May 2022 16:00:43 +0200 Subject: [PATCH 11/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6fe7390f..a99f2564 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ There are two possibilites to execute Context Handling. ## How to configure Context Handling -The KEES configuration files are store in the following folder: +The Context Handling configuration files are store in the following folder: `./resources/` ### Monitoring Config From efeba8c2685920c21af45fa9415ea2776b884bee Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Thu, 5 May 2022 10:14:27 +0200 Subject: [PATCH 12/24] Update README.md Co-authored-by: philipreimer <5737222+philipreimer@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a99f2564..dfb6f64f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ SmartCLIDE Context Handling Component To build and run Context Handling, the following software is required:# - Java (at least version 11) -- Apache Maven (min V3.6) +- Apache Maven (at least version 3.5.4) - Docker [Desktop] (for running Context Handling) ## How to build Context Handling From e27f71fa25335908d3ef0b6d13e4bb8240420d35 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Thu, 5 May 2022 10:22:39 +0200 Subject: [PATCH 13/24] Update README.md --- README.md | 118 +----------------------------------------------------- 1 file changed, 2 insertions(+), 116 deletions(-) diff --git a/README.md b/README.md index dfb6f64f..f2e9d5a1 100644 --- a/README.md +++ b/README.md @@ -46,125 +46,11 @@ In the following the xml schema for the monitoring configuration is listed. Belo **monitoring-config.xsd** -``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` +The xsd file can be found here: [monitoring-config.xsd](https://github.com/eclipse-researchlabs/smartclide-context/blob/main/smartclide-monitoring/src/test/resources/config/monitoring-config.xsd) **monitoring-config.xml** -``` - - - - - - - - - - - - - - - - - - - - - -``` - -The "monitoring-config.xml" configuration file can also be changed by using the Admin UI. - +The current monitoring config can be found here: [monitoring-config.xml](https://github.com/eclipse-researchlabs/smartclide-context/blob/main/smartclide-monitoring/src/test/resources/config/monitoring-config.xml) ### Description #### indexes From 69c4a92acf0cfc86e2caf93d4ff416f009bed65f Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Thu, 5 May 2022 10:24:34 +0200 Subject: [PATCH 14/24] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index f2e9d5a1..83c70b22 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ The xsd file can be found here: [monitoring-config.xsd](https://github.com/eclip **monitoring-config.xml** The current monitoring config can be found here: [monitoring-config.xml](https://github.com/eclipse-researchlabs/smartclide-context/blob/main/smartclide-monitoring/src/test/resources/config/monitoring-config.xml) + ### Description #### indexes @@ -136,5 +137,3 @@ Each interpreter entry has the following mandatory attributes ``` - -The "services-config.xml" configuration file can also be changed by using the Admin UI. From f41529b5e20cc25e17adc7fd27080617d4ea9520 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Thu, 5 May 2022 10:47:23 +0200 Subject: [PATCH 15/24] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 83c70b22..3b313962 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ SmartCLIDE Context Handling Component ## Preconditions to build and run Context Handling -To build and run Context Handling, the following software is required:# +To build and run Context Handling, the following software is required: - Java (at least version 11) - Apache Maven (at least version 3.5.4) -- Docker [Desktop] (for running Context Handling) +- Docker (for deploying Context Handling on the SmartCLIDE cluster) ## How to build Context Handling From af5eac8d32fd1f5ac9582394b618272fb6e17729 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Thu, 5 May 2022 12:50:51 +0200 Subject: [PATCH 16/24] Update README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 3b313962..8494e0e2 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,10 @@ Each datasource entry has the following mandatory attributes - package de.atb.context.monitoring.monitors.file.FileSystemMonitor - package de.atb.context.monitoring.monitors.file.FilePairSystemMonitor - package de.atb.context.monitoring.monitors.file.FileTripletSystemMonitor + - package de.atb.context.monitoring.monitors.webservice.MessageBrokerMonitor - package de.atb.context.monitoring.monitors.webservice.WebServiceMonitor + - package de.atb.context.monitoring.monitors.GitlabCommitMonitor + - package de.atb.context.monitoring.monitors.GitMonitor - options: Options for the datasource can be entered using this value. The options are dependant on the datasource to be used - uri:The uri of the data source to be monitored - class:The following datasource implementations are available @@ -80,7 +83,9 @@ Each datasource entry has the following mandatory attributes - package de.atb.context.monitoring.config.models.datasources.FilePairSystemDataSource - package de.atb.context.monitoring.config.models.datasources.FileSystemDataSource - package de.atb.context.monitoring.config.models.datasources.FileTripletSystemDataSource + - package de.atb.context.monitoring.config.models.datasources.MessageBrokerDataSource - package de.atb.context.monitoring.config.models.datasources.WebServiceDataSource + - package de.atb.context.monitoring.config.models.datasources.GitlabDataSource #### interpreters @@ -93,13 +98,20 @@ Each interpreter entry has the following mandatory attributes - package de.atb.context.monitoring.analyser.file.FileAnalyser - package de.atb.context.monitoring.analyser.file.FilePairAnalyser - package de.atb.context.monitoring.analyser.file.FileTripletAnalyser + - package de.atb.context.monitoring.analyser.webservice.MessageBrokerAnalyser - package de.atb.context.monitoring.analyser.webservice.WebServiceAnalyser + - package de.atb.context.monitoring.analyser.webserviceGitAnalyser + - package de.atb.context.monitoring.analyser.webservice.GitlabCommitAnalyser - parser: The parser class to be used. The following implementations are available: - package de.atb.context.monitoring.parser.database.DatabaseParser - package de.atb.context.monitoring.parser.file.FileParser - package de.atb.context.monitoring.parser.file.FilePairParser - package de.atb.context.monitoring.parser.file.FileTripletParser + - package de.atb.context.monitoring.parser.webservice.MessageBrokerParser - package de.atb.context.monitoring.parser.webservice.WebServiceParser + - package de.atb.context.monitoring.parser.GitlabCommitParser + - package de.atb.context.monitoring.parser.GitParser + - type: Currently only used for File analyser and parser. Defines the file extensions to be used. #### monitors From 3b540725cec80d8d1acee028c692ffa357fadfce Mon Sep 17 00:00:00 2001 From: Philip Reimer <5737222+philipreimer@users.noreply.github.com> Date: Fri, 6 May 2022 11:10:10 +0200 Subject: [PATCH 17/24] add wait-for-it script to container image --- smartclide-monitoring/pom.xml | 8 + .../src/main/jib/entrypoint.d/wait-for-it.sh | 177 ++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100755 smartclide-monitoring/src/main/jib/entrypoint.d/wait-for-it.sh diff --git a/smartclide-monitoring/pom.xml b/smartclide-monitoring/pom.xml index 67aef472..0a98d186 100644 --- a/smartclide-monitoring/pom.xml +++ b/smartclide-monitoring/pom.xml @@ -46,6 +46,14 @@ ghcr.io/eclipse-researchlabs/smartclide/${project.artifactId}:latest + + + + /entrypoint.d/wait-for-it.sh + 755 + + + 19001 diff --git a/smartclide-monitoring/src/main/jib/entrypoint.d/wait-for-it.sh b/smartclide-monitoring/src/main/jib/entrypoint.d/wait-for-it.sh new file mode 100755 index 00000000..bf92f0c2 --- /dev/null +++ b/smartclide-monitoring/src/main/jib/entrypoint.d/wait-for-it.sh @@ -0,0 +1,177 @@ +#!/usr/bin/env bash +# Use this script to test if a given TCP host/port are available + +WAITFORIT_cmdname=${0##*/} + +echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi; } + +usage() { + cat <&2 +Usage: + $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] + -h HOST | --host=HOST Host or IP under test + -p PORT | --port=PORT TCP port under test + Alternatively, you specify the host and port as host:port + -s | --strict Only execute subcommand if the test succeeds + -q | --quiet Don't output any status messages + -t TIMEOUT | --timeout=TIMEOUT + Timeout in seconds, zero for no timeout + -- COMMAND ARGS Execute command with args after the test finishes +USAGE + exit 1 +} + +wait_for() { + if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then + echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" + else + echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" + fi + WAITFORIT_start_ts=$(date +%s) + while :; do + if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then + nc -z $WAITFORIT_HOST $WAITFORIT_PORT + WAITFORIT_result=$? + else + (echo -n >/dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 + WAITFORIT_result=$? + fi + if [[ $WAITFORIT_result -eq 0 ]]; then + WAITFORIT_end_ts=$(date +%s) + echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" + break + fi + sleep 1 + done + return $WAITFORIT_result +} + +wait_for_wrapper() { + # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 + if [[ $WAITFORIT_QUIET -eq 1 ]]; then + timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & + else + timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & + fi + WAITFORIT_PID=$! + trap "kill -INT -$WAITFORIT_PID" INT + wait $WAITFORIT_PID + WAITFORIT_RESULT=$? + if [[ $WAITFORIT_RESULT -ne 0 ]]; then + echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" + fi + return $WAITFORIT_RESULT +} + +# process arguments +while [[ $# -gt 0 ]]; do + case "$1" in + *:*) + WAITFORIT_hostport=(${1//:/ }) + WAITFORIT_HOST=${WAITFORIT_hostport[0]} + WAITFORIT_PORT=${WAITFORIT_hostport[1]} + shift 1 + ;; + --child) + WAITFORIT_CHILD=1 + shift 1 + ;; + -q | --quiet) + WAITFORIT_QUIET=1 + shift 1 + ;; + -s | --strict) + WAITFORIT_STRICT=1 + shift 1 + ;; + -h) + WAITFORIT_HOST="$2" + if [[ $WAITFORIT_HOST == "" ]]; then break; fi + shift 2 + ;; + --host=*) + WAITFORIT_HOST="${1#*=}" + shift 1 + ;; + -p) + WAITFORIT_PORT="$2" + if [[ $WAITFORIT_PORT == "" ]]; then break; fi + shift 2 + ;; + --port=*) + WAITFORIT_PORT="${1#*=}" + shift 1 + ;; + -t) + WAITFORIT_TIMEOUT="$2" + if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi + shift 2 + ;; + --timeout=*) + WAITFORIT_TIMEOUT="${1#*=}" + shift 1 + ;; + --) + shift + WAITFORIT_CLI=("$@") + break + ;; + --help) + usage + ;; + *) + echoerr "Unknown argument: $1" + usage + ;; + esac +done + +if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then + echoerr "Error: you need to provide a host and port to test." + usage +fi + +WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} +WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} +WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} +WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} + +# Check to see if timeout is from busybox? +WAITFORIT_TIMEOUT_PATH=$(type -p timeout) +WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) + +WAITFORIT_BUSYTIMEFLAG="" +if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then + WAITFORIT_ISBUSY=1 + # Check if busybox timeout uses -t flag + # (recent Alpine versions don't support -t anymore) + if timeout &>/dev/stdout | grep -q -e '-t '; then + WAITFORIT_BUSYTIMEFLAG="-t" + fi +else + WAITFORIT_ISBUSY=0 +fi + +if [[ $WAITFORIT_CHILD -gt 0 ]]; then + wait_for + WAITFORIT_RESULT=$? + exit $WAITFORIT_RESULT +else + if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then + wait_for_wrapper + WAITFORIT_RESULT=$? + else + wait_for + WAITFORIT_RESULT=$? + fi +fi + +if [[ $WAITFORIT_CLI != "" ]]; then + if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then + echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" + exit $WAITFORIT_RESULT + fi + exec "${WAITFORIT_CLI[@]}" +else + exit $WAITFORIT_RESULT +fi From 3016f1e418d9efda6493cf9048b0a5d9618cdf93 Mon Sep 17 00:00:00 2001 From: Philip Reimer <5737222+philipreimer@users.noreply.github.com> Date: Fri, 6 May 2022 11:14:10 +0200 Subject: [PATCH 18/24] add sample for running smartclide-monitoring locally update README with instructions for running sample --- README.md | 45 +++++++--------- samples/config/monitoring-config.xml | 29 ++++++++++ samples/config/monitoring-config.xsd | 80 ++++++++++++++++++++++++++++ samples/config/services-config.xml | 29 ++++++++++ samples/config/services-config.xsd | 26 +++++++++ samples/docker-compose.yml | 41 ++++++++++++++ 6 files changed, 225 insertions(+), 25 deletions(-) create mode 100644 samples/config/monitoring-config.xml create mode 100644 samples/config/monitoring-config.xsd create mode 100644 samples/config/services-config.xml create mode 100644 samples/config/services-config.xsd create mode 100644 samples/docker-compose.yml diff --git a/README.md b/README.md index 8494e0e2..fa95d5b6 100644 --- a/README.md +++ b/README.md @@ -7,50 +7,45 @@ To build and run Context Handling, the following software is required: - Java (at least version 11) - Apache Maven (at least version 3.5.4) -- Docker (for deploying Context Handling on the SmartCLIDE cluster) +- Docker (for running tests and deploying Context Handling on the SmartCLIDE cluster) +- docker-compose (for running local sample instance only) ## How to build Context Handling Context Handling can be built using maven with the following command: - `mvn package` + ```shell + mvn install + ``` -In order to build a docker container image that can be deployed to a docker host, the following command can be used: +In order to build and push a container image that can be deployed, the following command can be used: - `mvn clean ...` - -Note: Currently the configuration files are packed into the container images, which means that on each configuration change a new container has to be created and deployed. + ```shell + mvn install + mvn jib:build -pl smartclide-monitoring -Djib.to.image="${IMAGE_NAME:IMAGE_TAG}" -Djib.to.auth.username="${CONTAINER_REGISTRY_USERNAME}" -Djib.to.auth.password="${CONTAINER_REGISTRY_TOKEN}" + ``` ## How to run Context Handling -There are two possibilites to execute Context Handling. +A sample configuration and docker-compose file can be found in the [samples folder](samples). -1. Building and runnning the locally built Context Handling can be done using the following command: - ``` - buildAndRunCHLocally.sh - ``` +You can run the sample with the following command: -2. Executing Context Handling using the Docker container image from the ATB container registry: - ``` - docker run .... + ```shell + docker-compose -f samples/docker-compose.yml up ``` ## How to configure Context Handling -The Context Handling configuration files are store in the following folder: -`./resources/` - ### Monitoring Config -In the following the xml schema for the monitoring configuration is listed. Below the xsd the configuration elements are described in detail. - -**monitoring-config.xsd** +**monitoring-config.xml** -The xsd file can be found here: [monitoring-config.xsd](https://github.com/eclipse-researchlabs/smartclide-context/blob/main/smartclide-monitoring/src/test/resources/config/monitoring-config.xsd) +An example monitoring configuration can be found here: [monitoring-config.xml](samples/config/monitoring-config.xml) -**monitoring-config.xml** +**monitoring-config.xsd** -The current monitoring config can be found here: [monitoring-config.xml](https://github.com/eclipse-researchlabs/smartclide-context/blob/main/smartclide-monitoring/src/test/resources/config/monitoring-config.xml) +The corresponding XSD file can be found here: [monitoring-config.xsd](samples/config/monitoring-config.xsd) ### Description @@ -76,7 +71,7 @@ Each datasource entry has the following mandatory attributes - package de.atb.context.monitoring.monitors.webservice.WebServiceMonitor - package de.atb.context.monitoring.monitors.GitlabCommitMonitor - package de.atb.context.monitoring.monitors.GitMonitor -- options: Options for the datasource can be entered using this value. The options are dependant on the datasource to be used +- options: Options for the datasource can be entered using this value. The options are dependent on the datasource to be used - uri:The uri of the data source to be monitored - class:The following datasource implementations are available - package de.atb.context.monitoring.config.models.datasources.DatabaseDataSource @@ -116,7 +111,7 @@ Each interpreter entry has the following mandatory attributes #### monitors -... +*t.b.d. ...* ### service configuration diff --git a/samples/config/monitoring-config.xml b/samples/config/monitoring-config.xml new file mode 100644 index 00000000..ded9692b --- /dev/null +++ b/samples/config/monitoring-config.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/config/monitoring-config.xsd b/samples/config/monitoring-config.xsd new file mode 100644 index 00000000..9c40910c --- /dev/null +++ b/samples/config/monitoring-config.xsd @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/config/services-config.xml b/samples/config/services-config.xml new file mode 100644 index 00000000..025f780a --- /dev/null +++ b/samples/config/services-config.xml @@ -0,0 +1,29 @@ + + + + + + localhost + http://localhost:19001 + AmIMonitoringService + de.atb.context.services.AmIMonitoringService + de.atb.context.services.IAmIMonitoringService + + + localhost + http://localhost:19002 + AmIMonitoringDataRepositoryService + de.atb.context.services.AmIMonitoringDataRepositoryService + de.atb.context.services.IAmIMonitoringDataRepositoryService + + + localhost + http://localhost:19004 + PersistenceUnitService + de.atb.context.services.PersistenceUnitService + de.atb.core.services.IPersistenceUnitService + + + diff --git a/samples/config/services-config.xsd b/samples/config/services-config.xsd new file mode 100644 index 00000000..e6000a63 --- /dev/null +++ b/samples/config/services-config.xsd @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/docker-compose.yml b/samples/docker-compose.yml new file mode 100644 index 00000000..c981071b --- /dev/null +++ b/samples/docker-compose.yml @@ -0,0 +1,41 @@ +version: "3.8" + +services: + # rabbitmq - this is the datasource configured in config/monitoring-config.xml + rabbitmq: + image: rabbitmq:3.10.0-alpine + hostname: rabbitmq + ports: + - "5672:5672" + networks: + - smartclide-monitoring + # smartclide-monitoring + smartclide-monitoring: + image: ghcr.io/eclipse-researchlabs/smartclide/smartclide-monitoring:latest + depends_on: + - rabbitmq + volumes: + # configuration files are mounted to '/opt/smartclide/config' + # see eu.smartclide.contexthandling.ServiceMain for other options + - ./config:/opt/smartclide/config + # waits for rabbitmq datasource to be available before starting smartclide-monitoring + entrypoint: + [ + "/entrypoint.d/wait-for-it.sh", + "rabbitmq:5672", + "--strict", + "-t", + "30", + "--", + "java", + "-Djava.security.egd=file:/dev/./urandom", + "-cp", + "app/libs/*:app/resources:app/classes", + "eu.smartclide.contexthandling.ServiceMain", + ] + networks: + - smartclide-monitoring + +networks: + smartclide-monitoring: + name: smartclide-monitoring From 39186048f42485a187013aae1184fd80b4b78015 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Mon, 9 May 2022 09:38:36 +0200 Subject: [PATCH 19/24] Update README.md remove "service configuration" --- README.md | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/README.md b/README.md index fa95d5b6..e7b92eee 100644 --- a/README.md +++ b/README.md @@ -113,34 +113,3 @@ Each interpreter entry has the following mandatory attributes *t.b.d. ...* -### service configuration - -**services-config.xml** -``` - - - - - localhost - http://localhost:19001 - AmIMonitoringService - de.atb.context.services.AmIMonitoringService - de.atb.context.services.IAmIMonitoringService - - - localhost - http://localhost:19002 - AmIMonitoringDataRepositoryService - de.atb.context.services.AmIMonitoringDataRepositoryService - de.atb.context.services.IAmIMonitoringDataRepositoryService - - - localhost - http://localhost:19004 - PersistenceUnitService - de.atb.context.services.PersistenceUnitService - de.atb.core.services.IPersistenceUnitService - - - -``` From bee146f155615d78fb7105fac940f8b9b9b1453c Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Mon, 9 May 2022 09:47:00 +0200 Subject: [PATCH 20/24] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index e7b92eee..60774aac 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,4 @@ Each interpreter entry has the following mandatory attributes - type: Currently only used for File analyser and parser. Defines the file extensions to be used. -#### monitors - -*t.b.d. ...* From f3fadce99448f68b6aedfc8c90e241671177fad6 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Tue, 10 May 2022 15:06:58 +0200 Subject: [PATCH 21/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 60774aac..562f5dbc 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Each index entry has the following mandatory attributes Each datasource entry has the following mandatory attributes - id:The unique name of the datasource -- type:The type of the datasource. Possible values are: file, webservice, database +- type:The type of the datasource. Possible values are: filesystem, webservice, database, messageBroker - monitor:The class of the monitor to be used. Possible values are: - package de.atb.context.monitoring.monitors.database.DatabaseMonitor - package de.atb.context.monitoring.monitors.file.FileSystemMonitor From 35f8b82d8979c97f178e3450359f37824f9c4fdd Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Tue, 10 May 2022 15:40:13 +0200 Subject: [PATCH 22/24] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 562f5dbc..cbdb866f 100644 --- a/README.md +++ b/README.md @@ -109,4 +109,11 @@ Each interpreter entry has the following mandatory attributes - type: Currently only used for File analyser and parser. Defines the file extensions to be used. +#### interpreters + +Each monitor entry has the following mandatory attributes +- id: The unique name of the monitor +- datasource: The id of one previously defined datasource (see above) +- interpreter: The id of one previously defined interpreter (see above) +- index: The id of one previously defined index (see above) From 013926d742eb7ccc2a6778038f6a78cbc2d482d4 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Tue, 10 May 2022 15:40:27 +0200 Subject: [PATCH 23/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cbdb866f..d092a407 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Each interpreter entry has the following mandatory attributes - type: Currently only used for File analyser and parser. Defines the file extensions to be used. -#### interpreters +#### monitors Each monitor entry has the following mandatory attributes From 61b8ad3e3e837289afd417372c1c2bda03edb056 Mon Sep 17 00:00:00 2001 From: Sebastian Scholze <4063307+schlotze@users.noreply.github.com> Date: Wed, 11 May 2022 00:36:35 +0200 Subject: [PATCH 24/24] fix merge --- .../analyser/GitlabCommitAnalyser.java | 67 ----------- .../models/GitlabCommitDataModel.java | 111 ------------------ .../monitors/GitlabCommitMonitor.java | 38 ------ .../monitoring/parser/GitlabCommitParser.java | 37 ------ 4 files changed, 253 deletions(-) delete mode 100644 smartclide-monitoring/src/main/java/de/atb/context/monitoring/analyser/GitlabCommitAnalyser.java delete mode 100644 smartclide-monitoring/src/main/java/de/atb/context/monitoring/models/GitlabCommitDataModel.java delete mode 100644 smartclide-monitoring/src/main/java/de/atb/context/monitoring/monitors/GitlabCommitMonitor.java delete mode 100644 smartclide-monitoring/src/main/java/de/atb/context/monitoring/parser/GitlabCommitParser.java diff --git a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/analyser/GitlabCommitAnalyser.java b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/analyser/GitlabCommitAnalyser.java deleted file mode 100644 index 2c83879a..00000000 --- a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/analyser/GitlabCommitAnalyser.java +++ /dev/null @@ -1,67 +0,0 @@ -package de.atb.context.monitoring.analyser; - -/* - * #%L - * SmartCLIDE Monitoring - * %% - * Copyright (C) 2022 ATB – Institut für angewandte Systemtechnik Bremen GmbH - * %% - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * #L% - */ - -import com.google.gson.Gson; -import de.atb.context.monitoring.analyser.webservice.WebServiceAnalyser; -import de.atb.context.monitoring.config.models.DataSource; -import de.atb.context.monitoring.config.models.InterpreterConfiguration; -import de.atb.context.monitoring.index.Indexer; -import de.atb.context.monitoring.models.GitMessage; -import de.atb.context.monitoring.models.GitlabCommitDataModel; -import de.atb.context.monitoring.models.IWebService; -import de.atb.context.tools.ontology.AmIMonitoringConfiguration; -import org.apache.lucene.document.Document; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URI; -import java.util.Date; -import java.util.List; - -public class GitlabCommitAnalyser extends WebServiceAnalyser { - - private static final Logger logger = LoggerFactory.getLogger(GitlabCommitAnalyser.class); - - private static final Gson GSON = new Gson(); - - public GitlabCommitAnalyser(final DataSource dataSource, - final InterpreterConfiguration interpreterConfiguration, - final Indexer indexer, - final Document document, - final AmIMonitoringConfiguration amiConfiguration) { - super(dataSource, interpreterConfiguration, indexer, document, amiConfiguration); - } - - @Override - public List analyseObject(IWebService service) { - try { - final GitlabCommitDataModel model = new GitlabCommitDataModel(); - URI gitlabEndpoint = service.getURI(); - - // TODO "NEED TO BE IMPLEMENTED" - // * get list of projects where CH user has access to - // * iterate through projects and get last commits - // * for each identified "new" commit add a GitNessage below - model.addGitMessage(new GitMessage()); - - model.setMonitoredAt(new Date()); - return List.of(model); - } catch (Exception e) { - logger.error("Error analysing service: {}", service); - return List.of(); - } - } -} diff --git a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/models/GitlabCommitDataModel.java b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/models/GitlabCommitDataModel.java deleted file mode 100644 index 3fa8ee4a..00000000 --- a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/models/GitlabCommitDataModel.java +++ /dev/null @@ -1,111 +0,0 @@ -package de.atb.context.monitoring.models; - -/* - * #%L - * SmartCLIDE Monitoring - * %% - * Copyright (C) 2022 ATB – Institut für angewandte Systemtechnik Bremen GmbH - * %% - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * #L% - */ - -import de.atb.context.common.Version; -import de.atb.context.common.util.ApplicationScenario; -import de.atb.context.common.util.BusinessCase; -import de.atb.context.monitoring.config.models.datasources.MessageBrokerDataSource; -import de.atb.context.monitoring.config.models.datasources.WebServiceDataSource; -import de.atb.context.monitoring.rdf.RdfHelper; -import de.atb.context.persistence.ModelOutputLanguage; -import lombok.Getter; -import lombok.Setter; -import org.apache.jena.rdf.model.Model; -import org.simpleframework.xml.Root; -import thewebsemantic.Id; -import thewebsemantic.Namespace; -import thewebsemantic.RdfType; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -@RdfType("GitlabCommitDataModel") -@Namespace(BusinessCase.NS_DUMMY_URL) -@Root -@Getter -@Setter -public class GitlabCommitDataModel implements IMonitoringDataModel { - private Date monitoredAt; - private String documentIndexId = "index/broker"; - private String documentUri; - @Id - private String identifier; - private MessageBrokerDataSource dataSource; - private String implementingClassName = GitlabCommitDataModel.class.getName(); - private String monitoringDataVersion = Version.MONITORING_DATA.getVersionString(); - private List gitMessages = new ArrayList<>(); - - public GitlabCommitDataModel() { - this.identifier = UUID.randomUUID().toString(); - } - - public void addGitMessage(GitMessage gitMessage) { - if (!this.gitMessages.contains(gitMessage)) { - this.gitMessages.add(gitMessage); - } - } - - @Override - public GitlabCommitDataModel fromRdfModel(String rdfModel) { - return RdfHelper.createMonitoringData(rdfModel, GitlabCommitDataModel.class); - } - - @Override - public GitlabCommitDataModel fromRdfModel(Model model) { - return RdfHelper.createMonitoringData(model, GitlabCommitDataModel.class); - } - - @Override - public String toRdfString() { - return ModelOutputLanguage.RDFXML.getModelAsString(this.toRdfModel()); - } - - @Override - public Model toRdfModel() { - return RdfHelper.createRdfModel(this); - } - - @Override - public String getContextIdentifierClassName() { - return null; - } - - @Override - public void setDataSource(WebServiceDataSource dataSource) { - } - - @Override - public BusinessCase getBusinessCase() { - return BusinessCase.getInstance(BusinessCase.NS_DUMMY_ID, BusinessCase.NS_DUMMY_URL); - } - - @Override - public ApplicationScenario getApplicationScenario() { - return ApplicationScenario.getInstance(getBusinessCase()); - } - - @Override - public boolean triggersContextChange() { - return false; - } - - @Override - public void initialize() { - - } -} diff --git a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/monitors/GitlabCommitMonitor.java b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/monitors/GitlabCommitMonitor.java deleted file mode 100644 index a942d728..00000000 --- a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/monitors/GitlabCommitMonitor.java +++ /dev/null @@ -1,38 +0,0 @@ -package de.atb.context.monitoring.monitors; - -/* - * #%L - * SmartCLIDE Monitoring - * %% - * Copyright (C) 2022 ATB – Institut für angewandte Systemtechnik Bremen GmbH - * %% - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * #L% - */ - -import de.atb.context.monitoring.config.models.DataSource; -import de.atb.context.monitoring.config.models.Interpreter; -import de.atb.context.monitoring.config.models.Monitor; -import de.atb.context.monitoring.index.Indexer; -import de.atb.context.monitoring.monitors.webservice.WebServiceMonitor; -import de.atb.context.tools.ontology.AmIMonitoringConfiguration; - -import java.io.IOException; -import java.util.concurrent.TimeoutException; - -public class GitlabCommitMonitor extends WebServiceMonitor { - public GitlabCommitMonitor(final DataSource dataSource, - final Interpreter interpreter, - final Monitor monitor, - final Indexer indexer, - final AmIMonitoringConfiguration configuration) throws IOException, TimeoutException { - super(dataSource, interpreter, monitor, indexer, configuration); - - // FIXME: this is a temporary workaround and should be removed! - //addProgressListener(new DleGitMonitorProgressListener((WebServiceDataSource) dataSource)); - } -} diff --git a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/parser/GitlabCommitParser.java b/smartclide-monitoring/src/main/java/de/atb/context/monitoring/parser/GitlabCommitParser.java deleted file mode 100644 index 3c350844..00000000 --- a/smartclide-monitoring/src/main/java/de/atb/context/monitoring/parser/GitlabCommitParser.java +++ /dev/null @@ -1,37 +0,0 @@ -package de.atb.context.monitoring.parser; - -/* - * #%L - * SmartCLIDE Monitoring - * %% - * Copyright (C) 2021 ATB – Institut für angewandte Systemtechnik Bremen GmbH - * %% - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * #L% - */ - -import de.atb.context.monitoring.config.models.DataSource; -import de.atb.context.monitoring.config.models.InterpreterConfiguration; -import de.atb.context.monitoring.index.Indexer; -import de.atb.context.monitoring.models.IWebService; -import de.atb.context.monitoring.parser.webservice.WebServiceParser; -import de.atb.context.tools.ontology.AmIMonitoringConfiguration; -import org.apache.lucene.document.Document; - -public class GitlabCommitParser extends WebServiceParser { - public GitlabCommitParser(final DataSource dataSource, - final InterpreterConfiguration interpreterConfiguration, - final Indexer indexer, - final AmIMonitoringConfiguration amiConfiguration) { - super(dataSource, interpreterConfiguration, indexer, amiConfiguration); - } - - @Override - protected boolean parseObject(IWebService service, Document document) { - return true; - } -}