Skip to content

Commit

Permalink
Merge pull request #5807 from pferraro/WFCORE-6650
Browse files Browse the repository at this point in the history
WFCORE-6650 Expose server stability and allow feature filtering from a DeploymentUnit.
  • Loading branch information
yersan committed Feb 27, 2024
2 parents 7197d9b + 971ad9e commit 5103d11
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public static void doDeploy(final OperationContext context, final String deploym
final Supplier<VirtualFile> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

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;

/**
* 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.
Expand Down Expand Up @@ -42,4 +44,9 @@ public interface DeploymentUnit extends Attachable {
*/
ServiceRegistry getServiceRegistry();

// TODO Remove this once integrated into WF-full
@Override
default Stability getStability() {
return Stability.DEFAULT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -17,18 +18,21 @@ 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.
*
* @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() {
Expand All @@ -54,6 +58,11 @@ public ServiceRegistry getServiceRegistry() {
return serviceRegistry;
}

@Override
public Stability getStability() {
return this.stability;
}

/** {@inheritDoc} */
public String toString() {
if (parent != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -34,6 +35,7 @@ final class RootDeploymentUnitService extends AbstractDeploymentUnitService {
private final DeploymentOverlayIndex deploymentOverlays;
private final WeakReference<AnnotationIndexSupport> annotationIndexSupport;
private final boolean isExplodedContent;
private final Stability stability;

/**
* Construct a new instance.
Expand All @@ -51,7 +53,7 @@ public RootDeploymentUnitService(final Consumer<DeploymentUnit> deploymentUnitCo
final Supplier<DeploymentMountProvider> serverDeploymentRepositorySupplier,
final Supplier<PathManager> pathManagerSupplier,
final Supplier<VirtualFile> contentsSupplier,
final String name, final String managementName, final DeploymentUnit parent,
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,
Expand All @@ -71,10 +73,11 @@ public RootDeploymentUnitService(final Consumer<DeploymentUnit> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public SubDeploymentUnitService(final Consumer<DeploymentUnit> 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);
Expand Down

0 comments on commit 5103d11

Please sign in to comment.