Serialization extensions assembly naming convention for the generator POLYGENE-231
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/b7f30354 Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/b7f30354 Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/b7f30354 Branch: refs/heads/develop Commit: b7f30354f47e273d8b39eebb5fe2d977f982684c Parents: d219707 Author: Paul Merlin <[email protected]> Authored: Mon Mar 13 15:46:48 2017 +0100 Committer: Paul Merlin <[email protected]> Committed: Sun Apr 2 19:16:24 2017 +0200 ---------------------------------------------------------------------- .../JavaxJsonSerializationAssembler.java | 59 ---- .../JavaxJsonSerializationAssembler.java | 61 ++++ .../javaxjson/assembly/package.html | 24 ++ .../javaxjson/CustomJsonAdapterTest.java | 1 + .../JavaxJsonPlainValueSerializationTest.java | 1 + ...avaxJsonValueCompositeSerializationTest.java | 1 + .../JavaxXmlSerializationAssembler.java | 59 ---- .../JavaxXmlSerializationAssembler.java | 61 ++++ .../javaxxml/assembly/package.html | 24 ++ .../javaxxml/JavaxXmlAdaptersTest.java | 1 + .../javaxxml/JavaxXmlCollectionTest.java | 1 + ...avaxXmlConfigurationDeserializationTest.java | 1 + .../JavaxXmlPlainValueSerializationTest.java | 1 + ...JavaxXmlValueCompositeSerializationTest.java | 1 + .../serialization-messagepack/build.gradle | 36 +++ .../serialization-messagepack/dev-status.xml | 38 +++ .../src/docs/serialization-messagepack.txt | 43 +++ .../messagepack/MessagePackAdapter.java | 57 ++++ .../messagepack/MessagePackAdapters.java | 269 ++++++++++++++++ .../messagepack/MessagePackDeserializer.java | 313 +++++++++++++++++++ .../messagepack/MessagePackSerialization.java | 22 ++ .../messagepack/MessagePackSerializer.java | 202 ++++++++++++ .../messagepack/MessagePackSettings.java | 45 +++ .../MessagePackSerializationAssembler.java | 54 ++++ .../messagepack/assembly/package.html | 24 ++ .../serialization/messagepack/package.html | 24 ++ .../MessagePackCollectionSerializationTest.java | 32 ++ .../MessagePackPlainValueSerializationTest.java | 43 +++ ...sagePackValueCompositeSerializationTest.java | 36 +++ extensions/serialization-msgpack/build.gradle | 36 --- extensions/serialization-msgpack/dev-status.xml | 38 --- .../src/docs/serialization-msgpack.txt | 43 --- .../msgpack/MessagePackAdapter.java | 57 ---- .../msgpack/MessagePackAdapters.java | 269 ---------------- .../msgpack/MessagePackDeserializer.java | 313 ------------------- .../msgpack/MessagePackSerialization.java | 22 -- .../MessagePackSerializationAssembler.java | 52 --- .../msgpack/MessagePackSerializer.java | 202 ------------ .../msgpack/MessagePackSettings.java | 45 --- .../polygene/serialization/msgpack/package.html | 24 -- .../MessagePackCollectionSerializationTest.java | 31 -- .../MessagePackPlainValueSerializationTest.java | 42 --- ...sagePackValueCompositeSerializationTest.java | 35 --- manual/src/docs/userguide/extensions.txt | 3 +- settings.gradle | 2 +- tools/generator-polygene/app/index.js | 7 +- tools/generator-polygene/test/generator_test.js | 5 +- 47 files changed, 1425 insertions(+), 1335 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonSerializationAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonSerializationAssembler.java b/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonSerializationAssembler.java deleted file mode 100644 index 16e2029..0000000 --- a/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonSerializationAssembler.java +++ /dev/null @@ -1,59 +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.polygene.serialization.javaxjson; - -import org.apache.polygene.api.serialization.Deserializer; -import org.apache.polygene.api.serialization.Serialization; -import org.apache.polygene.api.serialization.Serializer; -import org.apache.polygene.bootstrap.Assemblers; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.ServiceDeclaration; -import org.apache.polygene.spi.serialization.JsonDeserializer; -import org.apache.polygene.spi.serialization.JsonSerialization; -import org.apache.polygene.spi.serialization.JsonSerializer; - -public class JavaxJsonSerializationAssembler extends Assemblers.VisibilityIdentity<JavaxJsonSerializationAssembler> -{ - private JavaxJsonSettings settings; - - public JavaxJsonSerializationAssembler withJsonSettings( JavaxJsonSettings settings ) - { - this.settings = settings; - return this; - } - - @Override - public void assemble( ModuleAssembly module ) - { - ServiceDeclaration declaration = module.services( JavaxJsonSerialization.class ) - .withTypes( Serialization.class, - Serializer.class, Deserializer.class, - JsonSerialization.class, - JsonSerializer.class, JsonDeserializer.class ) - .taggedWith( Serialization.Format.JSON ) - .visibleIn( visibility() ); - if( hasIdentity() ) - { - declaration.identifiedBy( identity() ); - } - if( settings != null ) - { - declaration.setMetaInfo( settings ); - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/assembly/JavaxJsonSerializationAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/assembly/JavaxJsonSerializationAssembler.java b/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/assembly/JavaxJsonSerializationAssembler.java new file mode 100644 index 0000000..5df8ae6 --- /dev/null +++ b/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/assembly/JavaxJsonSerializationAssembler.java @@ -0,0 +1,61 @@ +/* + * 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.polygene.serialization.javaxjson.assembly; + +import org.apache.polygene.api.serialization.Deserializer; +import org.apache.polygene.api.serialization.Serialization; +import org.apache.polygene.api.serialization.Serializer; +import org.apache.polygene.bootstrap.Assemblers; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.bootstrap.ServiceDeclaration; +import org.apache.polygene.serialization.javaxjson.JavaxJsonSerialization; +import org.apache.polygene.serialization.javaxjson.JavaxJsonSettings; +import org.apache.polygene.spi.serialization.JsonDeserializer; +import org.apache.polygene.spi.serialization.JsonSerialization; +import org.apache.polygene.spi.serialization.JsonSerializer; + +public class JavaxJsonSerializationAssembler extends Assemblers.VisibilityIdentity<JavaxJsonSerializationAssembler> +{ + private JavaxJsonSettings settings; + + public JavaxJsonSerializationAssembler withJsonSettings( JavaxJsonSettings settings ) + { + this.settings = settings; + return this; + } + + @Override + public void assemble( ModuleAssembly module ) + { + ServiceDeclaration declaration = module.services( JavaxJsonSerialization.class ) + .withTypes( Serialization.class, + Serializer.class, Deserializer.class, + JsonSerialization.class, + JsonSerializer.class, JsonDeserializer.class ) + .taggedWith( Serialization.Format.JSON ) + .visibleIn( visibility() ); + if( hasIdentity() ) + { + declaration.identifiedBy( identity() ); + } + if( settings != null ) + { + declaration.setMetaInfo( settings ); + } + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/assembly/package.html ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/assembly/package.html b/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/assembly/package.html new file mode 100644 index 0000000..06888ed --- /dev/null +++ b/extensions/serialization-javaxjson/src/main/java/org/apache/polygene/serialization/javaxjson/assembly/package.html @@ -0,0 +1,24 @@ +<!-- + ~ 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. + ~ + ~ + --> +<html> + <body> + <h2>javax.json Serialization Assembly.</h2> + </body> +</html> http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/CustomJsonAdapterTest.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/CustomJsonAdapterTest.java b/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/CustomJsonAdapterTest.java index acd96b6..c03c3a8 100644 --- a/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/CustomJsonAdapterTest.java +++ b/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/CustomJsonAdapterTest.java @@ -31,6 +31,7 @@ import org.apache.polygene.api.type.ValueCompositeType; import org.apache.polygene.api.type.ValueType; import org.apache.polygene.api.value.ValueBuilder; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.serialization.javaxjson.assembly.JavaxJsonSerializationAssembler; import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonPlainValueSerializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonPlainValueSerializationTest.java b/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonPlainValueSerializationTest.java index 887c555..e099f22 100644 --- a/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonPlainValueSerializationTest.java +++ b/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonPlainValueSerializationTest.java @@ -20,6 +20,7 @@ package org.apache.polygene.serialization.javaxjson; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.serialization.javaxjson.assembly.JavaxJsonSerializationAssembler; import org.apache.polygene.test.serialization.AbstractPlainValueSerializationTest; public class JavaxJsonPlainValueSerializationTest extends AbstractPlainValueSerializationTest http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonValueCompositeSerializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonValueCompositeSerializationTest.java b/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonValueCompositeSerializationTest.java index 404a143..34b81c5 100644 --- a/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonValueCompositeSerializationTest.java +++ b/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonValueCompositeSerializationTest.java @@ -24,6 +24,7 @@ import javax.json.JsonValue; import org.apache.polygene.api.injection.scope.Service; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.serialization.javaxjson.assembly.JavaxJsonSerializationAssembler; import org.apache.polygene.spi.serialization.JsonSerialization; import org.apache.polygene.test.serialization.AbstractValueCompositeSerializationTest; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/JavaxXmlSerializationAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/JavaxXmlSerializationAssembler.java b/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/JavaxXmlSerializationAssembler.java deleted file mode 100644 index a543dce..0000000 --- a/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/JavaxXmlSerializationAssembler.java +++ /dev/null @@ -1,59 +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.polygene.serialization.javaxxml; - -import org.apache.polygene.api.serialization.Deserializer; -import org.apache.polygene.api.serialization.Serialization; -import org.apache.polygene.api.serialization.Serializer; -import org.apache.polygene.bootstrap.Assemblers; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.bootstrap.ServiceDeclaration; -import org.apache.polygene.spi.serialization.XmlDeserializer; -import org.apache.polygene.spi.serialization.XmlSerialization; -import org.apache.polygene.spi.serialization.XmlSerializer; - -public class JavaxXmlSerializationAssembler extends Assemblers.VisibilityIdentity<JavaxXmlSerializationAssembler> -{ - private JavaxXmlSettings settings; - - public JavaxXmlSerializationAssembler withXmlSettings( JavaxXmlSettings settings ) - { - this.settings = settings; - return this; - } - - @Override - public void assemble( ModuleAssembly module ) - { - ServiceDeclaration declaration = module.services( JavaxXmlSerialization.class ) - .withTypes( Serialization.class, - Serializer.class, Deserializer.class, - XmlSerialization.class, - XmlSerializer.class, XmlDeserializer.class ) - .taggedWith( Serialization.Format.XML ) - .visibleIn( visibility() ); - if( hasIdentity() ) - { - declaration.identifiedBy( identity() ); - } - if( settings != null ) - { - declaration.setMetaInfo( settings ); - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/assembly/JavaxXmlSerializationAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/assembly/JavaxXmlSerializationAssembler.java b/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/assembly/JavaxXmlSerializationAssembler.java new file mode 100644 index 0000000..e7af0af --- /dev/null +++ b/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/assembly/JavaxXmlSerializationAssembler.java @@ -0,0 +1,61 @@ +/* + * 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.polygene.serialization.javaxxml.assembly; + +import org.apache.polygene.api.serialization.Deserializer; +import org.apache.polygene.api.serialization.Serialization; +import org.apache.polygene.api.serialization.Serializer; +import org.apache.polygene.bootstrap.Assemblers; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.bootstrap.ServiceDeclaration; +import org.apache.polygene.serialization.javaxxml.JavaxXmlSerialization; +import org.apache.polygene.serialization.javaxxml.JavaxXmlSettings; +import org.apache.polygene.spi.serialization.XmlDeserializer; +import org.apache.polygene.spi.serialization.XmlSerialization; +import org.apache.polygene.spi.serialization.XmlSerializer; + +public class JavaxXmlSerializationAssembler extends Assemblers.VisibilityIdentity<JavaxXmlSerializationAssembler> +{ + private JavaxXmlSettings settings; + + public JavaxXmlSerializationAssembler withXmlSettings( JavaxXmlSettings settings ) + { + this.settings = settings; + return this; + } + + @Override + public void assemble( ModuleAssembly module ) + { + ServiceDeclaration declaration = module.services( JavaxXmlSerialization.class ) + .withTypes( Serialization.class, + Serializer.class, Deserializer.class, + XmlSerialization.class, + XmlSerializer.class, XmlDeserializer.class ) + .taggedWith( Serialization.Format.XML ) + .visibleIn( visibility() ); + if( hasIdentity() ) + { + declaration.identifiedBy( identity() ); + } + if( settings != null ) + { + declaration.setMetaInfo( settings ); + } + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/assembly/package.html ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/assembly/package.html b/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/assembly/package.html new file mode 100644 index 0000000..fa00039 --- /dev/null +++ b/extensions/serialization-javaxxml/src/main/java/org/apache/polygene/serialization/javaxxml/assembly/package.html @@ -0,0 +1,24 @@ +<!-- + ~ 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. + ~ + ~ + --> +<html> + <body> + <h2>javax.xml Serialization Assembly.</h2> + </body> +</html> http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlAdaptersTest.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlAdaptersTest.java b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlAdaptersTest.java index bf37395..921c214 100644 --- a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlAdaptersTest.java +++ b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlAdaptersTest.java @@ -4,6 +4,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.polygene.api.injection.scope.Service; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.serialization.javaxxml.assembly.JavaxXmlSerializationAssembler; import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.w3c.dom.Document; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlCollectionTest.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlCollectionTest.java b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlCollectionTest.java index 5f0bf3c..a78ea9b 100644 --- a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlCollectionTest.java +++ b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlCollectionTest.java @@ -18,6 +18,7 @@ package org.apache.polygene.serialization.javaxxml; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.serialization.javaxxml.assembly.JavaxXmlSerializationAssembler; import org.apache.polygene.test.serialization.AbstractCollectionSerializationTest; public class JavaxXmlCollectionTest extends AbstractCollectionSerializationTest http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlConfigurationDeserializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlConfigurationDeserializationTest.java b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlConfigurationDeserializationTest.java index f87c396..2a1fbfb 100644 --- a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlConfigurationDeserializationTest.java +++ b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlConfigurationDeserializationTest.java @@ -1,6 +1,7 @@ package org.apache.polygene.serialization.javaxxml; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.serialization.javaxxml.assembly.JavaxXmlSerializationAssembler; import org.apache.polygene.test.entity.AbstractConfigurationDeserializationTest; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlPlainValueSerializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlPlainValueSerializationTest.java b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlPlainValueSerializationTest.java index 4d0b07e..8de45f5 100644 --- a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlPlainValueSerializationTest.java +++ b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlPlainValueSerializationTest.java @@ -24,6 +24,7 @@ import java.util.Optional; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.serialization.javaxxml.assembly.JavaxXmlSerializationAssembler; import org.apache.polygene.test.serialization.AbstractPlainValueSerializationTest; import org.w3c.dom.Document; import org.w3c.dom.Element; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlValueCompositeSerializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlValueCompositeSerializationTest.java b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlValueCompositeSerializationTest.java index b86a2dc..dc910fc 100644 --- a/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlValueCompositeSerializationTest.java +++ b/extensions/serialization-javaxxml/src/test/java/org/apache/polygene/serialization/javaxxml/JavaxXmlValueCompositeSerializationTest.java @@ -20,6 +20,7 @@ package org.apache.polygene.serialization.javaxxml; import org.apache.polygene.api.injection.scope.Service; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.serialization.javaxxml.assembly.JavaxXmlSerializationAssembler; import org.apache.polygene.spi.serialization.XmlSerialization; import org.apache.polygene.test.serialization.AbstractValueCompositeSerializationTest; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/build.gradle b/extensions/serialization-messagepack/build.gradle new file mode 100644 index 0000000..6f51948 --- /dev/null +++ b/extensions/serialization-messagepack/build.gradle @@ -0,0 +1,36 @@ +/* + * 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. + */ + +apply plugin: 'polygene-extension' + +description = "Apache Polygene⢠MessagePack Serialization Extension" + +jar { manifest { name = "Apache Polygene⢠Extension - Serialization - MessagePack" } } + +dependencies { + api polygene.core.bootstrap + api libraries.msgpack + + implementation libraries.commons_lang + + runtimeOnly polygene.core.runtime + + testImplementation polygene.core.testsupport + + testRuntimeOnly libraries.logback +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/dev-status.xml ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/dev-status.xml b/extensions/serialization-messagepack/dev-status.xml new file mode 100644 index 0000000..8086fb0 --- /dev/null +++ b/extensions/serialization-messagepack/dev-status.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ 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. + ~ + ~ + --> +<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1 + http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd"> + <status> + <!--none,early,beta,stable,mature--> + <codebase>early</codebase> + + <!-- none, brief, good, complete --> + <documentation>none</documentation> + + <!-- none, some, good, complete --> + <unittests>some</unittests> + </status> + <licenses> + <license>ALv2</license> + </licenses> +</module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/docs/serialization-messagepack.txt ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/docs/serialization-messagepack.txt b/extensions/serialization-messagepack/src/docs/serialization-messagepack.txt new file mode 100644 index 0000000..b9ebcc3 --- /dev/null +++ b/extensions/serialization-messagepack/src/docs/serialization-messagepack.txt @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////// + * 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. +/////////////////////////////////////////////////////////////// + +[[extension-serialization-messagepack,MessagePack serialization]] += MessagePack serialization = + +[devstatus] +-------------- +source=extensions/serialization-msgpack/dev-status.xml +-------------- + +`Serialization` service backed by http://msgpack.org/[MessagePack] that produce and consume binary payloads. +See <<core-api-serialization>> and <<core-spi-serialization>>. + +include::../../build/docs/buildinfo/artifact.txt[] + +// TODO Include sample model and its output from test code & resources + +== Assembly == + +Assembly is done using the provided Assembler: + +[snippet,java] +---- +source=extensions/serialization-msgpack/src/test/java/org/apache/polygene/serialization/msgpack/MessagePackValueCompositeSerializationTest.java +tag=assembly +---- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackAdapter.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackAdapter.java b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackAdapter.java new file mode 100644 index 0000000..a2a5763 --- /dev/null +++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackAdapter.java @@ -0,0 +1,57 @@ +/* + * 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.polygene.serialization.messagepack; + +import java.io.IOException; +import java.util.function.BiFunction; +import java.util.function.Function; +import org.apache.polygene.api.type.ValueType; +import org.msgpack.value.Value; + +/** + * Adapter for MessagePack (de)serialization. + * + * @param <T> the adapted type + */ +public interface MessagePackAdapter<T> +{ + /** + * @return the adapted type + */ + Class<T> type(); + + /** + * Serialize. + * + * @param object Object to serialize, never null + * @param serialize Serialization function for nested structure serialization + * @return MessagePack Value + */ + Value serialize( Object object, Function<Object, Value> serialize ) + throws IOException; + + /** + * Deserialize. + * + * @param value MessagePack value + * @param deserialize Deserialization function for nested structure deserialization + * @return Deserialized object + */ + T deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + throws IOException; +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackAdapters.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackAdapters.java b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackAdapters.java new file mode 100644 index 0000000..2b16ed7 --- /dev/null +++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackAdapters.java @@ -0,0 +1,269 @@ +/* + * 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.polygene.serialization.messagepack; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.function.BiFunction; +import java.util.function.Function; +import org.apache.polygene.api.injection.scope.This; +import org.apache.polygene.api.injection.scope.Uses; +import org.apache.polygene.api.mixin.Initializable; +import org.apache.polygene.api.mixin.Mixins; +import org.apache.polygene.api.serialization.Converters; +import org.apache.polygene.api.service.ServiceDescriptor; +import org.apache.polygene.api.type.ValueType; +import org.apache.polygene.spi.serialization.BuiltInConverters; +import org.msgpack.value.Value; +import org.msgpack.value.ValueFactory; + +import static org.apache.polygene.api.type.HasTypesCollectors.closestType; +import static org.apache.polygene.serialization.messagepack.MessagePackSettings.orDefault; + +@Mixins( MessagePackAdapters.Mixin.class ) +public interface MessagePackAdapters +{ + void registerAdapter( ValueType valueType, MessagePackAdapter<?> adapter ); + + <T> MessagePackAdapter<T> adapterFor( ValueType valueType ); + + default <T> MessagePackAdapter<T> adapterFor( Class<T> type ) + { + return adapterFor( ValueType.of( type ) ); + } + + class Mixin implements MessagePackAdapters, Initializable + { + private Map<ValueType, MessagePackAdapter<?>> adapters = new LinkedHashMap<>(); + + @Uses + private ServiceDescriptor descriptor; + + @This + private BuiltInConverters builtInConverters; + + @This + private Converters converters; + + @Override + public void initialize() + { + MessagePackSettings settings = orDefault( descriptor.metaInfo( MessagePackSettings.class ) ); + settings.getConverters() + .forEach( ( type, converter ) -> converters.registerConverter( type, converter ) ); + builtInConverters.registerBuiltInConverters( converters ); + settings.getAdapters().forEach( adapters::put ); + registerBaseMessagePackAdapters(); + } + + @Override + public void registerAdapter( ValueType valueType, MessagePackAdapter<?> adapter ) + { + adapters.put( valueType, adapter ); + } + + @Override + public <T> MessagePackAdapter<T> adapterFor( final ValueType valueType ) + { + return castAdapter( adapters.keySet().stream() + .collect( closestType( valueType ) ) + .map( adapters::get ) + .orElse( null ) ); + } + + @SuppressWarnings( "unchecked" ) + private <T> MessagePackAdapter<T> castAdapter( MessagePackAdapter<?> adapter ) + { + return (MessagePackAdapter<T>) adapter; + } + + private void registerBaseMessagePackAdapters() + { + // Primitive Value types + adapters.put( ValueType.STRING, new StringAdapter() ); + adapters.put( ValueType.CHARACTER, new CharacterAdapter() ); + adapters.put( ValueType.BOOLEAN, new BooleanAdapter() ); + adapters.put( ValueType.INTEGER, new IntegerAdapter() ); + adapters.put( ValueType.LONG, new LongAdapter() ); + adapters.put( ValueType.SHORT, new ShortAdapter() ); + adapters.put( ValueType.BYTE, new ByteAdapter() ); + adapters.put( ValueType.FLOAT, new FloatAdapter() ); + adapters.put( ValueType.DOUBLE, new DoubleAdapter() ); + } + + private static abstract class ToStringAdapter<T> implements MessagePackAdapter<T> + { + @Override + public Value serialize( Object object, Function<Object, Value> serialize ) + { + return ValueFactory.newString( object.toString() ); + } + } + + private static class StringAdapter extends ToStringAdapter<String> + { + @Override + public Class<String> type() { return String.class; } + + @Override + public String deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + { + return value.asStringValue().asString(); + } + } + + private static class CharacterAdapter extends ToStringAdapter<Character> + { + @Override + public Class<Character> type() { return Character.class; } + + @Override + public Character deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + { + String string = value.asStringValue().asString(); + return string.isEmpty() ? null : string.charAt( 0 ); + } + } + + private static class BooleanAdapter implements MessagePackAdapter<Boolean> + { + @Override + public Class<Boolean> type() { return Boolean.class; } + + @Override + public Value serialize( Object object, Function<Object, Value> serialize ) + { + return ValueFactory.newBoolean( (Boolean) object ); + } + + @Override + public Boolean deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + { + return value.asBooleanValue().getBoolean(); + } + } + + private static class IntegerAdapter implements MessagePackAdapter<Integer> + { + @Override + public Class<Integer> type() { return Integer.class; } + + @Override + public Value serialize( Object object, Function<Object, Value> serialize ) + { + return ValueFactory.newInteger( (Integer) object ); + } + + @Override + public Integer deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + { + return value.asIntegerValue().asInt(); + } + } + + private static class LongAdapter implements MessagePackAdapter<Long> + { + @Override + public Class<Long> type() { return Long.class; } + + @Override + public Value serialize( Object object, Function<Object, Value> serialize ) + { + return ValueFactory.newInteger( (Long) object ); + } + + @Override + public Long deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + { + return value.asIntegerValue().asLong(); + } + } + + private static class ShortAdapter implements MessagePackAdapter<Short> + { + @Override + public Class<Short> type() { return Short.class; } + + @Override + public Value serialize( Object object, Function<Object, Value> serialize ) + { + return ValueFactory.newInteger( (Short) object ); + } + + @Override + public Short deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + { + return value.asIntegerValue().asShort(); + } + } + + private static class ByteAdapter implements MessagePackAdapter<Byte> + { + @Override + public Class<Byte> type() { return Byte.class; } + + @Override + public Value serialize( Object object, Function<Object, Value> serialize ) + { + return ValueFactory.newInteger( (Byte) object ); + } + + @Override + public Byte deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + { + return value.asIntegerValue().asByte(); + } + } + + private static class FloatAdapter implements MessagePackAdapter<Float> + { + @Override + public Class<Float> type() { return Float.class; } + + @Override + public Value serialize( Object object, Function<Object, Value> serialize ) + { + return ValueFactory.newFloat( (Float) object ); + } + + @Override + public Float deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + { + return value.asFloatValue().toFloat(); + } + } + + private static class DoubleAdapter implements MessagePackAdapter<Double> + { + @Override + public Class<Double> type() { return Double.class; } + + @Override + public Value serialize( Object object, Function<Object, Value> serialize ) + { + return ValueFactory.newFloat( (Double) object ); + } + + @Override + public Double deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize ) + { + return value.asFloatValue().toDouble(); + } + } + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackDeserializer.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackDeserializer.java b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackDeserializer.java new file mode 100644 index 0000000..12cba93 --- /dev/null +++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackDeserializer.java @@ -0,0 +1,313 @@ +/* + * 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.polygene.serialization.messagepack; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Array; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Stream; +import org.apache.polygene.api.association.AssociationDescriptor; +import org.apache.polygene.api.entity.EntityReference; +import org.apache.polygene.api.injection.scope.This; +import org.apache.polygene.api.mixin.Mixins; +import org.apache.polygene.api.property.PropertyDescriptor; +import org.apache.polygene.api.serialization.Converter; +import org.apache.polygene.api.serialization.Converters; +import org.apache.polygene.api.serialization.Deserializer; +import org.apache.polygene.api.serialization.SerializationException; +import org.apache.polygene.api.structure.ModuleDescriptor; +import org.apache.polygene.api.type.ArrayType; +import org.apache.polygene.api.type.CollectionType; +import org.apache.polygene.api.type.EnumType; +import org.apache.polygene.api.type.MapType; +import org.apache.polygene.api.type.ValueCompositeType; +import org.apache.polygene.api.type.ValueType; +import org.apache.polygene.api.value.ValueBuilder; +import org.apache.polygene.api.value.ValueDescriptor; +import org.apache.polygene.spi.serialization.AbstractBinaryDeserializer; +import org.msgpack.core.MessagePack; +import org.msgpack.core.MessageUnpacker; +import org.msgpack.value.ArrayValue; +import org.msgpack.value.ImmutableValue; +import org.msgpack.value.MapValue; +import org.msgpack.value.Value; + +import static java.util.Collections.unmodifiableList; +import static java.util.Collections.unmodifiableMap; +import static java.util.Collections.unmodifiableSet; +import static org.apache.polygene.api.util.Collectors.toMap; + +@Mixins( MessagePackDeserializer.Mixin.class ) +public interface MessagePackDeserializer extends Deserializer +{ + class Mixin extends AbstractBinaryDeserializer + { + @This + private Converters converters; + + @This + private MessagePackAdapters adapters; + + @Override + public <T> T deserialize( ModuleDescriptor module, ValueType valueType, InputStream state ) + { + MessageUnpacker unpacker = MessagePack.newDefaultUnpacker( state ); + try + { + if( !unpacker.hasNext() ) + { + return null; + } + ImmutableValue value = unpacker.unpackValue(); + return doDeserialize( module, valueType, value ); + } + catch( IOException e ) + { + throw new SerializationException( "Unable to deserialize " + valueType ); + } + } + + @SuppressWarnings( "unchecked" ) + private <T> T doDeserialize( ModuleDescriptor module, ValueType valueType, Value value ) + { + try + { + if( value == null || value.isNilValue() ) + { + return null; + } + Converter<Object> converter = converters.converterFor( valueType ); + if( converter != null ) + { + return (T) converter.fromString( doDeserialize( module, ValueType.STRING, value ).toString() ); + } + MessagePackAdapter<?> adapter = adapters.adapterFor( valueType ); + if( adapter != null ) + { + return (T) adapter.deserialize( value, ( val, type ) -> doDeserialize( module, valueType, val ) ); + } + if( EnumType.class.isAssignableFrom( valueType.getClass() ) ) + { + return (T) Enum.valueOf( (Class) valueType.primaryType(), value.asStringValue().asString() ); + } + if( ArrayType.class.isAssignableFrom( valueType.getClass() ) ) + { + return (T) deserializeArray( module, (ArrayType) valueType, value ); + } + if( CollectionType.class.isAssignableFrom( valueType.getClass() ) ) + { + return (T) deserializeCollection( module, (CollectionType) valueType, value.asArrayValue() ); + } + if( MapType.class.isAssignableFrom( valueType.getClass() ) ) + { + return (T) deserializeMap( module, (MapType) valueType, value.asMapValue() ); + } + if( ValueCompositeType.class.isAssignableFrom( valueType.getClass() ) ) + { + return (T) deserializeValueComposite( module, (ValueCompositeType) valueType, value.asMapValue() ); + } + return (T) doGuessDeserialize( module, valueType, value ); + } + catch( IOException | ClassNotFoundException ex ) + { + throw new SerializationException( "Unable to deserialize " + valueType + " from: " + value ); + } + } + + private Object deserializeArray( ModuleDescriptor module, ArrayType arrayType, Value value ) throws IOException + { + if( arrayType.isArrayOfPrimitiveBytes() ) + { + return value.asBinaryValue().asByteArray(); + } + CollectionType collectionType = CollectionType.listOf( arrayType.collectedType() ); + List collection = (List) deserializeCollection( module, collectionType, value.asArrayValue() ); + Object array = Array.newInstance( arrayType.collectedType().primaryType(), collection.size() ); + for( int idx = 0; idx < collection.size(); idx++ ) + { + Array.set( array, idx, collection.get( idx ) ); + } + return array; + } + + private Collection<?> deserializeCollection( ModuleDescriptor module, CollectionType collectionType, + ArrayValue value ) throws IOException + { + Collection<?> collection = collectionType.isSet() ? new LinkedHashSet( value.size() ) + : new ArrayList( value.size() ); + for( Value element : value.list() ) + { + collection.add( doDeserialize( module, collectionType.collectedType(), element ) ); + } + return collection; + } + + private Map<Object, Object> deserializeMap( ModuleDescriptor module, MapType mapType, MapValue value ) + throws IOException + { + Map<Object, Object> map = new LinkedHashMap<>( value.size() ); + for( Map.Entry<Value, Value> entry : value.entrySet() ) + { + Object key = doDeserialize( module, mapType.keyType(), entry.getKey() ); + Object val = doDeserialize( module, mapType.valueType(), entry.getValue() ); + map.put( key, val ); + } + return map; + } + + private Object deserializeValueComposite( ModuleDescriptor module, ValueCompositeType valueType, + MapValue value ) throws IOException + { + Map<String, Value> namedValues = value.map().entrySet().stream().map( + entry -> + { + String key = doDeserialize( module, ValueType.STRING, entry.getKey() ); + return new AbstractMap.SimpleImmutableEntry<>( key, entry.getValue() ); + } + ).collect( toMap( HashMap::new ) ); + + String typeInfo = null; + if( namedValues.containsKey( "_type" ) ) + { + typeInfo = doDeserialize( module, ValueType.STRING, namedValues.get( "_type" ) ); + } + if( typeInfo != null ) + { + ValueDescriptor descriptor = module.valueDescriptor( typeInfo ); + if( descriptor == null ) + { + throw new SerializationException( + "_type: " + typeInfo + " could not be resolved while deserializing " + value ); + } + valueType = descriptor.valueType(); + } + + ValueBuilder builder = module.instance().newValueBuilderWithState( + valueType.primaryType(), + propertyFunction( module, namedValues ), + associationFunction( module, namedValues ), + manyAssociationFunction( module, namedValues ), + namedAssociationFunction( module, namedValues ) ); + return builder.newInstance(); + } + + private Function<PropertyDescriptor, Object> propertyFunction( ModuleDescriptor module, + Map<String, Value> namedValues ) + { + return property -> + { + Value value = namedValues.get( property.qualifiedName().name() ); + if( value != null ) + { + Object propertyValue = doDeserialize( module, property.valueType(), value ); + if( property.isImmutable() ) + { + if( propertyValue instanceof Set ) + { + return unmodifiableSet( (Set<?>) propertyValue ); + } + else if( propertyValue instanceof List ) + { + return unmodifiableList( (List<?>) propertyValue ); + } + else if( propertyValue instanceof Map ) + { + return unmodifiableMap( (Map<?, ?>) propertyValue ); + } + } + return propertyValue; + } + return property.resolveInitialValue( module ); + }; + } + + private Function<AssociationDescriptor, EntityReference> associationFunction( ModuleDescriptor module, + Map<String, Value> namedValues ) + { + return association -> doDeserialize( module, ValueType.ENTITY_REFERENCE, + namedValues.get( association.qualifiedName().name() ) ); + } + + private Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction( + ModuleDescriptor module, Map<String, Value> namedValues ) + { + return association -> + { + List list = doDeserialize( module, ENTITY_REF_LIST_VALUE_TYPE, + namedValues.get( association.qualifiedName().name() ) ); + return list == null ? Stream.empty() : list.stream(); + }; + } + + private Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction( + ModuleDescriptor module, Map<String, Value> namedValues ) + { + return association -> + { + Map map = doDeserialize( module, ENTITY_REF_MAP_VALUE_TYPE, + namedValues.get( association.qualifiedName().name() ) ); + return map == null ? Stream.empty() : map.entrySet().stream(); + }; + } + + private Object doGuessDeserialize( ModuleDescriptor module, ValueType valueType, Value value ) + throws IOException, ClassNotFoundException + { + switch( value.getValueType() ) + { + case BINARY: + return deserializeJava( value.asBinaryValue().asByteArray() ); + case MAP: + MapValue mapValue = value.asMapValue(); + Optional<String> typeInfo = mapValue + .entrySet().stream() + .filter( entry -> entry.getKey().isStringValue() ) + .map( entry -> + { + String key = doDeserialize( module, ValueType.STRING, entry.getKey() ); + return new AbstractMap.SimpleImmutableEntry<>( key, entry.getValue() ); + } ) + .filter( entry -> "_type".equals( entry.getKey() ) ) + .findFirst() + .map( entry -> doDeserialize( module, ValueType.STRING, entry.getValue() ) ); + if( typeInfo.isPresent() ) + { + ValueDescriptor valueDescriptor = module.valueDescriptor( typeInfo.get() ); + if( valueDescriptor != null ) + { + return deserializeValueComposite( module, valueDescriptor.valueType(), mapValue ); + } + } + default: + throw new SerializationException( "Don't know how to deserialize " + valueType + " from " + value + + " (" + value.getValueType() + ")" ); + } + } + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSerialization.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSerialization.java b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSerialization.java new file mode 100644 index 0000000..32b680c --- /dev/null +++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSerialization.java @@ -0,0 +1,22 @@ +/* + * 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.polygene.serialization.messagepack; + +public interface MessagePackSerialization extends MessagePackSerializer, MessagePackDeserializer +{ +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSerializer.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSerializer.java b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSerializer.java new file mode 100644 index 0000000..40b924b --- /dev/null +++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSerializer.java @@ -0,0 +1,202 @@ +/* + * 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.polygene.serialization.messagepack; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Map; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; +import org.apache.polygene.api.PolygeneAPI; +import org.apache.polygene.api.association.AssociationStateHolder; +import org.apache.polygene.api.common.Optional; +import org.apache.polygene.api.composite.CompositeInstance; +import org.apache.polygene.api.injection.scope.This; +import org.apache.polygene.api.mixin.Mixins; +import org.apache.polygene.api.serialization.Converter; +import org.apache.polygene.api.serialization.Converters; +import org.apache.polygene.api.serialization.SerializationException; +import org.apache.polygene.api.serialization.Serializer; +import org.apache.polygene.api.type.ArrayType; +import org.apache.polygene.api.type.EnumType; +import org.apache.polygene.api.type.MapType; +import org.apache.polygene.api.type.ValueCompositeType; +import org.apache.polygene.api.util.ArrayIterable; +import org.apache.polygene.api.value.ValueComposite; +import org.apache.polygene.api.value.ValueDescriptor; +import org.apache.polygene.spi.serialization.AbstractBinarySerializer; +import org.msgpack.core.MessagePack; +import org.msgpack.core.MessagePacker; +import org.msgpack.value.ArrayValue; +import org.msgpack.value.MapValue; +import org.msgpack.value.Value; +import org.msgpack.value.ValueFactory; + +import static java.util.stream.Collectors.toList; +import static org.apache.polygene.api.util.Collectors.toMap; + +@Mixins( MessagePackSerializer.Mixin.class ) +public interface MessagePackSerializer extends Serializer +{ + class Mixin extends AbstractBinarySerializer + { + @This + private Converters converters; + + @This + private MessagePackAdapters adapters; + + @Override + public void serialize( Options options, OutputStream output, @Optional Object object ) + { + MessagePacker packer = MessagePack.newDefaultPacker( output ); + Value value = doSerialize( options, object, true ); + try + { + packer.packValue( value ); + packer.flush(); + } + catch( IOException ex ) + { + throw new SerializationException( "Unable to serialize " + object, ex ); + } + } + + private Value doSerialize( Options options, Object object, boolean root ) + { + try + { + if( object == null ) + { + return ValueFactory.newNil(); + } + Class<?> objectClass = object.getClass(); + Converter<Object> converter = converters.converterFor( objectClass ); + if( converter != null ) + { + return doSerialize( options, converter.toString( object ), false ); + } + MessagePackAdapter<?> adapter = adapters.adapterFor( objectClass ); + if( adapter != null ) + { + return adapter.serialize( object, obj -> doSerialize( options, obj, false ) ); + } + if( EnumType.isEnum( objectClass ) ) + { + return ValueFactory.newString( object.toString() ); + } + if( ValueCompositeType.isValueComposite( objectClass ) ) + { + return serializeValueComposite( options, object, root ); + } + if( MapType.isMap( objectClass ) ) + { + return serializeMap( options, (Map<?, ?>) object ); + } + if( ArrayType.isArray( objectClass ) ) + { + return serializeArray( options, object ); + } + if( Iterable.class.isAssignableFrom( objectClass ) ) + { + return serializeIterable( options, (Iterable<?>) object ); + } + if( Stream.class.isAssignableFrom( objectClass ) ) + { + return serializeStream( options, (Stream<?>) object ); + } + // Fallback to Java Serialization + return ValueFactory.newBinary( serializeJava( object ) ); + } + catch( IOException ex ) + { + throw new SerializationException( "Unable to serialize " + object, ex ); + } + } + + private MapValue serializeValueComposite( Options options, Object composite, boolean root ) + { + CompositeInstance instance = PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF.apply( (ValueComposite) composite ); + ValueDescriptor descriptor = (ValueDescriptor) instance.descriptor(); + AssociationStateHolder state = (AssociationStateHolder) instance.state(); + ValueCompositeType valueType = descriptor.valueType(); + + ValueFactory.MapBuilder builder = ValueFactory.newMapBuilder(); + valueType.properties().forEach( + property -> builder.put( + ValueFactory.newString( property.qualifiedName().name() ), + doSerialize( options, state.propertyFor( property.accessor() ).get(), false ) ) ); + valueType.associations().forEach( + association -> builder.put( + ValueFactory.newString( association.qualifiedName().name() ), + doSerialize( options, state.associationFor( association.accessor() ).reference(), false ) ) ); + valueType.manyAssociations().forEach( + association -> builder.put( + ValueFactory.newString( association.qualifiedName().name() ), + doSerialize( options, + state.manyAssociationFor( association.accessor() ).references().collect( toList() ), + false ) ) ); + valueType.namedAssociations().forEach( + association -> builder.put( + ValueFactory.newString( association.qualifiedName().name() ), + doSerialize( options, + state.namedAssociationFor( association.accessor() ).references().collect( toMap() ), + false ) ) ); + + if( !root && options.includeTypeInfo() ) + { + builder.put( ValueFactory.newString( "_type" ), + ValueFactory.newString( valueType.primaryType().getName() ) ); + } + return builder.build(); + } + + private MapValue serializeMap( Options options, Map<?, ?> map ) + { + ValueFactory.MapBuilder builder = ValueFactory.newMapBuilder(); + map.forEach( ( key, value ) -> builder.put( doSerialize( options, key, false ), + doSerialize( options, value, false ) ) ); + return builder.build(); + } + + private Value serializeArray( Options options, Object object ) + { + ArrayType valueType = ArrayType.of( object.getClass() ); + if( valueType.isArrayOfPrimitiveBytes() ) + { + return ValueFactory.newBinary( (byte[]) object ); + } + if( valueType.isArrayOfPrimitives() ) + { + return serializeIterable( options, new ArrayIterable( object ) ); + } + return serializeStream( options, Stream.of( (Object[]) object ) ); + } + + private ArrayValue serializeIterable( Options options, Iterable<?> iterable ) + { + return serializeStream( options, StreamSupport.stream( iterable.spliterator(), false ) ); + } + + private ArrayValue serializeStream( Options options, Stream<?> stream ) + { + return ValueFactory.newArray( stream.map( element -> doSerialize( options, element, false ) ) + .collect( toList() ) ); + } + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSettings.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSettings.java b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSettings.java new file mode 100644 index 0000000..9c5d20c --- /dev/null +++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/MessagePackSettings.java @@ -0,0 +1,45 @@ +/* + * 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.polygene.serialization.messagepack; + +import java.util.LinkedHashMap; +import java.util.Map; +import org.apache.polygene.api.type.ValueType; +import org.apache.polygene.spi.serialization.SerializationSettings; + +public class MessagePackSettings extends SerializationSettings<MessagePackSettings> +{ + public static final MessagePackSettings DEFAULT = new MessagePackSettings(); + + public static MessagePackSettings orDefault( MessagePackSettings settings ) + { + return settings != null ? settings : DEFAULT; + } + + private Map<ValueType, MessagePackAdapter<?>> adapters; + + public MessagePackSettings() + { + adapters = new LinkedHashMap<>(); + } + + public Map<ValueType, MessagePackAdapter<?>> getAdapters() + { + return adapters; + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/assembly/MessagePackSerializationAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/assembly/MessagePackSerializationAssembler.java b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/assembly/MessagePackSerializationAssembler.java new file mode 100644 index 0000000..6bb7a1e --- /dev/null +++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/assembly/MessagePackSerializationAssembler.java @@ -0,0 +1,54 @@ +/* + * 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.polygene.serialization.messagepack.assembly; + +import org.apache.polygene.api.serialization.Deserializer; +import org.apache.polygene.api.serialization.Serialization; +import org.apache.polygene.api.serialization.Serializer; +import org.apache.polygene.bootstrap.Assemblers; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.bootstrap.ServiceDeclaration; +import org.apache.polygene.serialization.messagepack.MessagePackSerialization; +import org.apache.polygene.serialization.messagepack.MessagePackSettings; + +public class MessagePackSerializationAssembler extends Assemblers.VisibilityIdentity<MessagePackSerializationAssembler> +{ + private MessagePackSettings settings; + + public MessagePackSerializationAssembler withMessagePackSettings( MessagePackSettings settings ) + { + this.settings = settings; + return this; + } + + @Override + public void assemble( ModuleAssembly module ) + { + ServiceDeclaration declaration = module.services( MessagePackSerialization.class ) + .withTypes( Serialization.class, Serializer.class, Deserializer.class ) + .visibleIn( visibility() ); + if( hasIdentity() ) + { + declaration.identifiedBy( identity() ); + } + if( settings != null ) + { + declaration.setMetaInfo( settings ); + } + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/assembly/package.html ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/assembly/package.html b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/assembly/package.html new file mode 100644 index 0000000..82eab62 --- /dev/null +++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/assembly/package.html @@ -0,0 +1,24 @@ +<!-- + ~ 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. + ~ + ~ + --> +<html> + <body> + <h2>MessagePack Serialization Assembly.</h2> + </body> +</html> http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/package.html ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/package.html b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/package.html new file mode 100644 index 0000000..16c905a --- /dev/null +++ b/extensions/serialization-messagepack/src/main/java/org/apache/polygene/serialization/messagepack/package.html @@ -0,0 +1,24 @@ +<!-- + ~ 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. + ~ + ~ + --> +<html> + <body> + <h2>MessagePack Serialization.</h2> + </body> +</html> http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b7f30354/extensions/serialization-messagepack/src/test/java/org/apache/polygene/serialization/messagepack/MessagePackCollectionSerializationTest.java ---------------------------------------------------------------------- diff --git a/extensions/serialization-messagepack/src/test/java/org/apache/polygene/serialization/messagepack/MessagePackCollectionSerializationTest.java b/extensions/serialization-messagepack/src/test/java/org/apache/polygene/serialization/messagepack/MessagePackCollectionSerializationTest.java new file mode 100644 index 0000000..f8cc562 --- /dev/null +++ b/extensions/serialization-messagepack/src/test/java/org/apache/polygene/serialization/messagepack/MessagePackCollectionSerializationTest.java @@ -0,0 +1,32 @@ +/* + * 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.polygene.serialization.messagepack; + +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.serialization.messagepack.assembly.MessagePackSerializationAssembler; +import org.apache.polygene.test.serialization.AbstractCollectionSerializationTest; + +public class MessagePackCollectionSerializationTest extends AbstractCollectionSerializationTest +{ + @Override + public void assemble( ModuleAssembly module ) + { + new MessagePackSerializationAssembler().assemble( module ); + super.assemble( module ); + } +}
