You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2024/03/06 16:16:38 UTC

(streampipes) 01/01: refactor: Remove unused MonitoringDataStorage

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch refactor-remove-monitoring-data-storage
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit ab4de7202e71c22b48bcefd9c667170add428bd3
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Wed Mar 6 17:16:26 2024 +0100

    refactor: Remove unused MonitoringDataStorage
---
 .../streampipes/storage/api/INoSqlStorage.java     |  2 -
 .../api/IPipelineMonitoringDataStorage.java        | 36 -----------
 .../storage/couchdb/CouchDbStorageManager.java     |  7 ---
 .../couchdb/impl/MonitoringDataStorageImpl.java    | 69 ----------------------
 4 files changed, 114 deletions(-)

diff --git a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java
index 473e8d1ca6..a87b0fabff 100644
--- a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java
+++ b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/INoSqlStorage.java
@@ -38,8 +38,6 @@ public interface INoSqlStorage {
 
   IUserStorage getUserStorageAPI();
 
-  IPipelineMonitoringDataStorage getMonitoringDataStorageApi();
-
   INotificationStorage getNotificationStorageApi();
 
   IPipelineCategoryStorage getPipelineCategoryStorageApi();
diff --git a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineMonitoringDataStorage.java b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineMonitoringDataStorage.java
deleted file mode 100644
index eade25eabc..0000000000
--- a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IPipelineMonitoringDataStorage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.storage.api;
-
-import org.apache.streampipes.model.client.monitoring.JobReport;
-
-import java.util.List;
-
-public interface IPipelineMonitoringDataStorage {
-
-  List<JobReport> getAllMonitoringJobReports();
-
-  List<JobReport> getAllMonitoringJobReportsByElement(String elementUri);
-
-  JobReport getLatestJobReport(String elementUri);
-
-  boolean storeJobReport(JobReport jobReport);
-
-
-}
diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java
index 1ae99a5527..87886fc7c9 100644
--- a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java
+++ b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/CouchDbStorageManager.java
@@ -42,7 +42,6 @@ import org.apache.streampipes.storage.api.IPipelineCategoryStorage;
 import org.apache.streampipes.storage.api.IPipelineElementConnectionStorage;
 import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorage;
 import org.apache.streampipes.storage.api.IPipelineElementTemplateStorage;
-import org.apache.streampipes.storage.api.IPipelineMonitoringDataStorage;
 import org.apache.streampipes.storage.api.IPipelineStorage;
 import org.apache.streampipes.storage.api.ISpCoreConfigurationStorage;
 import org.apache.streampipes.storage.api.IUserActivationTokenStorage;
@@ -68,7 +67,6 @@ import org.apache.streampipes.storage.couchdb.impl.ExtensionsServiceStorageImpl;
 import org.apache.streampipes.storage.couchdb.impl.FileMetadataStorageImpl;
 import org.apache.streampipes.storage.couchdb.impl.GenericStorageImpl;
 import org.apache.streampipes.storage.couchdb.impl.ImageStorageImpl;
-import org.apache.streampipes.storage.couchdb.impl.MonitoringDataStorageImpl;
 import org.apache.streampipes.storage.couchdb.impl.NotificationStorageImpl;
 import org.apache.streampipes.storage.couchdb.impl.PasswordRecoveryTokenImpl;
 import org.apache.streampipes.storage.couchdb.impl.PermissionStorageImpl;
@@ -126,11 +124,6 @@ public enum CouchDbStorageManager implements INoSqlStorage {
     return new UserStorage();
   }
 
-  @Override
-  public IPipelineMonitoringDataStorage getMonitoringDataStorageApi() {
-    return new MonitoringDataStorageImpl();
-  }
-
   @Override
   public INotificationStorage getNotificationStorageApi() {
     return new NotificationStorageImpl();
diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/MonitoringDataStorageImpl.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/MonitoringDataStorageImpl.java
deleted file mode 100644
index 1b51d44f24..0000000000
--- a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/MonitoringDataStorageImpl.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.storage.couchdb.impl;
-
-import org.apache.streampipes.model.client.monitoring.JobReport;
-import org.apache.streampipes.storage.api.IPipelineMonitoringDataStorage;
-import org.apache.streampipes.storage.couchdb.dao.AbstractDao;
-import org.apache.streampipes.storage.couchdb.utils.Utils;
-
-import java.util.Comparator;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-public class MonitoringDataStorageImpl extends AbstractDao<JobReport> implements IPipelineMonitoringDataStorage {
-
-  public MonitoringDataStorageImpl() {
-    super(Utils::getCouchDbMonitoringClient, JobReport.class);
-  }
-
-  @Override
-  public List<JobReport> getAllMonitoringJobReports() {
-    return findAll();
-  }
-
-  @Override
-  public List<JobReport> getAllMonitoringJobReportsByElement(String elementUri) {
-    List<JobReport> allReports = findAll();
-    return getJobReportStream(elementUri, allReports)
-        .collect(Collectors.toList());
-  }
-
-  private Stream<JobReport> getJobReportStream(String elementUri, List<JobReport> allReports) {
-    return allReports
-        .stream()
-        .filter(r -> r.getElementId().equals(elementUri));
-  }
-
-  @Override
-  public JobReport getLatestJobReport(String elementUri) {
-    List<JobReport> allReports = findAll();
-    return getJobReportStream(elementUri, allReports)
-        .sorted(Comparator.comparing(JobReport::getGenerationDate))
-        .findFirst()
-        .get();
-  }
-
-  @Override
-  public boolean storeJobReport(JobReport jobReport) {
-    return persist(jobReport).k;
-  }
-
-}