From 1c695ee80bd2e4c3ac46b6f40684877741882773 Mon Sep 17 00:00:00 2001 From: Manfred Riem Date: Wed, 29 May 2024 07:14:05 -0500 Subject: [PATCH] Fixes #3741 - Move Eclipse Yasson dependency and its usage into a Piranha Extension module (#3742) --- COMPONENTS.md | 1 + extension/coreprofile/pom.xml | 11 ++-- .../src/main/java/module-info.java | 3 +- extension/eclipse-yasson/pom.xml | 42 ++++++++++++++ .../extension/yasson/YassonExtension.java | 56 +++++++++++++++++++ .../src/main/java/module-info.java | 44 +++++++++++++++ extension/micro/pom.xml | 17 +++--- extension/microprofile/pom.xml | 12 ++-- .../src/main/java/module-info.java | 3 +- extension/platform/pom.xml | 11 ++-- .../platform/src/main/java/module-info.java | 3 +- extension/pom.xml | 1 + pom.xml | 8 --- test/debug/pom.xml | 11 ++-- test/embedded/eclipselink/pom.xml | 11 ++-- 15 files changed, 183 insertions(+), 51 deletions(-) create mode 100644 extension/eclipse-yasson/pom.xml create mode 100644 extension/eclipse-yasson/src/main/java/cloud/piranha/extension/yasson/YassonExtension.java create mode 100644 extension/eclipse-yasson/src/main/java/module-info.java diff --git a/COMPONENTS.md b/COMPONENTS.md index 04fd739391..bb5796ba6b 100644 --- a/COMPONENTS.md +++ b/COMPONENTS.md @@ -4,6 +4,7 @@ |-----------------------|---------------| | Eclipse Grizzly | 4.0.2 | | Eclipse Grizzly NPN | 2.0.0 | +| Eclipse Yasson | 3.0.3 | | Netty | 4.1.108.Final | | Project CRaC | 0.1.3 | | RedHat Undertow | 2.3.12.Final | diff --git a/extension/coreprofile/pom.xml b/extension/coreprofile/pom.xml index 31b972077e..31ea25ff40 100644 --- a/extension/coreprofile/pom.xml +++ b/extension/coreprofile/pom.xml @@ -51,25 +51,26 @@ cloud.piranha.extension - piranha-extension-naming + piranha-extension-eclipse-yasson ${project.version} compile cloud.piranha.extension - piranha-extension-redhat-weld + piranha-extension-naming ${project.version} compile cloud.piranha.extension - piranha-extension-scinitializer + piranha-extension-redhat-weld ${project.version} compile - org.eclipse - yasson + cloud.piranha.extension + piranha-extension-scinitializer + ${project.version} compile diff --git a/extension/coreprofile/src/main/java/module-info.java b/extension/coreprofile/src/main/java/module-info.java index 6a48913796..ce02f456d9 100644 --- a/extension/coreprofile/src/main/java/module-info.java +++ b/extension/coreprofile/src/main/java/module-info.java @@ -54,6 +54,5 @@ requires cloud.piranha.extension.jersey; requires cloud.piranha.extension.naming; requires cloud.piranha.extension.scinitializer; - requires org.eclipse.parsson; - requires org.eclipse.yasson; + requires cloud.piranha.extension.yasson; } diff --git a/extension/eclipse-yasson/pom.xml b/extension/eclipse-yasson/pom.xml new file mode 100644 index 0000000000..409283883f --- /dev/null +++ b/extension/eclipse-yasson/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + + cloud.piranha.extension + project + 24.6.0-SNAPSHOT + + + piranha-extension-eclipse-yasson + jar + + Piranha - Extension - Eclipse Yasson + + 3.0.3 + + + + + cloud.piranha.core + piranha-core-api + ${project.version} + compile + + + + cloud.piranha.extension + piranha-extension-scinitializer + ${project.version} + provided + + + + org.eclipse + yasson + ${yasson.version} + runtime + + + diff --git a/extension/eclipse-yasson/src/main/java/cloud/piranha/extension/yasson/YassonExtension.java b/extension/eclipse-yasson/src/main/java/cloud/piranha/extension/yasson/YassonExtension.java new file mode 100644 index 0000000000..1feb0e1d52 --- /dev/null +++ b/extension/eclipse-yasson/src/main/java/cloud/piranha/extension/yasson/YassonExtension.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package cloud.piranha.extension.yasson; + +import cloud.piranha.core.api.WebApplication; +import cloud.piranha.core.api.WebApplicationExtension; +import java.lang.System.Logger; +import static java.lang.System.Logger.Level.TRACE; + +/** + * The extension that delivers Eclipse Yasson to Piranha. + * + * @author Manfred Riem (mriem@manorrock.com) + */ +public class YassonExtension implements WebApplicationExtension { + + /** + * Stores the logger. + */ + private static final Logger LOGGER = System.getLogger(YassonExtension.class.getName()); + + /** + * Configure the extension. + * + * @param webApplication the web application. + */ + @Override + public void configure(WebApplication webApplication) { + LOGGER.log(TRACE, "Configuring Yasson extension"); + } +} diff --git a/extension/eclipse-yasson/src/main/java/module-info.java b/extension/eclipse-yasson/src/main/java/module-info.java new file mode 100644 index 0000000000..926c7644df --- /dev/null +++ b/extension/eclipse-yasson/src/main/java/module-info.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2024 Manorrock.com. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * This module delivers the Eclipse Yasson integration extension. + * + *

+ * This extension integrates Eclipse Yasson into Piranha. See + * https://github.com/eclipse-ee4j/yasson for more information about its + * project. + *

+ * + * @author Manfred Riem (mriem@manorrock.com) + */ +module cloud.piranha.extension.yasson { + + requires cloud.piranha.core.api; + requires static cloud.piranha.extension.scinitializer; +} diff --git a/extension/micro/pom.xml b/extension/micro/pom.xml index 533be9e5c3..1025f72d5a 100644 --- a/extension/micro/pom.xml +++ b/extension/micro/pom.xml @@ -28,7 +28,6 @@ piranha-core-impl ${project.version} - cloud.piranha.extension piranha-extension-apache-fileupload @@ -71,6 +70,12 @@ ${project.version} compile + + cloud.piranha.extension + piranha-extension-eclipse-yasson + ${project.version} + compile + cloud.piranha.extension piranha-extension-policy @@ -82,7 +87,6 @@ ${project.version} compile - cloud.piranha.extension piranha-extension-redhat-weld @@ -111,7 +115,7 @@ piranha-extension-tempdir ${project.version} compile - + cloud.piranha.extension piranha-extension-webxml @@ -154,13 +158,6 @@ runtime - - - org.eclipse - yasson - runtime - - jakarta.validation diff --git a/extension/microprofile/pom.xml b/extension/microprofile/pom.xml index 975018ebc8..0eb8906e9b 100644 --- a/extension/microprofile/pom.xml +++ b/extension/microprofile/pom.xml @@ -45,26 +45,26 @@ cloud.piranha.extension - piranha-extension-naming + piranha-extension-eclipse-yasson ${project.version} compile - cloud.piranha.extension - piranha-extension-redhat-weld + piranha-extension-naming ${project.version} compile cloud.piranha.extension - piranha-extension-scinitializer + piranha-extension-redhat-weld ${project.version} compile - org.eclipse - yasson + cloud.piranha.extension + piranha-extension-scinitializer + ${project.version} compile diff --git a/extension/microprofile/src/main/java/module-info.java b/extension/microprofile/src/main/java/module-info.java index 2e2f1d85c6..746d9f2812 100644 --- a/extension/microprofile/src/main/java/module-info.java +++ b/extension/microprofile/src/main/java/module-info.java @@ -52,6 +52,5 @@ requires cloud.piranha.extension.jersey; requires cloud.piranha.extension.naming; requires cloud.piranha.extension.scinitializer; - requires org.eclipse.parsson; - requires org.eclipse.yasson; + requires cloud.piranha.extension.yasson; } diff --git a/extension/platform/pom.xml b/extension/platform/pom.xml index cf9d08c3e6..5679810560 100644 --- a/extension/platform/pom.xml +++ b/extension/platform/pom.xml @@ -49,6 +49,12 @@ piranha-extension-eclipse-jersey ${project.version} compile + + + cloud.piranha.extension + piranha-extension-eclipse-yasson + ${project.version} + compile cloud.piranha.extension @@ -68,10 +74,5 @@ ${project.version} compile - - org.eclipse - yasson - compile - diff --git a/extension/platform/src/main/java/module-info.java b/extension/platform/src/main/java/module-info.java index b42cc1a130..5ab1c73aae 100644 --- a/extension/platform/src/main/java/module-info.java +++ b/extension/platform/src/main/java/module-info.java @@ -54,6 +54,5 @@ requires cloud.piranha.extension.jersey; requires cloud.piranha.extension.naming; requires cloud.piranha.extension.scinitializer; - requires org.eclipse.parsson; - requires org.eclipse.yasson; + requires cloud.piranha.extension.yasson; } diff --git a/extension/pom.xml b/extension/pom.xml index 6ace6245c4..13b27cd392 100644 --- a/extension/pom.xml +++ b/extension/pom.xml @@ -30,6 +30,7 @@ eclipse-jersey eclipse-mojarra eclipse-soteria + eclipse-yasson eclipse-wasp eclipselink hazelcast diff --git a/pom.xml b/pom.xml index b8f7f480f5..ddf28774ca 100644 --- a/pom.xml +++ b/pom.xml @@ -107,7 +107,6 @@ 3.2.3 1.0.1 2.1.5 - 3.0.3 3.5.0 2.8 @@ -234,13 +233,6 @@ tyrus-container-servlet ${tyrus.version} - - - - org.eclipse - yasson - ${yasson.version} - diff --git a/test/debug/pom.xml b/test/debug/pom.xml index bd28c44d9e..19f4624183 100644 --- a/test/debug/pom.xml +++ b/test/debug/pom.xml @@ -94,6 +94,11 @@ piranha-extension-eclipse-soteria ${project.version} + + cloud.piranha.extension + piranha-extension-eclipse-yasson + ${project.version} + cloud.piranha.extension piranha-extension-eclipse-wasp @@ -428,12 +433,6 @@ tyrus-container-servlet - - - org.eclipse - yasson - - me.alexpanov diff --git a/test/embedded/eclipselink/pom.xml b/test/embedded/eclipselink/pom.xml index a0c8335d8e..8490501c71 100644 --- a/test/embedded/eclipselink/pom.xml +++ b/test/embedded/eclipselink/pom.xml @@ -67,6 +67,12 @@ ${project.version} test + + cloud.piranha.extension + piranha-extension-eclipse-yasson + ${project.version} + test + cloud.piranha.extension piranha-extension-naming @@ -106,11 +112,6 @@ jakarta.websocket-client-api test - - org.eclipse - yasson - test - org.junit.jupiter junit-jupiter-api