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 2022/04/21 21:15:07 UTC
[incubator-streampipes] 03/04: [hotfix] Clean up shared Rest module
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
commit 87aeb21661b48e739b1bae5047287546997f7466
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Thu Apr 21 22:53:26 2022 +0200
[hotfix] Clean up shared Rest module
---
.../backend/StreamPipesResourceConfig.java | 7 -
.../rest/shared/annotation/GsonClientModel.java | 31 -----
.../rest/shared/annotation/GsonWithIds.java | 31 -----
.../rest/shared/annotation/GsonWithoutIds.java | 31 -----
.../shared/impl/AbstractSharedRestInterface.java | 5 -
.../shared/serializer/GsonClientModelProvider.java | 47 -------
.../rest/shared/serializer/GsonJerseyProvider.java | 39 ------
.../rest/shared/serializer/GsonWithIdProvider.java | 51 -------
.../shared/serializer/GsonWithoutIdProvider.java | 49 -------
.../streampipes/rest/impl/Authentication.java | 3 +-
.../apache/streampipes/rest/impl/DataStream.java | 4 +-
.../apache/streampipes/rest/impl/Deployment.java | 153 ---------------------
.../rest/impl/MeasurementUnitResource.java | 3 +-
.../admin/ExtensionsServiceEndpointResource.java | 10 +-
.../apache/streampipes/rest/v2/DeploymentTest.java | 63 ---------
15 files changed, 9 insertions(+), 518 deletions(-)
diff --git a/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java b/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java
index 78a245c07..80dd28bd5 100644
--- a/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java
+++ b/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java
@@ -37,9 +37,6 @@ import org.apache.streampipes.rest.impl.nouser.PipelineElementImportNoUser;
import org.apache.streampipes.rest.impl.pe.DataProcessorResource;
import org.apache.streampipes.rest.impl.pe.DataSinkResource;
import org.apache.streampipes.rest.impl.pe.DataStreamResource;
-import org.apache.streampipes.rest.shared.serializer.GsonClientModelProvider;
-import org.apache.streampipes.rest.shared.serializer.GsonWithIdProvider;
-import org.apache.streampipes.rest.shared.serializer.GsonWithoutIdProvider;
import org.apache.streampipes.rest.shared.serializer.JacksonSerializationProvider;
import org.apache.streampipes.service.base.rest.ServiceHealthResource;
import org.glassfish.jersey.media.multipart.MultiPartFeature;
@@ -68,7 +65,6 @@ public class StreamPipesResourceConfig extends ResourceConfig {
register(DataLakeResourceV3.class);
register(DataLakeMeasureResourceV3.class);
register(DataStream.class);
- register(Deployment.class);
register(EmailConfigurationResource.class);
register(EmailResource.class);
register(ExtensionsServiceEndpointResource.class);
@@ -114,9 +110,6 @@ public class StreamPipesResourceConfig extends ResourceConfig {
register(UserGroupResource.class);
// Serializers
- register(GsonWithIdProvider.class);
- register(GsonWithoutIdProvider.class);
- register(GsonClientModelProvider.class);
register(JacksonSerializationProvider.class);
register(MultiPartFeature.class);
diff --git a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/annotation/GsonClientModel.java b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/annotation/GsonClientModel.java
deleted file mode 100644
index 559cd5b8c..000000000
--- a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/annotation/GsonClientModel.java
+++ /dev/null
@@ -1,31 +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.shared.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.ws.rs.NameBinding;
-
-@NameBinding
-@Target({ ElementType.TYPE, ElementType.METHOD })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface GsonClientModel {}
diff --git a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/annotation/GsonWithIds.java b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/annotation/GsonWithIds.java
deleted file mode 100644
index a6523b175..000000000
--- a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/annotation/GsonWithIds.java
+++ /dev/null
@@ -1,31 +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.shared.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.ws.rs.NameBinding;
-
-@NameBinding
-@Target({ ElementType.TYPE, ElementType.METHOD })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface GsonWithIds {}
diff --git a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/annotation/GsonWithoutIds.java b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/annotation/GsonWithoutIds.java
deleted file mode 100644
index b5c3d6444..000000000
--- a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/annotation/GsonWithoutIds.java
+++ /dev/null
@@ -1,31 +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.shared.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.ws.rs.NameBinding;
-
-@NameBinding
-@Target({ ElementType.TYPE, ElementType.METHOD })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface GsonWithoutIds {}
diff --git a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/impl/AbstractSharedRestInterface.java b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/impl/AbstractSharedRestInterface.java
index 7c667ef11..a84cef266 100644
--- a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/impl/AbstractSharedRestInterface.java
+++ b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/impl/AbstractSharedRestInterface.java
@@ -17,8 +17,6 @@
*/
package org.apache.streampipes.rest.shared.impl;
-import org.apache.streampipes.serializers.json.GsonSerializer;
-
import javax.ws.rs.core.Response;
public abstract class AbstractSharedRestInterface {
@@ -57,7 +55,4 @@ public abstract class AbstractSharedRestInterface {
return Response.serverError().build();
}
- protected <T> String toJson(T element) {
- return GsonSerializer.getGson().toJson(element);
- }
}
diff --git a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonClientModelProvider.java b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonClientModelProvider.java
deleted file mode 100644
index 07eac86c8..000000000
--- a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonClientModelProvider.java
+++ /dev/null
@@ -1,47 +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.shared.serializer;
-
-import com.google.gson.Gson;
-import org.apache.streampipes.rest.shared.annotation.GsonClientModel;
-import org.apache.streampipes.serializers.json.Utils;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.ext.Provider;
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-
-@Provider
-@GsonClientModel
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public class GsonClientModelProvider extends GsonJerseyProvider {
-
- @Override
- protected Gson getGsonSerializer() {
- return Utils.getGson();
- }
-
- @Override
- protected boolean requiredAnnotationsPresent(Annotation[] annotations) {
- return Arrays.stream(annotations).anyMatch(a -> a.annotationType().equals(GsonClientModel.class));
- }
-}
diff --git a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonJerseyProvider.java b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonJerseyProvider.java
deleted file mode 100644
index 92c97b28a..000000000
--- a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonJerseyProvider.java
+++ /dev/null
@@ -1,39 +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.shared.serializer;
-
-import com.google.gson.Gson;
-
-import java.io.InputStreamReader;
-import java.io.Writer;
-import java.lang.reflect.Type;
-
-public abstract class GsonJerseyProvider extends JsonJerseyProvider {
-
- protected abstract Gson getGsonSerializer();
-
- @Override
- protected void serialize(Object t, Type type, Writer writer) {
- getGsonSerializer().toJson(t, type, writer);
- }
-
- @Override
- protected Object deserialize(InputStreamReader reader, Type type) {
- return getGsonSerializer().fromJson(reader, type);
- }
-}
diff --git a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonWithIdProvider.java b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonWithIdProvider.java
deleted file mode 100644
index b0eb2c806..000000000
--- a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonWithIdProvider.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.shared.serializer;
-
-import com.google.gson.Gson;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
-import org.apache.streampipes.serializers.json.Utils;
-
-import javax.annotation.Priority;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.ext.Provider;
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-
-@Provider
-@Priority(5)
-@GsonWithIds
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public class GsonWithIdProvider extends GsonJerseyProvider {
-
- @Override
- protected Gson getGsonSerializer() {
- return Utils.getGson();
- }
-
- @Override
- protected boolean requiredAnnotationsPresent(Annotation[] annotations) {
- return Arrays.stream(annotations).anyMatch(a -> a.annotationType().equals(GsonWithIds.class));
- }
-
-
-}
diff --git a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonWithoutIdProvider.java b/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonWithoutIdProvider.java
deleted file mode 100644
index 578ba750b..000000000
--- a/streampipes-rest-shared/src/main/java/org/apache/streampipes/rest/shared/serializer/GsonWithoutIdProvider.java
+++ /dev/null
@@ -1,49 +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.shared.serializer;
-
-import com.google.gson.Gson;
-import org.apache.streampipes.rest.shared.annotation.GsonWithoutIds;
-import org.apache.streampipes.serializers.json.GsonSerializer;
-
-import javax.annotation.Priority;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.ext.Provider;
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-
-@Provider
-@Priority(6)
-@GsonWithoutIds
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public class GsonWithoutIdProvider extends GsonJerseyProvider {
-
- @Override
- protected Gson getGsonSerializer() {
- return GsonSerializer.getGsonWithIds();
- }
-
- @Override
- protected boolean requiredAnnotationsPresent(Annotation[] annotations) {
- return Arrays.stream(annotations).anyMatch(a -> a.annotationType().equals(GsonWithoutIds.class));
- }
-}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java
index 30643ab4a..679257c96 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Authentication.java
@@ -28,7 +28,6 @@ import org.apache.streampipes.model.message.NotificationType;
import org.apache.streampipes.model.message.Notifications;
import org.apache.streampipes.model.message.SuccessMessage;
import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.user.management.jwt.JwtTokenProvider;
import org.apache.streampipes.user.management.model.PrincipalUserDetails;
@@ -81,7 +80,7 @@ public class Authentication extends AbstractRestResource {
@Path("/register")
@POST
- @GsonWithIds
+ @JacksonSerialized
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response doRegister(RegistrationData data) {
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java
index 3e2aa7d49..2015ef7e2 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java
@@ -20,7 +20,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.operations.Operations;
import org.apache.streampipes.model.SpDataStream;
import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
+import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -34,7 +34,7 @@ public class DataStream extends AbstractRestResource {
@Path("/update")
@POST
@Produces(MediaType.APPLICATION_JSON)
- @GsonWithIds
+ @JacksonSerialized
public Response getStreamsBySource(SpDataStream stream) {
return ok(Operations.updateActualTopic(stream));
}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java
deleted file mode 100644
index 6292ae653..000000000
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java
+++ /dev/null
@@ -1,153 +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;
-
-import org.apache.streampipes.model.base.NamedStreamPipesEntity;
-import org.apache.streampipes.model.client.deployment.DeploymentConfiguration;
-import org.apache.streampipes.model.client.deployment.ElementType;
-import org.apache.streampipes.model.graph.DataProcessorDescription;
-import org.apache.streampipes.model.graph.DataSinkDescription;
-import org.apache.streampipes.model.graph.DataSourceDescription;
-import org.apache.streampipes.model.message.Notifications;
-import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-import org.apache.streampipes.serializers.json.GsonSerializer;
-import org.apache.streampipes.storage.management.StorageManager;
-import org.glassfish.jersey.media.multipart.FormDataParam;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-
-@Path("/v2/deploy")
-public class Deployment extends AbstractRestResource {
-
- @POST
- @Path("/implementation")
- @Produces("application/zip")
- @Consumes(MediaType.MULTIPART_FORM_DATA)
- public Response getFile(@FormDataParam("config") String config, @FormDataParam("model") String model) {
- DeploymentConfiguration deploymentConfig = fromJson(config);
-
- NamedStreamPipesEntity element = getElement(deploymentConfig, model);
-
- if (element == null) {
- throw new WebApplicationException(500);
- }
-
-// File f = CodeGenerator.getCodeGenerator(deploymentConfig, element).getGeneratedFile();
-//
-// if (!f.exists()) {
-// throw new WebApplicationException(404);
-// }
-//
-// return Response.ok(f)
-// .header("Content-Disposition",
-// "attachment; filename=" + f.getName()).build();
- return Response.serverError().build();
- }
-
- public static NamedStreamPipesEntity getElement(DeploymentConfiguration config, String model) {
-
- if (config.getElementType() == ElementType.SEP) {
- return GsonSerializer.getGsonWithIds().fromJson(model, DataSourceDescription.class);
- } else if (config.getElementType() == ElementType.SEPA) {
- return GsonSerializer.getGsonWithIds().fromJson(model, DataProcessorDescription.class);
- } else if (config.getElementType() == ElementType.SEC) {
- return GsonSerializer.getGsonWithIds().fromJson(model, DataSinkDescription.class);
- } else {
- return null;
- }
- }
-
- @POST
- @Path("/import")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.MULTIPART_FORM_DATA)
- public Response directImport(@FormDataParam("config") String config,
- @FormDataParam("model") String model) {
-// TODO check if this can be deleted
-// DataSourceDescription sep = new DataSourceDescription(GsonSerializer.getGsonWithIds().fromJson(model, DataSourceDescription.class));
-// try {
-// Message message =
-// Operations.verifyAndAddElement(JsonLdUtils.asString(new JsonLdTransformer().toJsonLd(sep)), username, true, true);
-// return ok(message);
-// } catch (RDFHandlerException | IllegalAccessException
-// | IllegalArgumentException | InvocationTargetException
-// | SecurityException | ClassNotFoundException
-// | SepaParseException | InvalidRdfException e) {
-// e.printStackTrace();
-// return ok(Notifications.error("Error: Could not store source definition."));
-// }
- return fail();
- }
-
- @POST
- @Path("/update")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.MULTIPART_FORM_DATA)
- public Response directUpdate(@FormDataParam("config") String config, @FormDataParam("model") String model) {
-
- DeploymentConfiguration deploymentConfig = fromJson(config);
-
- boolean success;
-
- if (deploymentConfig.getElementType().equals("Sepa")) {
- DataProcessorDescription sepa = GsonSerializer.getGsonWithIds().fromJson(model, DataProcessorDescription.class);
- success = StorageManager.INSTANCE.getPipelineElementStorage().deleteDataProcessor(sepa.getElementId());
- StorageManager.INSTANCE.getPipelineElementStorage().storeDataProcessor(sepa);
- } else {
- DataSinkDescription sec = new DataSinkDescription(GsonSerializer.getGsonWithIds().fromJson(model, DataSinkDescription.class));
- success = StorageManager.INSTANCE.getPipelineElementStorage().update(sec);
- }
-
- if (success) return ok(Notifications.success("Element description updated."));
- else return ok(Notifications.error("Could not update element description."));
-
- }
-
- @POST
- @Path("/description/java")
- @Produces(MediaType.TEXT_PLAIN)
- @Consumes(MediaType.MULTIPART_FORM_DATA)
- public Response getDescription(@FormDataParam("config") String config, @FormDataParam("model") String model) {
-
- DeploymentConfiguration deploymentConfig = fromJson(config);
-
- NamedStreamPipesEntity element = getElement(deploymentConfig, model);
-
- //String java = CodeGenerator.getCodeGenerator(deploymentConfig, element).getDeclareModel();
-
- try {
-
- return Response.ok().build();
- } catch (IllegalArgumentException | SecurityException e) {
- e.printStackTrace();
- return Response.serverError().build();
- }
- }
-
- private DeploymentConfiguration fromJson(String config) {
- return GsonSerializer.getGson().fromJson(config, DeploymentConfiguration.class);
- }
-
- private String makeName(String name) {
- return name.replaceAll(" ", "_").toLowerCase();
- }
-}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/MeasurementUnitResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/MeasurementUnitResource.java
index d0b6de1f1..50682b02f 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/MeasurementUnitResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/MeasurementUnitResource.java
@@ -17,7 +17,6 @@
package org.apache.streampipes.rest.impl;
import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.units.UnitProvider;
@@ -41,7 +40,7 @@ public class MeasurementUnitResource extends AbstractRestResource {
@GET
@Path("/{measurementResourceUri}")
@Produces(MediaType.APPLICATION_JSON)
- @GsonWithIds
+ @JacksonSerialized
public Response getMeasurementUnitInfo(@PathParam("measurementResourceUri") String measurementResourceUri) {
return ok(UnitProvider.INSTANCE.getUnit(measurementResourceUri));
}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ExtensionsServiceEndpointResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ExtensionsServiceEndpointResource.java
index 80050c10e..18a20acff 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ExtensionsServiceEndpointResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ExtensionsServiceEndpointResource.java
@@ -27,7 +27,7 @@ import org.apache.streampipes.model.client.endpoint.ExtensionsServiceEndpoint;
import org.apache.streampipes.model.client.endpoint.ExtensionsServiceEndpointItem;
import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
import org.apache.streampipes.rest.security.AuthConstants;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
+import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.sdk.utils.Assets;
import org.apache.streampipes.storage.api.IExtensionsServiceEndpointStorage;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -48,7 +48,7 @@ public class ExtensionsServiceEndpointResource extends AbstractAuthGuardedRestRe
@GET
@Produces(MediaType.APPLICATION_JSON)
- @GsonWithIds
+ @JacksonSerialized
public Response getAllEndpoints() {
//TODO: return the endpoint of passing services
return ok(getEndpoints());
@@ -56,7 +56,7 @@ public class ExtensionsServiceEndpointResource extends AbstractAuthGuardedRestRe
@POST
@Produces(MediaType.APPLICATION_JSON)
- @GsonWithIds
+ @JacksonSerialized
public Response addRdfEndpoint(ExtensionsServiceEndpoint extensionsServiceEndpoint) {
getRdfEndpointStorage()
.addExtensionsServiceEndpoint(extensionsServiceEndpoint);
@@ -69,7 +69,7 @@ public class ExtensionsServiceEndpointResource extends AbstractAuthGuardedRestRe
@Path("/{rdfEndpointId}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
- @GsonWithIds
+ @JacksonSerialized
public Response removeRdfEndpoint(@PathParam("rdfEndpointId") String rdfEndpointId) {
getRdfEndpointStorage()
.removeExtensionsServiceEndpoint(rdfEndpointId);
@@ -80,7 +80,7 @@ public class ExtensionsServiceEndpointResource extends AbstractAuthGuardedRestRe
@GET
@Path("/items")
@Produces(MediaType.APPLICATION_JSON)
- @GsonWithIds
+ @JacksonSerialized
public Response getEndpointContents() {
List<ExtensionsServiceEndpoint> endpoints = getEndpoints();
String username = getAuthenticatedUsername();
diff --git a/streampipes-rest/src/test/java/org/apache/streampipes/rest/v2/DeploymentTest.java b/streampipes-rest/src/test/java/org/apache/streampipes/rest/v2/DeploymentTest.java
deleted file mode 100644
index 7c11527b7..000000000
--- a/streampipes-rest/src/test/java/org/apache/streampipes/rest/v2/DeploymentTest.java
+++ /dev/null
@@ -1,63 +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.v2;
-
-import org.apache.streampipes.model.client.deployment.ElementType;
-import org.apache.streampipes.model.graph.DataSinkDescription;
-import org.apache.streampipes.model.graph.DataSourceDescription;
-import org.apache.streampipes.model.graph.DataProcessorDescription;
-import org.apache.streampipes.rest.impl.Deployment;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.*;
-import org.apache.streampipes.model.client.deployment.DeploymentConfiguration;
-
-public class DeploymentTest {
- @Test
- public void getElementSEP() throws Exception {
- DeploymentConfiguration config = new DeploymentConfiguration();
- config.setElementType(ElementType.SEP);
- assertThat(Deployment.getElement(config, "{}"),instanceOf(DataSourceDescription.class));
- }
-
- @Test
- public void getElementSEPA() throws Exception {
- DeploymentConfiguration config = new DeploymentConfiguration();
- config.setElementType(ElementType.SEPA);
- assertThat(Deployment.getElement(config, "{}"),instanceOf(DataProcessorDescription.class));
- }
-
- @Test
- public void getElementSEC() throws Exception {
- DeploymentConfiguration config = new DeploymentConfiguration();
- config.setElementType(ElementType.SEC);
- assertThat(Deployment.getElement(config, "{}"),instanceOf(DataSinkDescription.class));
- }
-
- @Test
- public void getElementNone() throws Exception {
- DeploymentConfiguration config = new DeploymentConfiguration();
- config.setElementType(null);
- assertNull(Deployment.getElement(config, "{}"));
- }
-
-
-
-}
\ No newline at end of file