diff --git a/build.gradle b/build.gradle
index 4e573bd5c..ba2652560 100644
--- a/build.gradle
+++ b/build.gradle
@@ -215,17 +215,117 @@ def getProjectVersion() {
return ver
}
-project('serializers') {
+project('serializers:shared') {
dependencies {
compile project(':common')
compile project(':client')
+ compile group: 'io.pravega', name: 'pravega-client', version: pravegaVersion
+ compile group: 'org.xerial.snappy', name: 'snappy-java', version: snappyVersion
+ testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
+ testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
+ testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
+ }
+
+ javadoc {
+ title = "Serializers shared"
+ dependsOn delombok
+ source = delombok.outputDir
+ failOnError = true
+ exclude "**/impl/**";
+ options.addBooleanOption("Xdoclint:all,-reference", true)
+ }
+}
+
+project('serializers:avro') {
+ dependencies {
+ compile project(':serializers:shared')
compile group: 'org.apache.avro', name: 'avro', version: avroVersion
+ testCompile project(path:':serializers:shared', configuration:'testRuntime')
+ testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
+ testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
+ testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
+ }
+
+ javadoc {
+ title = "Serializers avro"
+ dependsOn delombok
+ source = delombok.outputDir
+ failOnError = true
+ exclude "**/impl/**";
+ options.addBooleanOption("Xdoclint:all,-reference", true)
+ }
+
+ jar {
+ from {
+ configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
+ }
+ }
+}
+
+project('serializers:protobuf') {
+ dependencies {
+ compile project(':serializers:shared')
compile group: 'com.google.protobuf', name: 'protobuf-java', version: protobufProtocVersion
compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: protobufUtilVersion
- compile group: 'io.pravega', name: 'pravega-client', version: pravegaVersion
- compile group: 'org.xerial.snappy', name: 'snappy-java', version: snappyVersion
- compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-jsonSchema', version: jacksonVersion
+ testCompile project(path:':serializers:shared', configuration:'testRuntime')
+ testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
+ testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
+ testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
+ }
+
+ javadoc {
+ title = "Serializers protobuf"
+ dependsOn delombok
+ source = delombok.outputDir
+ failOnError = true
+ exclude "**/impl/**";
+ options.addBooleanOption("Xdoclint:all,-reference", true)
+ }
+
+ jar {
+ from {
+ configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
+ }
+ }
+}
+
+project('serializers:json') {
+ dependencies {
+ compile project(':serializers:shared')
compile group: 'com.github.everit-org.json-schema', name: 'org.everit.json.schema', version: everitVersion
+ compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-jsonSchema', version: jacksonVersion
+ testCompile project(path:':serializers:shared', configuration:'testRuntime')
+ testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
+ testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
+ testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
+ }
+
+ javadoc {
+ title = "Serializers json"
+ dependsOn delombok
+ source = delombok.outputDir
+ failOnError = true
+ exclude "**/impl/**";
+ options.addBooleanOption("Xdoclint:all,-reference", true)
+ }
+
+ jar {
+ from {
+ configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
+ }
+ }
+}
+
+project('serializers') {
+ dependencies {
+ compile project(':serializers:avro')
+ compile project(':serializers:protobuf')
+ compile project(':serializers:json')
+ compile group: 'org.xerial.snappy', name: 'snappy-java', version: snappyVersion
+ testCompile project(path:':serializers:shared', configuration:'testRuntime')
+ testCompile files(project(':serializers:avro').sourceSets.test.output)
+ testCompile files(project(':serializers:protobuf').sourceSets.test.output)
+ testCompile files(project(':serializers:json').sourceSets.test.output)
testCompile group: 'org.slf4j', name: 'log4j-over-slf4j', version: slf4jApiVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: qosLogbackVersion
testCompile group: 'io.pravega', name: 'pravega-test-testcommon', version: pravegaVersion
@@ -242,6 +342,8 @@ project('serializers') {
jar {
manifest {}
+ // add zip64=true so that we are able to pack more than 65k files in the jar.
+ zip64=true
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
@@ -393,6 +495,10 @@ task publishAllJars() {
dependsOn ':common:publish'
dependsOn ':contract:publish'
dependsOn ':server:publish'
+ dependsOn ':serializers:shared:publish'
+ dependsOn ':serializers:avro:publish'
+ dependsOn ':serializers:json:publish'
+ dependsOn ':serializers:protobuf:publish'
dependsOn ':serializers:publish'
}
diff --git a/checkstyle/spotbugs-exclude.xml b/checkstyle/spotbugs-exclude.xml
index 31efb43d4..86d7bd69a 100644
--- a/checkstyle/spotbugs-exclude.xml
+++ b/checkstyle/spotbugs-exclude.xml
@@ -6,7 +6,10 @@
-
+
+
+
+
diff --git a/gradle/maven.gradle b/gradle/maven.gradle
index 2bc88598c..e4fbd4aa8 100644
--- a/gradle/maven.gradle
+++ b/gradle/maven.gradle
@@ -39,7 +39,7 @@ plugins.withId('maven') {
}
}
- pom.artifactId = project.path.replace(':', '')
+ pom.artifactId = project.path.replaceFirst(':', '').replace(':', '-')
pom.project {
name "Pravega"
url "http://pravega.io"
@@ -80,7 +80,7 @@ plugins.withId('maven') {
install {
repositories {
mavenInstaller {
- pom.artifactId = project.path.replace(':', '')
+ pom.artifactId = project.path.replaceFirst(':', '').replace(':', '-')
}
}
}
diff --git a/serializers/src/main/java/io/pravega/schemaregistry/serializers/AvroDeserializer.java b/serializers/avro/src/main/java/io/pravega/schemaregistry/serializer/avro/impl/AvroDeserializer.java
similarity index 84%
rename from serializers/src/main/java/io/pravega/schemaregistry/serializers/AvroDeserializer.java
rename to serializers/avro/src/main/java/io/pravega/schemaregistry/serializer/avro/impl/AvroDeserializer.java
index a8db6971b..d73bd2832 100644
--- a/serializers/src/main/java/io/pravega/schemaregistry/serializers/AvroDeserializer.java
+++ b/serializers/avro/src/main/java/io/pravega/schemaregistry/serializer/avro/impl/AvroDeserializer.java
@@ -7,13 +7,16 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
-package io.pravega.schemaregistry.serializers;
+package io.pravega.schemaregistry.serializer.avro.impl;
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
+import io.pravega.schemaregistry.serializer.avro.schemas.AvroSchema;
import io.pravega.schemaregistry.client.SchemaRegistryClient;
import io.pravega.schemaregistry.contract.data.SchemaInfo;
-import io.pravega.schemaregistry.schemas.AvroSchema;
+import io.pravega.schemaregistry.serializer.shared.impl.AbstractDeserializer;
+import io.pravega.schemaregistry.serializer.shared.impl.EncodingCache;
+import io.pravega.schemaregistry.serializer.shared.impl.SerializerConfig;
import org.apache.avro.Schema;
import org.apache.avro.io.BinaryDecoder;
import org.apache.avro.io.DecoderFactory;
@@ -39,7 +42,7 @@ class AvroDeserializer extends AbstractDeserializer {
}
@Override
- protected T deserialize(InputStream inputStream, SchemaInfo writerSchemaInfo, SchemaInfo readerSchemaInfo) throws IOException {
+ public final T deserialize(InputStream inputStream, SchemaInfo writerSchemaInfo, SchemaInfo readerSchemaInfo) throws IOException {
Preconditions.checkNotNull(writerSchemaInfo);
Schema writerSchema;
if (knownSchemas.containsKey(writerSchemaInfo)) {
diff --git a/serializers/src/main/java/io/pravega/schemaregistry/serializers/AvroGenericDeserializer.java b/serializers/avro/src/main/java/io/pravega/schemaregistry/serializer/avro/impl/AvroGenericDeserializer.java
similarity index 70%
rename from serializers/src/main/java/io/pravega/schemaregistry/serializers/AvroGenericDeserializer.java
rename to serializers/avro/src/main/java/io/pravega/schemaregistry/serializer/avro/impl/AvroGenericDeserializer.java
index 77af89edf..5cd0e23ca 100644
--- a/serializers/src/main/java/io/pravega/schemaregistry/serializers/AvroGenericDeserializer.java
+++ b/serializers/avro/src/main/java/io/pravega/schemaregistry/serializer/avro/impl/AvroGenericDeserializer.java
@@ -7,12 +7,15 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
-package io.pravega.schemaregistry.serializers;
+package io.pravega.schemaregistry.serializer.avro.impl;
import com.google.common.base.Preconditions;
+import io.pravega.schemaregistry.serializer.avro.schemas.AvroSchema;
import io.pravega.schemaregistry.client.SchemaRegistryClient;
import io.pravega.schemaregistry.contract.data.SchemaInfo;
-import io.pravega.schemaregistry.schemas.AvroSchema;
+import io.pravega.schemaregistry.serializer.shared.impl.AbstractDeserializer;
+import io.pravega.schemaregistry.serializer.shared.impl.EncodingCache;
+import io.pravega.schemaregistry.serializer.shared.impl.SerializerConfig;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.io.BinaryDecoder;
@@ -23,17 +26,17 @@
import java.io.InputStream;
import java.util.concurrent.ConcurrentHashMap;
-class AvroGenericDeserializer extends AbstractDeserializer