You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2021/01/15 09:24:23 UTC
[incubator-streampipes] branch dev updated: [STREAMPIPES-269]
Refactor serializer of runtime options endpoint
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 0226d59 [STREAMPIPES-269] Refactor serializer of runtime options endpoint
0226d59 is described below
commit 0226d59a69661583209a1887cff1220fdd1ff797
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Fri Jan 15 10:24:07 2021 +0100
[STREAMPIPES-269] Refactor serializer of runtime options endpoint
---
.../container/api/InvocablePipelineElementResource.java | 4 ++++
.../manager/remote/ContainerProvidedOptionsHandler.java | 9 +++------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/streampipes-container/src/main/java/org/apache/streampipes/container/api/InvocablePipelineElementResource.java b/streampipes-container/src/main/java/org/apache/streampipes/container/api/InvocablePipelineElementResource.java
index 5664a57..3b6fc68 100644
--- a/streampipes-container/src/main/java/org/apache/streampipes/container/api/InvocablePipelineElementResource.java
+++ b/streampipes-container/src/main/java/org/apache/streampipes/container/api/InvocablePipelineElementResource.java
@@ -27,6 +27,7 @@ import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
import org.apache.streampipes.model.runtime.RuntimeOptionsRequest;
import org.apache.streampipes.model.runtime.RuntimeOptionsResponse;
import org.apache.streampipes.model.staticproperty.Option;
+import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.sdk.extractor.AbstractParameterExtractor;
import org.apache.streampipes.sdk.extractor.StaticPropertyExtractor;
@@ -51,6 +52,7 @@ public abstract class InvocablePipelineElementResource<I extends InvocableStream
@Path("{elementId}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
+ @JacksonSerialized
public javax.ws.rs.core.Response invokeRuntime(@PathParam("elementId") String elementId, I graph) {
try {
@@ -78,6 +80,7 @@ public abstract class InvocablePipelineElementResource<I extends InvocableStream
@Path("{elementId}/configurations")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
+ @JacksonSerialized
public javax.ws.rs.core.Response fetchConfigurations(@PathParam("elementId") String elementId,
RuntimeOptionsRequest runtimeOptionsRequest) {
@@ -98,6 +101,7 @@ public abstract class InvocablePipelineElementResource<I extends InvocableStream
@Path("{elementId}/output")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
+ @JacksonSerialized
public javax.ws.rs.core.Response fetchOutputStrategy(@PathParam("elementId") String elementId, I runtimeOptionsRequest) {
try {
//I runtimeOptionsRequest = JacksonSerializer.getObjectMapper().readValue(payload, clazz);
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/remote/ContainerProvidedOptionsHandler.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/remote/ContainerProvidedOptionsHandler.java
index 6766d98..cc6e9b0 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/remote/ContainerProvidedOptionsHandler.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/remote/ContainerProvidedOptionsHandler.java
@@ -23,7 +23,7 @@ import org.apache.http.client.fluent.Response;
import org.apache.http.entity.ContentType;
import org.apache.streampipes.model.runtime.RuntimeOptionsRequest;
import org.apache.streampipes.model.runtime.RuntimeOptionsResponse;
-import org.apache.streampipes.serializers.json.GsonSerializer;
+import org.apache.streampipes.serializers.json.JacksonSerializer;
import java.io.IOException;
@@ -38,10 +38,9 @@ public class ContainerProvidedOptionsHandler {
// request.setStaticProperties(parameterRequest.getStaticProperties());
// request.setAppId(parameterRequest.getAppId());
- String httpRequestBody = GsonSerializer.getGsonWithIds()
- .toJson(request);
try {
+ String httpRequestBody = JacksonSerializer.getObjectMapper().writeValueAsString(request);
Response httpResp = Request.Post(request.getBelongsTo() + "/configurations").bodyString(httpRequestBody, ContentType.APPLICATION_JSON).execute();
return handleResponse(httpResp);
} catch (Exception e) {
@@ -52,8 +51,6 @@ public class ContainerProvidedOptionsHandler {
private RuntimeOptionsResponse handleResponse(Response httpResp) throws JsonSyntaxException, IOException {
String resp = httpResp.returnContent().asString();
- return GsonSerializer
- .getGsonWithIds()
- .fromJson(resp, RuntimeOptionsResponse.class);
+ return JacksonSerializer.getObjectMapper().readValue(resp, RuntimeOptionsResponse.class);
}
}