Skip to content

Commit

Permalink
WFCORE-6841 Create ServiceDescriptor for NotificationHandlerRegistry …
Browse files Browse the repository at this point in the history
…and remove redundant capability name strings.
  • Loading branch information
pferraro committed Jun 1, 2024
1 parent 9df6227 commit cf2c741
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ private static int getBootStackSize() {
protected static final RuntimeCapability<Void> CLIENT_FACTORY_CAPABILITY = RuntimeCapability.Builder.of(ModelControllerClientFactory.SERVICE_DESCRIPTOR).build();

/** Capability in-vm users of the controller use to register notification handlers */
protected static final RuntimeCapability<Void> NOTIFICATION_REGISTRY_CAPABILITY =
RuntimeCapability.Builder.of("org.wildfly.management.notification-handler-registry", NotificationHandlerRegistry.class)
.build();
protected static final RuntimeCapability<Void> NOTIFICATION_REGISTRY_CAPABILITY = RuntimeCapability.Builder.of(NotificationHandlerRegistry.SERVICE_DESCRIPTOR).build();

/**
* Capability users of the controller use to coordinate changes to paths.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.jboss.as.controller.notification;

import org.jboss.as.controller.PathAddress;
import org.wildfly.service.descriptor.NullaryServiceDescriptor;

/**
* The NotificationHandlerRegistry is used to register and unregister notification handlers.
Expand All @@ -23,6 +24,7 @@
* @author <a href="http://jmesnil.net/">Jeff Mesnil</a> (c) 2014 Red Hat inc.
*/
public interface NotificationHandlerRegistry {
NullaryServiceDescriptor<NotificationHandlerRegistry> SERVICE_DESCRIPTOR = NullaryServiceDescriptor.of("org.wildfly.management.notification-handler-registry", NotificationHandlerRegistry.class);

/**
* Special path address to register a notification handler for <em>any</em> source.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.PASSIVE;
import org.jboss.as.controller.descriptions.NonResolvingResourceDescriptionResolver;
import org.jboss.as.controller.descriptions.ResourceDescriptionResolver;
import org.jboss.as.controller.notification.NotificationHandlerRegistry;
import org.jboss.as.controller.operations.global.ReadFeatureDescriptionHandler;
import org.jboss.as.controller.registry.RuntimePackageDependency;
import org.jboss.as.controller.registry.AliasEntry;
Expand Down Expand Up @@ -84,7 +85,6 @@ public class ReadFeatureDescriptionTestCase extends AbstractControllerTestBase {
private static final String MAIN_RESOURCE_REQUIRED_PACKAGE_NAME = "required-main-resource-package";
private static final String ROOT_CAPABILITY_NAME = "root-capability";
private static final String DYNAMIC_CAPABILITY_NAME = "dynamic-capability";
private static final String NOTIFICATION_REGISTRY_CAPABILITY_NAME = "org.wildfly.management.notification-handler-registry";

private static final OperationStepHandler WRITE_HANDLER = new ModelOnlyWriteAttributeHandler();

Expand Down Expand Up @@ -404,7 +404,7 @@ public void testServerRoot() throws OperationFailedException {
Assert.assertTrue(providedCaps.contains(ROOT_CAPABILITY_NAME));
Assert.assertTrue(providedCaps.contains(DYNAMIC_CAPABILITY_NAME));
Assert.assertTrue(providedCaps.contains(ModelControllerClientFactory.SERVICE_DESCRIPTOR.getName()));
Assert.assertTrue(providedCaps.contains(NOTIFICATION_REGISTRY_CAPABILITY_NAME));
Assert.assertTrue(providedCaps.contains(NotificationHandlerRegistry.SERVICE_DESCRIPTOR.getName()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static void addService(final OperationContext context, final PathAddress
final CapabilityServiceBuilder<?> sb = context.getCapabilityServiceTarget().addCapability(capName);
final Consumer<DeploymentScanner> serviceConsumer = sb.provides(capName);
final Supplier<PathManager> pathManager = sb.requires(PathManager.SERVICE_DESCRIPTOR);
final Supplier<NotificationHandlerRegistry> notificationRegistry = sb.requiresCapability("org.wildfly.management.notification-handler-registry", NotificationHandlerRegistry.class);
final Supplier<NotificationHandlerRegistry> notificationRegistry = sb.requires(NotificationHandlerRegistry.SERVICE_DESCRIPTOR);
final Supplier<ModelControllerClientFactory> clientFactory = sb.requires(ModelControllerClientFactory.SERVICE_DESCRIPTOR);
final Supplier<ProcessStateNotifier> processStateNotifier = sb.requiresCapability("org.wildfly.management.process-state-notifier", ProcessStateNotifier.class);
sb.requires(org.jboss.as.server.deployment.Services.JBOSS_DEPLOYMENT_CHAINS);
Expand Down
2 changes: 1 addition & 1 deletion jmx/src/main/java/org/jboss/as/jmx/MBeanServerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static ServiceController<?> addService(final OperationContext context, fi
return context.getServiceTarget().addService(MBeanServerService.SERVICE_NAME, service)
.setInitialMode(ServiceController.Mode.ACTIVE)
.addDependency(modelControllerName, ModelController.class, service.modelControllerValue)
.addDependency(context.getCapabilityServiceName("org.wildfly.management.notification-handler-registry", null), NotificationHandlerRegistry.class, service.notificationRegistryValue)
.addDependency(context.getCapabilityServiceName(NotificationHandlerRegistry.SERVICE_DESCRIPTOR), NotificationHandlerRegistry.class, service.notificationRegistryValue)
.addDependency(ManagementModelIntegration.SERVICE_NAME, ManagementModelIntegration.ManagementModelProvider.class, service.managementModelProviderValue)
.addAliases(LEGACY_MBEAN_SERVER_NAME)
.install();
Expand Down

0 comments on commit cf2c741

Please sign in to comment.