From 718afefebce6c1aa47a7f318d864b5f8eb34d7fa Mon Sep 17 00:00:00 2001 From: Eduardo Martins Date: Thu, 2 May 2024 11:53:22 +0100 Subject: [PATCH] [CMTOOL-363] WildFly 32 server module --- .../core/jboss/JBossExtensionNames.java | 2 + .../migration/core/jboss/JBossExtensions.java | 9 ++ .../core/jboss/JBossSubsystemNames.java | 1 + dist/standalone/pom.xml | 6 + pom.xml | 8 ++ servers/wildfly32.0/pom.xml | 41 +++++++ .../migration/wfly/WildFly32_0Server.java | 51 ++++++++ .../WildFly32_0ServerMigrationProvider.java | 26 ++++ .../wfly/WildFly32_0ServerProvider.java | 70 +++++++++++ .../WildFly32_0AddHostExcludes.java | 116 ++++++++++++++++++ .../org.jboss.migration.core.ServerProvider | 16 +++ 11 files changed, 346 insertions(+) create mode 100644 servers/wildfly32.0/pom.xml create mode 100644 servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0Server.java create mode 100644 servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0ServerMigrationProvider.java create mode 100644 servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0ServerProvider.java create mode 100644 servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/task/hostexclude/WildFly32_0AddHostExcludes.java create mode 100644 servers/wildfly32.0/src/main/resources/META-INF/services/org.jboss.migration.core.ServerProvider diff --git a/core/src/main/java/org/jboss/migration/core/jboss/JBossExtensionNames.java b/core/src/main/java/org/jboss/migration/core/jboss/JBossExtensionNames.java index cbe9e89df..b97358acf 100644 --- a/core/src/main/java/org/jboss/migration/core/jboss/JBossExtensionNames.java +++ b/core/src/main/java/org/jboss/migration/core/jboss/JBossExtensionNames.java @@ -36,6 +36,7 @@ public interface JBossExtensionNames { String EE_SECURITY = "org.wildfly.extension.ee-security"; String EJB3 = "org.jboss.as.ejb3"; String ELYTRON = "org.wildfly.extension.elytron"; + String ELYTRON_JAAS_REALM = "org.wildfly.extension.elytron.jaas-realm"; String ELYTRON_OIDC_CLIENT = "org.wildfly.extension.elytron-oidc-client"; String HEALTH = "org.wildfly.extension.health"; String IIOP_OPENJDK = "org.wildfly.iiop-openjdk"; @@ -71,6 +72,7 @@ public interface JBossExtensionNames { String MICROPROFILE_REACTIVE_STREAMS_OPERATORS_SMALLRYE = "org.wildfly.extension.microprofile.reactive-streams-operators-smallrye"; String MICROPROFILE_TELEMETRY = "org.wildfly.extension.microprofile.telemetry"; String MODCLUSTER = "org.jboss.as.modcluster"; + String MVC_KRAZO = "org.wildfly.extension.mvc-krazo"; String NAMING = "org.jboss.as.naming"; String OPENTELEMETRY = "org.wildfly.extension.opentelemetry"; String OSGI = "org.jboss.as.osgi"; diff --git a/core/src/main/java/org/jboss/migration/core/jboss/JBossExtensions.java b/core/src/main/java/org/jboss/migration/core/jboss/JBossExtensions.java index 4700b8cec..3aab140cd 100644 --- a/core/src/main/java/org/jboss/migration/core/jboss/JBossExtensions.java +++ b/core/src/main/java/org/jboss/migration/core/jboss/JBossExtensions.java @@ -103,6 +103,10 @@ public interface JBossExtensions { .subsystem(Subsystem.builder().name(JBossSubsystemNames.ELYTRON).namespaceWithoutVersion("urn:wildfly:"+JBossSubsystemNames.ELYTRON)) .build(); + Extension ELYTRON_JAAS_REALM = Extension.builder() + .module(JBossExtensionNames.ELYTRON_JAAS_REALM) + .build(); + Extension ELYTRON_OIDC_CLIENT = Extension.builder() .module(JBossExtensionNames.ELYTRON_OIDC_CLIENT) .subsystem(Subsystem.builder().name(JBossSubsystemNames.ELYTRON_OIDC_CLIENT).namespaceWithoutVersion("urn:wildfly:"+JBossSubsystemNames.ELYTRON_OIDC_CLIENT)) @@ -273,6 +277,11 @@ public interface JBossExtensions { .subsystem(JBossSubsystemNames.MODCLUSTER) .build(); + Extension MVC_KRAZO = Extension.builder() + .module(JBossExtensionNames.MVC_KRAZO) + .subsystem(JBossSubsystemNames.MVC_KRAZO) + .build(); + Extension NAMING = Extension.builder() .module(JBossExtensionNames.NAMING) .subsystem(JBossSubsystemNames.NAMING) diff --git a/core/src/main/java/org/jboss/migration/core/jboss/JBossSubsystemNames.java b/core/src/main/java/org/jboss/migration/core/jboss/JBossSubsystemNames.java index d45f7a285..b21570877 100644 --- a/core/src/main/java/org/jboss/migration/core/jboss/JBossSubsystemNames.java +++ b/core/src/main/java/org/jboss/migration/core/jboss/JBossSubsystemNames.java @@ -73,6 +73,7 @@ public interface JBossSubsystemNames { String MICROPROFILE_TELEMETRY = "microprofile-telemetry"; String MODCLUSTER = "modcluster"; + String MVC_KRAZO = "mvc-krazo"; String NAMING = "naming"; String OPENTELEMETRY = "opentelemetry"; String OSGI = "osgi"; diff --git a/dist/standalone/pom.xml b/dist/standalone/pom.xml index 592bb2bc0..d1bd95ace 100644 --- a/dist/standalone/pom.xml +++ b/dist/standalone/pom.xml @@ -426,6 +426,12 @@ jboss-server-migration-wildfly31.0-to-wildfly31.0 + + + ${project.groupId} + jboss-server-migration-wildfly32.0-server + + diff --git a/pom.xml b/pom.xml index 1204d35cf..551159cd9 100644 --- a/pom.xml +++ b/pom.xml @@ -190,6 +190,7 @@ servers/wildfly29.0 servers/wildfly30.0 servers/wildfly31.0 + servers/wildfly32.0 @@ -983,6 +984,13 @@ ${project.version} + + + ${project.groupId} + jboss-server-migration-wildfly32.0-server + ${project.version} + + diff --git a/servers/wildfly32.0/pom.xml b/servers/wildfly32.0/pom.xml new file mode 100644 index 000000000..2a2bcec4a --- /dev/null +++ b/servers/wildfly32.0/pom.xml @@ -0,0 +1,41 @@ + + + + + 4.0.0 + + + org.jboss.migration + jboss-server-migration-parent + 32.0.0.Final-SNAPSHOT + ../../pom.xml + + + jboss-server-migration-wildfly32.0-server + + JBoss Server Migration: WildFly 32.0 Server + + + + ${project.groupId} + jboss-server-migration-wildfly31.0-server + + + + diff --git a/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0Server.java b/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0Server.java new file mode 100644 index 000000000..c20906c42 --- /dev/null +++ b/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0Server.java @@ -0,0 +1,51 @@ +/* + * Copyright 2024 Red Hat, Inc. + * + * Licensed 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.jboss.migration.wfly; + +import org.jboss.migration.core.ProductInfo; +import org.jboss.migration.core.env.MigrationEnvironment; +import org.jboss.migration.core.jboss.JBossExtensions; +import org.jboss.migration.core.jboss.JBossServer; +import org.jboss.migration.wfly10.ServiceLoaderWildFlyServerMigrations10; +import org.jboss.migration.wfly10.WildFlyServer10; +import org.jboss.migration.wfly10.WildFlyServerMigrations10; + +import java.nio.file.Path; +import java.util.ServiceLoader; + +/** + * The WildFly 32.0 {@link org.jboss.migration.core.Server}. + * @author emmartins + */ +public class WildFly32_0Server extends WildFlyServer10 { + + public static final JBossServer.Extensions EXTENSIONS = JBossServer.Extensions.builder() + .extensions(WildFly31_0Server.EXTENSIONS) + .extension(JBossExtensions.ELYTRON_JAAS_REALM) + .extension(JBossExtensions.MVC_KRAZO) + .build(); + + private static final WildFlyServerMigrations10 SERVER_MIGRATIONS = new ServiceLoaderWildFlyServerMigrations10<>(ServiceLoader.load(WildFly32_0ServerMigrationProvider.class)); + + public WildFly32_0Server(String migrationName, ProductInfo productInfo, Path baseDir, MigrationEnvironment migrationEnvironment) { + super(migrationName, productInfo, baseDir, migrationEnvironment, EXTENSIONS); + } + + @Override + protected WildFlyServerMigrations10 getMigrations() { + return SERVER_MIGRATIONS; + } +} diff --git a/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0ServerMigrationProvider.java b/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0ServerMigrationProvider.java new file mode 100644 index 000000000..71ccc8658 --- /dev/null +++ b/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0ServerMigrationProvider.java @@ -0,0 +1,26 @@ +/* + * Copyright 2024 Red Hat, Inc. + * + * Licensed 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.jboss.migration.wfly; + +import org.jboss.migration.wfly10.WildFlyServerMigrationProvider10; + +/** + * The interface that WildFly 32.0 specific migration providers must implement. Such implementations are loaded through ServiceLoader framework, thus a service descriptor must be in classpath. + * @author emmartins + */ +public interface WildFly32_0ServerMigrationProvider extends WildFlyServerMigrationProvider10 { +} diff --git a/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0ServerProvider.java b/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0ServerProvider.java new file mode 100644 index 000000000..30e82583a --- /dev/null +++ b/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/WildFly32_0ServerProvider.java @@ -0,0 +1,70 @@ +/* + * Copyright 2024 Red Hat, Inc. + * + * Licensed 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.jboss.migration.wfly; + +import org.jboss.migration.core.ProductInfo; +import org.jboss.migration.core.Server; +import org.jboss.migration.core.ServerMigrationFailureException; +import org.jboss.migration.core.env.MigrationEnvironment; +import org.jboss.migration.core.jboss.JBossServer; +import org.jboss.migration.core.jboss.ManifestProductInfo; +import org.jboss.migration.wfly10.dist.full.WildFlyFullServerProvider10_0; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.jar.JarInputStream; + +/** + * The WildFly 32.x {@link org.jboss.migration.core.ServerProvider}. + * @author emmartins + */ +public class WildFly32_0ServerProvider extends WildFlyFullServerProvider10_0 { + + @Override + protected ProductInfo getProductInfo(Path baseDir, MigrationEnvironment migrationEnvironment) throws IllegalArgumentException { + final JBossServer.Module module = new JBossServer.Modules(baseDir).getModule("org.jboss.as.product:main"); + if (module == null) { + return null; + } + try { + Path moduleJar = Files.list(module.getModuleDir()).filter(path -> path.toString().endsWith(".jar")).findFirst().get(); + if (moduleJar == null || !Files.isRegularFile(moduleJar)) { + return null; + } + try (JarInputStream jarStream = new JarInputStream(Files.newInputStream(moduleJar))) { + return ManifestProductInfo.from(jarStream.getManifest()); + } + } catch (IOException e) { + throw new ServerMigrationFailureException(e); + } + } + + @Override + protected String getProductVersionRegex() { + return "32\\..*"; + } + + @Override + protected Server constructServer(String migrationName, ProductInfo productInfo, Path baseDir, MigrationEnvironment migrationEnvironment) { + return new WildFly32_0Server(migrationName, productInfo, baseDir, migrationEnvironment); + } + + @Override + public String getName() { + return "WildFly 32.x"; + } +} diff --git a/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/task/hostexclude/WildFly32_0AddHostExcludes.java b/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/task/hostexclude/WildFly32_0AddHostExcludes.java new file mode 100644 index 000000000..be9e8280f --- /dev/null +++ b/servers/wildfly32.0/src/main/java/org/jboss/migration/wfly/task/hostexclude/WildFly32_0AddHostExcludes.java @@ -0,0 +1,116 @@ +/* + * Copyright 2024 Red Hat, Inc. + * + * Licensed 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.jboss.migration.wfly.task.hostexclude; + +import org.jboss.migration.core.jboss.HostExclude; +import org.jboss.migration.core.jboss.HostExcludes; +import org.jboss.migration.core.jboss.JBossExtensionNames; +import org.jboss.migration.wfly10.config.task.hostexclude.AddHostExcludes; + +/** + * @author emmartins + */ +public class WildFly32_0AddHostExcludes extends AddHostExcludes { + + private static final HostExcludes HOST_EXCLUDES = HostExcludes.builder() + .hostExclude(HostExclude.builder() + .name("WildFly23.0") + .release("WildFly23.0") + .excludedExtension(JBossExtensionNames.CLUSTERING_EJB) + .excludedExtension(JBossExtensionNames.ELYTRON_OIDC_CLIENT) + .excludedExtension(JBossExtensionNames.OPENTELEMETRY) + .excludedExtension(JBossExtensionNames.MICROMETER) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_PARTICIPANT) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_COORDINATOR) + .excludedExtension(JBossExtensionNames.MICROPROFILE_TELEMETRY) + .excludedExtension(JBossExtensionNames.ELYTRON_JAAS_REALM) + .excludedExtension(JBossExtensionNames.MVC_KRAZO) + ) + .hostExclude(HostExclude.builder() + .name("WildFly24.0") + .release("WildFly24.0") + .excludedExtension(JBossExtensionNames.CLUSTERING_EJB) + .excludedExtension(JBossExtensionNames.ELYTRON_OIDC_CLIENT) + .excludedExtension(JBossExtensionNames.OPENTELEMETRY) + .excludedExtension(JBossExtensionNames.MICROMETER) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_PARTICIPANT) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_COORDINATOR) + .excludedExtension(JBossExtensionNames.MICROPROFILE_TELEMETRY) + .excludedExtension(JBossExtensionNames.ELYTRON_JAAS_REALM) + .excludedExtension(JBossExtensionNames.MVC_KRAZO) + ) + .hostExclude(HostExclude.builder() + .name("WildFly25.0") + .release("WildFly25.0") + .excludedExtension(JBossExtensionNames.CLUSTERING_EJB) + .excludedExtension(JBossExtensionNames.MICROMETER) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_PARTICIPANT) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_COORDINATOR) + .excludedExtension(JBossExtensionNames.MICROPROFILE_TELEMETRY) + .excludedExtension(JBossExtensionNames.ELYTRON_JAAS_REALM) + .excludedExtension(JBossExtensionNames.MVC_KRAZO) + ) + .hostExclude(HostExclude.builder() + .name("WildFly26.0") + .release("WildFly26.0") + .excludedExtension(JBossExtensionNames.CLUSTERING_EJB) + .excludedExtension(JBossExtensionNames.MICROMETER) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_PARTICIPANT) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_COORDINATOR) + .excludedExtension(JBossExtensionNames.MICROPROFILE_TELEMETRY) + .excludedExtension(JBossExtensionNames.ELYTRON_JAAS_REALM) + .excludedExtension(JBossExtensionNames.MVC_KRAZO) + ) + .hostExclude(HostExclude.builder() + .name("WildFly27.0") + .release("WildFly27.0") + .excludedExtension(JBossExtensionNames.MICROMETER) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_PARTICIPANT) + .excludedExtension(JBossExtensionNames.MICROPROFILE_LRA_COORDINATOR) + .excludedExtension(JBossExtensionNames.MICROPROFILE_TELEMETRY) + .excludedExtension(JBossExtensionNames.ELYTRON_JAAS_REALM) + .excludedExtension(JBossExtensionNames.MVC_KRAZO) + ) + .hostExclude(HostExclude.builder() + .name("WildFly28.0") + .release("WildFly28.0") + .excludedExtension(JBossExtensionNames.ELYTRON_JAAS_REALM) + .excludedExtension(JBossExtensionNames.MVC_KRAZO) + ) + .hostExclude(HostExclude.builder() + .name("WildFly29.0") + .release("WildFly29.0") + .excludedExtension(JBossExtensionNames.ELYTRON_JAAS_REALM) + .excludedExtension(JBossExtensionNames.MVC_KRAZO) + ) + .hostExclude(HostExclude.builder() + .name("WildFly30.0") + .release("WildFly30.0") + .excludedExtension(JBossExtensionNames.ELYTRON_JAAS_REALM) + .excludedExtension(JBossExtensionNames.MVC_KRAZO) + ) + .hostExclude(HostExclude.builder() + .name("WildFly31.0") + .release("WildFly31.0") + .excludedExtension(JBossExtensionNames.ELYTRON_JAAS_REALM) + .excludedExtension(JBossExtensionNames.MVC_KRAZO) + ) + .build(); + + public WildFly32_0AddHostExcludes() { + super(HOST_EXCLUDES); + } +} diff --git a/servers/wildfly32.0/src/main/resources/META-INF/services/org.jboss.migration.core.ServerProvider b/servers/wildfly32.0/src/main/resources/META-INF/services/org.jboss.migration.core.ServerProvider new file mode 100644 index 000000000..2ef5f159c --- /dev/null +++ b/servers/wildfly32.0/src/main/resources/META-INF/services/org.jboss.migration.core.ServerProvider @@ -0,0 +1,16 @@ +# +# Copyright 2024 Red Hat, Inc. +# +# Licensed 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. +# +org.jboss.migration.wfly.WildFly32_0ServerProvider