Skip to content

Commit

Permalink
WFLY-19357 Replace wildfly-clustering-common dependency w/wildfly-sub…
Browse files Browse the repository at this point in the history
…system in OpenAPI subsystem
  • Loading branch information
pferraro committed Jun 24, 2024
1 parent b6110b6 commit ed5361f
Show file tree
Hide file tree
Showing 17 changed files with 549 additions and 618 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<module name="org.eclipse.microprofile.config.api"/>
<module name="org.eclipse.microprofile.openapi.api"/>

<module name="org.jboss.as.clustering.common"/>
<module name="org.jboss.as.controller"/>
<module name="org.jboss.as.ee"/>
<module name="org.jboss.as.jaxrs"/>
Expand All @@ -47,9 +46,10 @@
<module name="org.jboss.staxmapper"/>
<module name="org.jboss.vfs"/>

<module name="org.wildfly.clustering.service"/>
<module name="org.wildfly.common"/>
<module name="org.wildfly.extension.undertow"/>
<module name="org.wildfly.security.elytron-private"/>
<module name="org.wildfly.service"/>
<module name="org.wildfly.subsystem"/>
</dependencies>
</module>
48 changes: 7 additions & 41 deletions microprofile/openapi-smallrye/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@
</dependency>

<!-- Internal dependencies -->
<dependency>
<groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-clustering-common</artifactId>
</dependency>
<dependency>
<groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-clustering-service</artifactId>
</dependency>
<dependency>
<groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-ee</artifactId>
Expand All @@ -65,6 +57,12 @@
<dependency>
<groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-undertow</artifactId>
<exclusions>
<exclusion>
<groupId>${ee.maven.groupId}</groupId>
<artifactId>wildfly-clustering-common</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${ee.maven.groupId}</groupId>
Expand All @@ -76,26 +74,10 @@
<groupId>io.smallrye</groupId>
<artifactId>smallrye-open-api-core</artifactId>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-dmr</artifactId>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>staxmapper</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.metadata</groupId>
<artifactId>jboss-metadata-common</artifactId>
Expand All @@ -104,14 +86,6 @@
<groupId>org.jboss.metadata</groupId>
<artifactId>jboss-metadata-web</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.modules</groupId>
<artifactId>jboss-modules</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.msc</groupId>
<artifactId>jboss-msc</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-core</artifactId>
Expand All @@ -122,15 +96,7 @@
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-controller</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-network</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-server</artifactId>
<artifactId>wildfly-subsystem</artifactId>
</dependency>

<!-- Test dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,21 @@
*/
package org.wildfly.extension.microprofile.openapi;

import org.jboss.as.clustering.controller.PersistentSubsystemExtension;
import org.jboss.as.controller.Extension;
import org.jboss.as.controller.descriptions.ParentResourceDescriptionResolver;
import org.jboss.as.controller.descriptions.SubsystemResourceDescriptionResolver;
import org.kohsuke.MetaInfServices;
import org.wildfly.subsystem.SubsystemConfiguration;
import org.wildfly.subsystem.SubsystemExtension;
import org.wildfly.subsystem.SubsystemPersistence;

/**
* Extension that provides the MicroProfile OpenAPI subsystem.
* @author Michael Edgar
* @author Paul Ferraro
*/
@MetaInfServices(Extension.class)
public class MicroProfileOpenAPIExtension extends PersistentSubsystemExtension<MicroProfileOpenAPISubsystemSchema> {

static final String SUBSYSTEM_NAME = "microprofile-openapi-smallrye";
static final ParentResourceDescriptionResolver SUBSYSTEM_RESOLVER = new SubsystemResourceDescriptionResolver(SUBSYSTEM_NAME, MicroProfileOpenAPIExtension.class);
public class MicroProfileOpenAPIExtension extends SubsystemExtension<MicroProfileOpenAPISubsystemSchema> {

public MicroProfileOpenAPIExtension() {
super(SUBSYSTEM_NAME, MicroProfileOpenAPISubsystemModel.CURRENT, MicroProfileOpenAPISubsystemDefinition::new, MicroProfileOpenAPISubsystemSchema.CURRENT);
super(SubsystemConfiguration.of(MicroProfileOpenAPISubsystemRegistrar.NAME, MicroProfileOpenAPISubsystemModel.CURRENT, MicroProfileOpenAPISubsystemRegistrar::new), SubsystemPersistence.of(MicroProfileOpenAPISubsystemSchema.CURRENT));
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.extension.microprofile.openapi;

import java.util.function.Consumer;

import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ResourceDefinition;
import org.jboss.as.controller.ResourceRegistration;
import org.jboss.as.controller.SubsystemRegistration;
import org.jboss.as.controller.capability.RuntimeCapability;
import org.jboss.as.controller.descriptions.ParentResourceDescriptionResolver;
import org.jboss.as.controller.descriptions.SubsystemResourceDescriptionResolver;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.server.DeploymentProcessorTarget;
import org.jboss.as.server.deployment.Phase;
import org.wildfly.extension.microprofile.openapi.deployment.OpenAPIDependencyProcessor;
import org.wildfly.extension.microprofile.openapi.deployment.OpenAPIDocumentProcessor;
import org.wildfly.subsystem.resource.ManagementResourceRegistrar;
import org.wildfly.subsystem.resource.ManagementResourceRegistrationContext;
import org.wildfly.subsystem.resource.ResourceDescriptor;
import org.wildfly.subsystem.resource.SubsystemResourceDefinitionRegistrar;

/**
* Root resource definition for MicroProfile Open API subsystem
* @author Michael Edgar
*/
public class MicroProfileOpenAPISubsystemRegistrar implements SubsystemResourceDefinitionRegistrar, Consumer<DeploymentProcessorTarget> {

static final String NAME = "microprofile-openapi-smallrye";
static final ParentResourceDescriptionResolver SUBSYSTEM_RESOLVER = new SubsystemResourceDescriptionResolver(NAME, MicroProfileOpenAPISubsystemRegistrar.class);
static final PathElement PATH = SubsystemResourceDefinitionRegistrar.pathElement(NAME);

private static final RuntimeCapability<Void> CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.microprofile.openapi")
.addRequirements("org.wildfly.microprofile.config")
.build();

@Override
public ManagementResourceRegistration register(SubsystemRegistration parent, ManagementResourceRegistrationContext context) {
ResourceDescriptor descriptor = ResourceDescriptor.builder(SUBSYSTEM_RESOLVER)
.addCapability(CAPABILITY)
.withDeploymentChainContributor(this)
.build();

ResourceDefinition definition = ResourceDefinition.builder(ResourceRegistration.of(PATH), descriptor.getResourceDescriptionResolver()).build();
ManagementResourceRegistration registration = parent.registerSubsystemModel(definition);
ManagementResourceRegistrar.of(descriptor).register(registration);
return registration;
}

@Override
public void accept(DeploymentProcessorTarget target) {
target.addDeploymentProcessor(NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_MICROPROFILE_OPENAPI, new OpenAPIDependencyProcessor());
target.addDeploymentProcessor(NAME, Phase.INSTALL, Phase.POST_MODULE_MICROPROFILE_OPENAPI, new OpenAPIDocumentProcessor());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

package org.wildfly.extension.microprofile.openapi;

import static org.jboss.as.controller.PersistentResourceXMLDescription.builder;

import org.jboss.as.controller.PersistentResourceXMLDescription;
import org.jboss.as.controller.PersistentSubsystemSchema;
import org.jboss.as.controller.SubsystemSchema;
Expand All @@ -26,7 +24,7 @@ public enum MicroProfileOpenAPISubsystemSchema implements PersistentSubsystemSch
private final VersionedNamespace<IntVersion, MicroProfileOpenAPISubsystemSchema> namespace;

MicroProfileOpenAPISubsystemSchema(int major, int minor) {
this.namespace = SubsystemSchema.createSubsystemURN(MicroProfileOpenAPIExtension.SUBSYSTEM_NAME, new IntVersion(major, minor));
this.namespace = SubsystemSchema.createSubsystemURN(MicroProfileOpenAPISubsystemRegistrar.NAME, new IntVersion(major, minor));
}

@Override
Expand All @@ -36,6 +34,6 @@ public VersionedNamespace<IntVersion, MicroProfileOpenAPISubsystemSchema> getNam

@Override
public PersistentResourceXMLDescription getXMLDescription() {
return builder(MicroProfileOpenAPISubsystemDefinition.PATH, this.namespace).build();
return PersistentResourceXMLDescription.factory(this).builder(MicroProfileOpenAPISubsystemRegistrar.PATH).build();
}
}
Loading

0 comments on commit ed5361f

Please sign in to comment.