From c61d4e9835d9812e77155a5f16ec56882d53819c Mon Sep 17 00:00:00 2001 From: Paul Ferraro Date: Wed, 20 Dec 2023 13:11:10 -0500 Subject: [PATCH 1/3] WFCORE-6650 Expose server stability and allow feature filtering from a DeploymentUnit. --- .../as/server/deployment/DeploymentHandlerUtil.java | 2 +- .../jboss/as/server/deployment/DeploymentUnit.java | 3 ++- .../as/server/deployment/DeploymentUnitImpl.java | 11 ++++++++++- .../server/deployment/RootDeploymentUnitService.java | 7 +++++-- .../server/deployment/SubDeploymentUnitService.java | 2 +- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/org/jboss/as/server/deployment/DeploymentHandlerUtil.java b/server/src/main/java/org/jboss/as/server/deployment/DeploymentHandlerUtil.java index edefd3722b6..6c8af072c7f 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/DeploymentHandlerUtil.java +++ b/server/src/main/java/org/jboss/as/server/deployment/DeploymentHandlerUtil.java @@ -213,7 +213,7 @@ public static void doDeploy(final OperationContext context, final String deploym final Supplier contentsSupplier = sb.requires(contentsServiceName); final RootDeploymentUnitService service = new RootDeploymentUnitService(deploymentUnitConsumer, serverDeploymentRepositorySupplier, pathManagerSupplier, contentsSupplier, - deploymentUnitName, managementName, null, + deploymentUnitName, managementName, null, context.getStability(), registration, mutableRegistration, deploymentResource, context.getCapabilityServiceSupport(), overlays, annotationIndexSupport, isExplodedContent); final ServiceController deploymentUnitController = sb.setInstance(service).install(); diff --git a/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnit.java b/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnit.java index b3c9f6e52ef..c54d396ab38 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnit.java +++ b/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnit.java @@ -5,6 +5,7 @@ package org.jboss.as.server.deployment; +import org.jboss.as.controller.FeatureRegistry; import org.jboss.msc.service.ServiceName; import org.jboss.msc.service.ServiceRegistry; @@ -12,7 +13,7 @@ * The deployment unit. This object retains data which is persistent for the life of the * deployment. */ -public interface DeploymentUnit extends Attachable { +public interface DeploymentUnit extends Attachable, FeatureRegistry { /** * Get the service name of the root deployment unit service. diff --git a/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnitImpl.java b/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnitImpl.java index 4a183e9ca3f..11f4cf86064 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnitImpl.java +++ b/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnitImpl.java @@ -5,6 +5,7 @@ package org.jboss.as.server.deployment; +import org.jboss.as.version.Stability; import org.jboss.msc.service.ServiceName; import org.jboss.msc.service.ServiceRegistry; @@ -17,6 +18,7 @@ class DeploymentUnitImpl extends SimpleAttachable implements DeploymentUnit { private final DeploymentUnit parent; private final String name; private final ServiceRegistry serviceRegistry; + private final Stability stability; /** * Construct a new instance. @@ -24,11 +26,13 @@ class DeploymentUnitImpl extends SimpleAttachable implements DeploymentUnit { * @param parent the parent (enclosing) deployment unit, if any * @param name the deployment unit name * @param serviceRegistry the service registry + * @param stability the stability level of the current process */ - DeploymentUnitImpl(final DeploymentUnit parent, final String name, final ServiceRegistry serviceRegistry) { + DeploymentUnitImpl(final DeploymentUnit parent, final String name, final ServiceRegistry serviceRegistry, Stability stability) { this.parent = parent; this.name = name; this.serviceRegistry = serviceRegistry; + this.stability = stability; } public ServiceName getServiceName() { @@ -54,6 +58,11 @@ public ServiceRegistry getServiceRegistry() { return serviceRegistry; } + @Override + public Stability getStability() { + return this.stability; + } + /** {@inheritDoc} */ public String toString() { if (parent != null) { diff --git a/server/src/main/java/org/jboss/as/server/deployment/RootDeploymentUnitService.java b/server/src/main/java/org/jboss/as/server/deployment/RootDeploymentUnitService.java index 13b929bfc6a..4d25d2a4a9d 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/RootDeploymentUnitService.java +++ b/server/src/main/java/org/jboss/as/server/deployment/RootDeploymentUnitService.java @@ -16,6 +16,7 @@ import org.jboss.as.controller.services.path.PathManager; import org.jboss.as.server.deployment.annotation.AnnotationIndexSupport; import org.jboss.as.server.deploymentoverlay.DeploymentOverlayIndex; +import org.jboss.as.version.Stability; import org.jboss.msc.service.ServiceRegistry; import org.jboss.vfs.VirtualFile; @@ -34,6 +35,7 @@ final class RootDeploymentUnitService extends AbstractDeploymentUnitService { private final DeploymentOverlayIndex deploymentOverlays; private final WeakReference annotationIndexSupport; private final boolean isExplodedContent; + private final Stability stability; /** * Construct a new instance. @@ -51,7 +53,7 @@ public RootDeploymentUnitService(final Consumer deploymentUnitCo final Supplier serverDeploymentRepositorySupplier, final Supplier pathManagerSupplier, final Supplier contentsSupplier, - final String name, final String managementName, final DeploymentUnit parent, + final String name, final String managementName, final DeploymentUnit parent, Stability stability, final ImmutableManagementResourceRegistration registration, final ManagementResourceRegistration mutableRegistration, final Resource resource, final CapabilityServiceSupport capabilityServiceSupport, final DeploymentOverlayIndex deploymentOverlays, @@ -71,10 +73,11 @@ public RootDeploymentUnitService(final Consumer deploymentUnitCo // of the related deployment operations. this.annotationIndexSupport = new WeakReference<>(annotationIndexSupport); this.isExplodedContent = exploded; + this.stability = stability; } protected DeploymentUnit createAndInitializeDeploymentUnit(final ServiceRegistry registry) { - final DeploymentUnit deploymentUnit = new DeploymentUnitImpl(parent, name, registry); + final DeploymentUnit deploymentUnit = new DeploymentUnitImpl(parent, name, registry, this.stability); deploymentUnit.putAttachment(Attachments.MANAGEMENT_NAME, managementName); deploymentUnit.putAttachment(Attachments.DEPLOYMENT_CONTENTS, contentsSupplier.get()); deploymentUnit.putAttachment(DeploymentResourceSupport.REGISTRATION_ATTACHMENT, registration); diff --git a/server/src/main/java/org/jboss/as/server/deployment/SubDeploymentUnitService.java b/server/src/main/java/org/jboss/as/server/deployment/SubDeploymentUnitService.java index 469a0fa223f..5bed566812f 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/SubDeploymentUnitService.java +++ b/server/src/main/java/org/jboss/as/server/deployment/SubDeploymentUnitService.java @@ -39,7 +39,7 @@ public SubDeploymentUnitService(final Consumer deploymentUnitCon protected DeploymentUnit createAndInitializeDeploymentUnit(ServiceRegistry registry) { final String deploymentName = deploymentRoot.getRootName(); - final DeploymentUnit deploymentUnit = new DeploymentUnitImpl(parent, deploymentName, registry); + final DeploymentUnit deploymentUnit = new DeploymentUnitImpl(parent, deploymentName, registry, parent.getStability()); deploymentUnit.putAttachment(Attachments.DEPLOYMENT_ROOT, deploymentRoot); deploymentUnit.putAttachment(Attachments.MODULE_SPECIFICATION, new ModuleSpecification()); deploymentUnit.putAttachment(DeploymentResourceSupport.REGISTRATION_ATTACHMENT, registration); From 3408e76e46161beba6793ebc71c18c5e6b4a3688 Mon Sep 17 00:00:00 2001 From: Paul Ferraro Date: Tue, 30 Jan 2024 16:08:00 -0500 Subject: [PATCH 2/3] Create temporary default getStability() implementation until integrated into WF-full. --- .../java/org/jboss/as/server/deployment/DeploymentUnit.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnit.java b/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnit.java index c54d396ab38..36e0d36faa2 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnit.java +++ b/server/src/main/java/org/jboss/as/server/deployment/DeploymentUnit.java @@ -6,6 +6,7 @@ package org.jboss.as.server.deployment; import org.jboss.as.controller.FeatureRegistry; +import org.jboss.as.version.Stability; import org.jboss.msc.service.ServiceName; import org.jboss.msc.service.ServiceRegistry; @@ -43,4 +44,9 @@ public interface DeploymentUnit extends Attachable, FeatureRegistry { */ ServiceRegistry getServiceRegistry(); + // TODO Remove this once integrated into WF-full + @Override + default Stability getStability() { + return Stability.DEFAULT; + } } From 971ad9ef0db82158f11ce9bd0e71749dd79de8b4 Mon Sep 17 00:00:00 2001 From: Paul Ferraro Date: Tue, 30 Jan 2024 16:12:09 -0500 Subject: [PATCH 3/3] Add final modifier to stability constructor parameter. --- .../jboss/as/server/deployment/RootDeploymentUnitService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/org/jboss/as/server/deployment/RootDeploymentUnitService.java b/server/src/main/java/org/jboss/as/server/deployment/RootDeploymentUnitService.java index 4d25d2a4a9d..61e2b5e0805 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/RootDeploymentUnitService.java +++ b/server/src/main/java/org/jboss/as/server/deployment/RootDeploymentUnitService.java @@ -53,7 +53,7 @@ public RootDeploymentUnitService(final Consumer deploymentUnitCo final Supplier serverDeploymentRepositorySupplier, final Supplier pathManagerSupplier, final Supplier contentsSupplier, - final String name, final String managementName, final DeploymentUnit parent, Stability stability, + final String name, final String managementName, final DeploymentUnit parent, final Stability stability, final ImmutableManagementResourceRegistration registration, final ManagementResourceRegistration mutableRegistration, final Resource resource, final CapabilityServiceSupport capabilityServiceSupport, final DeploymentOverlayIndex deploymentOverlays,