You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by eb...@apache.org on 2021/06/11 18:20:10 UTC

[incubator-streampipes] 02/29: [STREAMPIPES-349] Add implementation of endpoint for 'getting all stored measurement series'

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

ebi pushed a commit to branch STREAMPIPES-349
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 33c617cd98b4d60434b06e7221b0539a10df9d83
Author: Daniel Ebi <eb...@fzi.de>
AuthorDate: Fri Apr 30 10:06:29 2021 +0200

    [STREAMPIPES-349] Add implementation of endpoint for 'getting all stored measurement series'
---
 .../dataexplorer/DataLakeManagementV4.java         | 32 ++++++++++++++++++++++
 .../apache/streampipes/ps/DataLakeResourceV4.java  | 24 ++++++++++++----
 2 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV4.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV4.java
new file mode 100644
index 0000000..07f2b90
--- /dev/null
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV4.java
@@ -0,0 +1,32 @@
+/*
+ * 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.dataexplorer;
+
+import org.apache.streampipes.dataexplorer.utils.DataExplorerUtils;
+import org.apache.streampipes.model.datalake.DataLakeMeasure;
+
+import java.util.List;
+
+public class DataLakeManagementV4 {
+
+    public List<DataLakeMeasure> getAllMeasurementSeries() {
+        List<DataLakeMeasure> dataLakeMeasuresList = DataExplorerUtils.getInfos();
+        return dataLakeMeasuresList;
+    }
+}
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
index 35ac486..d6f51f6 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
@@ -25,20 +25,36 @@ import io.swagger.v3.oas.annotations.media.ArraySchema;
 import io.swagger.v3.oas.annotations.media.Content;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.apache.streampipes.dataexplorer.DataLakeManagementV4;
 import org.apache.streampipes.model.datalake.DataLakeMeasure;
+import org.apache.streampipes.rest.impl.AbstractRestResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
+import java.util.List;
+
+class Placeholder {
+}
 
 
 @Path("v4/users/{username}/datalake")
-public class DataLakeResourceV4 {
+public class DataLakeResourceV4 extends AbstractRestResource {
 
     private static final Logger logger = LoggerFactory.getLogger(DataLakeResourceV4.class);
 
+    private DataLakeManagementV4 dataLakeManagement;
+
+    public DataLakeResourceV4() {
+        this.dataLakeManagement = new DataLakeManagementV4();
+    }
+
+    public DataLakeResourceV4(DataLakeManagementV4 dataLakeManagement) {
+        this.dataLakeManagement = dataLakeManagement;
+    }
+
 
     @POST
     @Path("/measurements/{measurementID}/configuration")
@@ -77,10 +93,8 @@ public class DataLakeResourceV4 {
             responses = {
                     @ApiResponse(responseCode = "200", description = "array of stored measurement series", content = @Content(array = @ArraySchema(schema = @Schema(implementation = DataLakeMeasure.class))))})
     public Response getAll(@Parameter(in = ParameterIn.PATH, description = "username", required = true) @PathParam("username") String username) {
-        /**
-         * TODO: implementation of method stump
-         */
-        return null;
+        List<DataLakeMeasure> allMeasurementSeries = this.dataLakeManagement.getAllMeasurementSeries();
+        return ok(allMeasurementSeries);
     }
 
     @GET