From d2a1fc13a0ca9970a0b5eedb1f4d793ee93d6f6d Mon Sep 17 00:00:00 2001 From: Artem Vysochyn Date: Wed, 9 Oct 2024 10:43:24 +0300 Subject: [PATCH] Drop protostuff from dependencies (#855) --- pom.xml | 23 ------- services-examples/pom.xml | 5 -- services-transport-parent/pom.xml | 1 - .../services-transport-protostuff/pom.xml | 34 --------- .../transport/protostuff/ProtostuffCodec.java | 69 ------------------- ...scalecube.services.transport.api.DataCodec | 1 - ...lecube.services.transport.api.HeadersCodec | 1 - services/pom.xml | 6 -- 8 files changed, 140 deletions(-) delete mode 100644 services-transport-parent/services-transport-protostuff/pom.xml delete mode 100644 services-transport-parent/services-transport-protostuff/src/main/java/io/scalecube/services/transport/protostuff/ProtostuffCodec.java delete mode 100644 services-transport-parent/services-transport-protostuff/src/main/resources/META-INF/services/io.scalecube.services.transport.api.DataCodec delete mode 100644 services-transport-parent/services-transport-protostuff/src/main/resources/META-INF/services/io.scalecube.services.transport.api.HeadersCodec diff --git a/pom.xml b/pom.xml index 94c61f3f5..561e11a3d 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,6 @@ 2.18.0 4.1.93.Final 1.1.4 - 1.6.0 3.0.2 2.1.2 @@ -167,28 +166,6 @@ import - - - io.protostuff - protostuff-api - ${protostuff.version} - - - io.protostuff - protostuff-core - ${protostuff.version} - - - io.protostuff - protostuff-collectionschema - ${protostuff.version} - - - io.protostuff - protostuff-runtime - ${protostuff.version} - - org.jctools diff --git a/services-examples/pom.xml b/services-examples/pom.xml index 5c590bef1..308a04496 100644 --- a/services-examples/pom.xml +++ b/services-examples/pom.xml @@ -28,11 +28,6 @@ scalecube-services-transport-jackson ${project.version} - - io.scalecube - scalecube-services-transport-protostuff - ${project.version} - io.scalecube diff --git a/services-transport-parent/pom.xml b/services-transport-parent/pom.xml index 1c2e04f0a..0403ac0dd 100644 --- a/services-transport-parent/pom.xml +++ b/services-transport-parent/pom.xml @@ -13,7 +13,6 @@ services-transport-jackson - services-transport-protostuff services-transport-rsocket diff --git a/services-transport-parent/services-transport-protostuff/pom.xml b/services-transport-parent/services-transport-protostuff/pom.xml deleted file mode 100644 index 5b85620ba..000000000 --- a/services-transport-parent/services-transport-protostuff/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - - scalecube-services-transport-parent - io.scalecube - 2.11.3-SNAPSHOT - - - scalecube-services-transport-protostuff - - - - io.scalecube - scalecube-services-api - ${project.version} - - - - io.protostuff - protostuff-core - - - io.protostuff - protostuff-collectionschema - - - io.protostuff - protostuff-runtime - - - - diff --git a/services-transport-parent/services-transport-protostuff/src/main/java/io/scalecube/services/transport/protostuff/ProtostuffCodec.java b/services-transport-parent/services-transport-protostuff/src/main/java/io/scalecube/services/transport/protostuff/ProtostuffCodec.java deleted file mode 100644 index ecd5c2369..000000000 --- a/services-transport-parent/services-transport-protostuff/src/main/java/io/scalecube/services/transport/protostuff/ProtostuffCodec.java +++ /dev/null @@ -1,69 +0,0 @@ -package io.scalecube.services.transport.protostuff; - -import io.protostuff.LinkedBuffer; -import io.protostuff.ProtobufIOUtil; -import io.protostuff.ProtostuffIOUtil; -import io.protostuff.Schema; -import io.protostuff.StringMapSchema; -import io.protostuff.runtime.RuntimeSchema; -import io.scalecube.services.exceptions.MessageCodecException; -import io.scalecube.services.transport.api.DataCodec; -import io.scalecube.services.transport.api.HeadersCodec; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; - -public final class ProtostuffCodec implements HeadersCodec, DataCodec { - - public static final String CONTENT_TYPE = "application/protostuff"; - - @Override - public String contentType() { - return CONTENT_TYPE; - } - - @Override - public void encode(OutputStream stream, Object value) throws IOException { - //noinspection rawtypes - Schema schema = RuntimeSchema.getSchema(value.getClass()); - //noinspection unchecked - ProtobufIOUtil.writeTo(stream, value, schema, LinkedBuffer.allocate()); - } - - @Override - public void encode(OutputStream stream, Map headers) throws IOException { - ProtostuffIOUtil.writeTo( - stream, headers, StringMapSchema.VALUE_STRING, LinkedBuffer.allocate()); - } - - @Override - public Object decode(InputStream stream, Type type) throws IOException { - try { - Class clazz = null; - if (type instanceof Class) { - clazz = (Class) type; - } else if (type instanceof ParameterizedType) { - clazz = Class.forName(((ParameterizedType) type).getRawType().getTypeName()); - } - //noinspection rawtypes - Schema schema = RuntimeSchema.getSchema(clazz); - Object result = schema.newMessage(); - //noinspection unchecked - ProtobufIOUtil.mergeFrom(stream, result, schema, LinkedBuffer.allocate()); - return result; - } catch (ClassNotFoundException e) { - throw new MessageCodecException("Couldn't decode message", e); - } - } - - @Override - public Map decode(InputStream stream) throws IOException { - HashMap map = new HashMap<>(); - ProtostuffIOUtil.mergeFrom(stream, map, StringMapSchema.VALUE_STRING, LinkedBuffer.allocate()); - return map; - } -} diff --git a/services-transport-parent/services-transport-protostuff/src/main/resources/META-INF/services/io.scalecube.services.transport.api.DataCodec b/services-transport-parent/services-transport-protostuff/src/main/resources/META-INF/services/io.scalecube.services.transport.api.DataCodec deleted file mode 100644 index f001eb69a..000000000 --- a/services-transport-parent/services-transport-protostuff/src/main/resources/META-INF/services/io.scalecube.services.transport.api.DataCodec +++ /dev/null @@ -1 +0,0 @@ -io.scalecube.services.transport.protostuff.ProtostuffCodec diff --git a/services-transport-parent/services-transport-protostuff/src/main/resources/META-INF/services/io.scalecube.services.transport.api.HeadersCodec b/services-transport-parent/services-transport-protostuff/src/main/resources/META-INF/services/io.scalecube.services.transport.api.HeadersCodec deleted file mode 100644 index f001eb69a..000000000 --- a/services-transport-parent/services-transport-protostuff/src/main/resources/META-INF/services/io.scalecube.services.transport.api.HeadersCodec +++ /dev/null @@ -1 +0,0 @@ -io.scalecube.services.transport.protostuff.ProtostuffCodec diff --git a/services/pom.xml b/services/pom.xml index 9f9b7e804..606c76fd2 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -50,12 +50,6 @@ ${project.version} test - - io.scalecube - scalecube-services-transport-protostuff - ${project.version} - test - org.apache.logging.log4j