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] 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; - } -}