You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by te...@apache.org on 2020/03/06 12:04:17 UTC
[incubator-streampipes] branch STREAMPIPES-79 updated:
[STREAMPIPES-79] try to serialize 'datalkemeasure' as jsonld
This is an automated email from the ASF dual-hosted git repository.
tex pushed a commit to branch STREAMPIPES-79
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/STREAMPIPES-79 by this push:
new e9dbff4 [STREAMPIPES-79] try to serialize 'datalkemeasure' as jsonld
e9dbff4 is described below
commit e9dbff415a5675341d351564de20c2aa5ccd64f4
Author: tex <te...@fzi.de>
AuthorDate: Fri Mar 6 13:04:01 2020 +0100
[STREAMPIPES-79] try to serialize 'datalkemeasure' as jsonld
---
.../model/datalake/DataLakeMeasure.java | 3 +-
.../rest/impl/datalake/DataLakeResourceV3.java | 8 ++--
.../rest/impl/datalake/model/InfoResult.java | 51 ----------------------
.../jsonld/CustomAnnotationProvider.java | 5 ++-
.../serializers/jsonld/JsonLdTransformer.java | 4 +-
5 files changed, 12 insertions(+), 59 deletions(-)
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataLakeMeasure.java b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataLakeMeasure.java
index 9890fbf..098617e 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataLakeMeasure.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataLakeMeasure.java
@@ -20,6 +20,7 @@ package org.apache.streampipes.model.datalake;
import io.fogsy.empire.annotations.RdfProperty;
import io.fogsy.empire.annotations.RdfsClass;
+import org.apache.streampipes.model.base.UnnamedStreamPipesEntity;
import org.apache.streampipes.model.schema.EventSchema;
import org.apache.streampipes.vocabulary.StreamPipes;
@@ -30,7 +31,7 @@ import javax.persistence.OneToOne;
@RdfsClass(StreamPipes.DATA_LAKE_MEASURE)
@Entity
-public class DataLakeMeasure {
+public class DataLakeMeasure extends UnnamedStreamPipesEntity {
@RdfProperty(StreamPipes.HAS_MEASUREMENT_NAME)
private String measureName;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
index 2eb79f9..a018523 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
@@ -26,6 +26,8 @@ import org.apache.streampipes.rest.impl.datalake.model.DataResult;
import org.apache.streampipes.rest.impl.datalake.model.GroupedDataResult;
import org.apache.streampipes.rest.impl.datalake.model.PageResult;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
+import org.apache.streampipes.rest.shared.annotation.JsonLdSerialized;
+import org.apache.streampipes.rest.shared.util.SpMediaType;
import java.io.IOException;
import java.text.ParseException;
@@ -81,13 +83,13 @@ public class DataLakeResourceV3 extends AbstractRestInterface {
}
@GET
- @Produces(MediaType.APPLICATION_JSON)
- @GsonWithIds
+ @JsonLdSerialized
+ @Produces(SpMediaType.JSONLD)
@Path("/info")
public Response getAllInfos() {
List<DataLakeMeasure> result = this.dataLakeManagement.getInfos();
- return Response.ok(new Gson().toJson(result)).build();
+ return ok(result);
}
@Deprecated
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/model/InfoResult.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/model/InfoResult.java
deleted file mode 100644
index 34b8040..0000000
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/model/InfoResult.java
+++ /dev/null
@@ -1,51 +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.rest.impl.datalake.model;
-
-import org.apache.streampipes.model.schema.EventSchema;
-
-public class InfoResult {
-
- private String index;
- private EventSchema eventSchema;
-
- public InfoResult() {
- }
-
- public InfoResult(String index, EventSchema eventSchema) {
- this.index = index;
- this.eventSchema = eventSchema;
- }
-
- public String getIndex() {
- return index;
- }
-
- public void setIndex(String index) {
- this.index = index;
- }
-
- public EventSchema getEventSchema() {
- return eventSchema;
- }
-
- public void setEventSchema(EventSchema eventSchema) {
- this.eventSchema = eventSchema;
- }
-}
diff --git a/streampipes-serializers/src/main/java/org/apache/streampipes/serializers/jsonld/CustomAnnotationProvider.java b/streampipes-serializers/src/main/java/org/apache/streampipes/serializers/jsonld/CustomAnnotationProvider.java
index 13fdc10..1f5c032 100644
--- a/streampipes-serializers/src/main/java/org/apache/streampipes/serializers/jsonld/CustomAnnotationProvider.java
+++ b/streampipes-serializers/src/main/java/org/apache/streampipes/serializers/jsonld/CustomAnnotationProvider.java
@@ -53,6 +53,7 @@ import org.apache.streampipes.model.connect.worker.ConnectWorkerContainer;
import org.apache.streampipes.model.dashboard.DashboardWidgetModel;
import org.apache.streampipes.model.dashboard.VisualizablePipeline;
import org.apache.streampipes.model.datalake.DataExplorerWidgetModel;
+import org.apache.streampipes.model.datalake.DataLakeMeasure;
import org.apache.streampipes.model.graph.DataProcessorDescription;
import org.apache.streampipes.model.graph.DataProcessorInvocation;
import org.apache.streampipes.model.graph.DataSinkDescription;
@@ -248,8 +249,8 @@ public class CustomAnnotationProvider implements EmpireAnnotationProvider {
DashboardWidgetModel.class,
VisualizablePipeline.class,
DataExplorerWidgetModel.class,
- StreamPipesJsonLdContainer.class
-
+ StreamPipesJsonLdContainer.class,
+ DataLakeMeasure.class
);
}
}
diff --git a/streampipes-serializers/src/main/java/org/apache/streampipes/serializers/jsonld/JsonLdTransformer.java b/streampipes-serializers/src/main/java/org/apache/streampipes/serializers/jsonld/JsonLdTransformer.java
index 7aeaa49..5c952a7 100644
--- a/streampipes-serializers/src/main/java/org/apache/streampipes/serializers/jsonld/JsonLdTransformer.java
+++ b/streampipes-serializers/src/main/java/org/apache/streampipes/serializers/jsonld/JsonLdTransformer.java
@@ -69,8 +69,8 @@ public class JsonLdTransformer implements RdfTransformer {
StreamPipes.CONNECT_WORKER_CONTAINER,
StreamPipes.DASHBOARD_WIDGET_MODEL,
StreamPipes.DASHBOARD_MODEL,
- StreamPipes.DATA_EXPLORER_WIDGET_MODEL
-
+ StreamPipes.DATA_EXPLORER_WIDGET_MODEL,
+ StreamPipes.DATA_LAKE_MEASURE
);
private List<String> selectedRootElements;