diff --git a/appclient/src/main/java/org/jboss/as/appclient/service/ApplicationClientDeploymentService.java b/appclient/src/main/java/org/jboss/as/appclient/service/ApplicationClientDeploymentService.java index 0b782ac60c8a..7ce4dac48d60 100644 --- a/appclient/src/main/java/org/jboss/as/appclient/service/ApplicationClientDeploymentService.java +++ b/appclient/src/main/java/org/jboss/as/appclient/service/ApplicationClientDeploymentService.java @@ -16,7 +16,7 @@ import java.io.File; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.function.Supplier; @@ -43,18 +43,18 @@ public class ApplicationClientDeploymentService implements Service { private final File path; private final Consumer consumer; private final Supplier clientFactorySupplier; - private final Supplier executorServiceSupplier; + private final Supplier executorSupplier; private final CountDownLatch deploymentCompleteLatch = new CountDownLatch(1); public ApplicationClientDeploymentService(final Consumer consumer, final File path, final Supplier clientFactorySupplier, - final Supplier executorServiceSupplier) { + final Supplier executorSupplier) { this.consumer = consumer; this.path = path; this.clientFactorySupplier = clientFactorySupplier; - this.executorServiceSupplier = executorServiceSupplier; + this.executorSupplier = executorSupplier; } @Override @@ -111,7 +111,7 @@ private DeploymentTask(final Operation deploymentOp) { @Override public void run() { - try (LocalModelControllerClient controllerClient = clientFactorySupplier.get().createSuperUserClient(executorServiceSupplier.get())) { + try (LocalModelControllerClient controllerClient = clientFactorySupplier.get().createSuperUserClient(executorSupplier.get())) { ModelNode result = controllerClient.execute(deploymentOp); if (!SUCCESS.equals(result.get(OUTCOME).asString())) { System.exit(1); diff --git a/appclient/src/main/java/org/jboss/as/appclient/subsystem/AppClientSubsystemAdd.java b/appclient/src/main/java/org/jboss/as/appclient/subsystem/AppClientSubsystemAdd.java index 9b0e7209ee55..d4361e9c8868 100644 --- a/appclient/src/main/java/org/jboss/as/appclient/subsystem/AppClientSubsystemAdd.java +++ b/appclient/src/main/java/org/jboss/as/appclient/subsystem/AppClientSubsystemAdd.java @@ -9,7 +9,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.List; -import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.function.Supplier; @@ -28,6 +28,7 @@ import org.jboss.as.controller.ModelControllerClientFactory; import org.jboss.as.controller.OperationContext; import org.jboss.as.controller.OperationFailedException; +import org.jboss.as.controller.management.Capabilities; import org.jboss.as.server.AbstractDeploymentChainStep; import org.jboss.as.server.DeploymentProcessorTarget; import org.jboss.as.server.deployment.Phase; @@ -40,8 +41,6 @@ import org.jboss.msc.service.StopContext; import static org.jboss.as.appclient.subsystem.AppClientSubsystemResourceDefinition.APPCLIENT_CAPABILITY; -import static org.jboss.as.appclient.subsystem.AppClientSubsystemResourceDefinition.EXECUTOR_CAPABILITY; -import static org.jboss.as.appclient.subsystem.AppClientSubsystemResourceDefinition.MCF_CAPABILITY; import static org.jboss.as.appclient.subsystem.Constants.CONNECTION_PROPERTIES_URL; import static org.jboss.as.appclient.subsystem.Constants.HOST_URL; @@ -97,11 +96,9 @@ protected void execute(DeploymentProcessorTarget processorTarget) { CapabilityServiceBuilder builder = context.getCapabilityServiceTarget().addCapability(APPCLIENT_CAPABILITY); Consumer consumer = builder.provides(APPCLIENT_CAPABILITY); - Supplier mcfSupplier = - builder.requiresCapability(MCF_CAPABILITY, ModelControllerClientFactory.class); - Supplier esSupplier = - builder.requiresCapability(EXECUTOR_CAPABILITY, ExecutorService.class); - builder.setInstance(new ApplicationClientDeploymentService(consumer, file, mcfSupplier, esSupplier)); + Supplier mcfSupplier = builder.requires(ModelControllerClientFactory.SERVICE_DESCRIPTOR); + Supplier executorSupplier = builder.requires(Capabilities.MANAGEMENT_EXECUTOR); + builder.setInstance(new ApplicationClientDeploymentService(consumer, file, mcfSupplier, executorSupplier)); builder.install(); try { diff --git a/appclient/src/main/java/org/jboss/as/appclient/subsystem/AppClientSubsystemResourceDefinition.java b/appclient/src/main/java/org/jboss/as/appclient/subsystem/AppClientSubsystemResourceDefinition.java index 4a8f1b0bfd56..9d68a7dd1138 100644 --- a/appclient/src/main/java/org/jboss/as/appclient/subsystem/AppClientSubsystemResourceDefinition.java +++ b/appclient/src/main/java/org/jboss/as/appclient/subsystem/AppClientSubsystemResourceDefinition.java @@ -25,11 +25,8 @@ */ public class AppClientSubsystemResourceDefinition extends SimpleResourceDefinition { - static final String MCF_CAPABILITY = "org.wildfly.management.model-controller-client-factory"; - static final String EXECUTOR_CAPABILITY = "org.wildfly.management.executor"; - public static final RuntimeCapability APPCLIENT_CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.appclient", Void.class) - //.addRequirements(MCF_CAPABILITY, EXECUTOR_CAPABILITY) TODO determine why this breaks domain mode provisioning + //.addRequirements(ModelControllerClientFactory.SERVICE_DESCRIPTOR, Capabilities.MANAGEMENT_EXECUTOR) TODO determine why this breaks domain mode provisioning .build(); public static final SimpleAttributeDefinition FILE = diff --git a/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/_private/Capabilities.java b/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/_private/Capabilities.java index 28afc3790d95..02a6c2efd298 100644 --- a/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/_private/Capabilities.java +++ b/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/_private/Capabilities.java @@ -60,9 +60,4 @@ public class Capabilities { * The capability name for the kernel SuspendController */ public static final String SUSPEND_CONTROLLER_CAPABILITY = "org.wildfly.server.suspend-controller"; - - /** - * The capability name for the kernel ProcessStateNotifier. - */ - public static final String PROCESS_STATE_NOTIFIER_CAPABILITY = "org.wildfly.management.process-state-notifier"; } diff --git a/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/BatchEnvironmentProcessor.java b/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/BatchEnvironmentProcessor.java index 19748b100b77..f871fca7803c 100644 --- a/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/BatchEnvironmentProcessor.java +++ b/batch-jberet/src/main/java/org/wildfly/extension/batch/jberet/deployment/BatchEnvironmentProcessor.java @@ -22,6 +22,8 @@ import org.jberet.spi.JobExecutor; import org.jberet.spi.JobOperatorContext; import org.jboss.as.controller.ProcessStateNotifier; +import org.jboss.as.controller.RequirementServiceBuilder; +import org.jboss.as.controller.RequirementServiceTarget; import org.jboss.as.controller.capability.CapabilityServiceSupport; import org.jboss.as.ee.component.EEModuleDescription; import org.jboss.as.ee.structure.DeploymentType; @@ -38,7 +40,6 @@ import org.jboss.modules.Module; import org.jboss.msc.service.ServiceBuilder; import org.jboss.msc.service.ServiceName; -import org.jboss.msc.service.ServiceTarget; import org.wildfly.extension.batch.jberet.BatchConfiguration; import org.wildfly.extension.batch.jberet.BatchServiceNames; import org.wildfly.extension.batch.jberet._private.BatchLogger; @@ -79,7 +80,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU final Module module = deploymentUnit.getAttachment(Attachments.MODULE); final ClassLoader moduleClassLoader = module.getClassLoader(); - final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); + final RequirementServiceTarget serviceTarget = phaseContext.getRequirementServiceTarget(); // Check for a deployment descriptor BatchEnvironmentMetaData metaData = deploymentUnit.getAttachment(BatchAttachments.BATCH_ENVIRONMENT_META_DATA); @@ -160,12 +161,12 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU // Install the JobOperatorService final ServiceName jobOperatorServiceName = BatchServiceNames.jobOperatorServiceName(deploymentUnit); - final ServiceBuilder jobOperatorServiceSB = serviceTarget.addService(jobOperatorServiceName); + final RequirementServiceBuilder jobOperatorServiceSB = serviceTarget.addService(); final Consumer jobOperatorConsumer = jobOperatorServiceSB.provides(jobOperatorServiceName); final Supplier executorSupplier = Services.requireServerExecutor(jobOperatorServiceSB); final Supplier batchConfigSupplier = jobOperatorServiceSB.requires(support.getCapabilityServiceName(Capabilities.BATCH_CONFIGURATION_CAPABILITY.getName())); final Supplier suspendControllerSupplier = jobOperatorServiceSB.requires(support.getCapabilityServiceName(Capabilities.SUSPEND_CONTROLLER_CAPABILITY)); - final Supplier processStateSupplier = jobOperatorServiceSB.requires(support.getCapabilityServiceName(Capabilities.PROCESS_STATE_NOTIFIER_CAPABILITY)); + final Supplier processStateSupplier = jobOperatorServiceSB.requires(ProcessStateNotifier.SERVICE_DESCRIPTOR); final Supplier batchEnvironmentSupplier = jobOperatorServiceSB.requires(BatchServiceNames.batchEnvironmentServiceName(deploymentUnit)); final JobOperatorService jobOperatorService = new JobOperatorService(jobOperatorConsumer, batchConfigSupplier, batchEnvironmentSupplier, executorSupplier, suspendControllerSupplier, processStateSupplier, restartJobsOnResume, deploymentName, jobXmlResolver); jobOperatorServiceSB.setInstance(jobOperatorService); diff --git a/clustering/common/src/main/java/org/jboss/as/clustering/controller/CommonRequirement.java b/clustering/common/src/main/java/org/jboss/as/clustering/controller/CommonRequirement.java index f29f47fafcc3..49a907bad1d5 100644 --- a/clustering/common/src/main/java/org/jboss/as/clustering/controller/CommonRequirement.java +++ b/clustering/common/src/main/java/org/jboss/as/clustering/controller/CommonRequirement.java @@ -12,6 +12,7 @@ import org.jboss.as.naming.service.NamingService; import org.jboss.as.network.SocketBindingManager; import org.wildfly.clustering.service.Requirement; +import org.wildfly.service.descriptor.NullaryServiceDescriptor; /** * Enumerates common requirements for clustering resources. @@ -22,13 +23,17 @@ public enum CommonRequirement implements Requirement, ServiceNameFactoryProvider LOCAL_TRANSACTION_PROVIDER("org.wildfly.transactions.global-default-local-provider", Void.class), MBEAN_SERVER("org.wildfly.management.jmx", MBeanServer.class), NAMING_STORE(NamingService.CAPABILITY_NAME, NamingStore.class), - PATH_MANAGER("org.wildfly.management.path-manager", PathManager.class), - SOCKET_BINDING_MANAGER("org.wildfly.management.socket-binding-manager", SocketBindingManager.class), + PATH_MANAGER(PathManager.SERVICE_DESCRIPTOR), + SOCKET_BINDING_MANAGER(SocketBindingManager.SERVICE_DESCRIPTOR), ; private final String name; private final Class type; private final ServiceNameFactory factory = new RequirementServiceNameFactory(this); + CommonRequirement(NullaryServiceDescriptor descriptor) { + this(descriptor.getName(), descriptor.getType()); + } + CommonRequirement(String name, Class type) { this.name = name; this.type = type; diff --git a/clustering/common/src/main/java/org/jboss/as/clustering/controller/CommonUnaryRequirement.java b/clustering/common/src/main/java/org/jboss/as/clustering/controller/CommonUnaryRequirement.java index 11eb906e4b83..aaa027fcefea 100644 --- a/clustering/common/src/main/java/org/jboss/as/clustering/controller/CommonUnaryRequirement.java +++ b/clustering/common/src/main/java/org/jboss/as/clustering/controller/CommonUnaryRequirement.java @@ -10,10 +10,12 @@ import javax.net.ssl.SSLContext; import javax.sql.DataSource; +import org.jboss.as.controller.services.path.PathManager; import org.jboss.as.network.OutboundSocketBinding; import org.jboss.as.network.SocketBinding; import org.wildfly.clustering.service.UnaryRequirement; import org.wildfly.security.credential.store.CredentialStore; +import org.wildfly.service.descriptor.UnaryServiceDescriptor; /** * Enumerates common unary requirements for clustering resources @@ -23,15 +25,19 @@ public enum CommonUnaryRequirement implements UnaryRequirement, UnaryServiceName CREDENTIAL_STORE("org.wildfly.security.credential-store", CredentialStore.class), DATA_SOURCE("org.wildfly.data-source", DataSource.class), KEY_STORE("org.wildfly.security.key-store", KeyStore.class), - OUTBOUND_SOCKET_BINDING("org.wildfly.network.outbound-socket-binding", OutboundSocketBinding.class), - PATH("org.wildfly.management.path", String.class), - SOCKET_BINDING("org.wildfly.network.socket-binding", SocketBinding.class), + OUTBOUND_SOCKET_BINDING(OutboundSocketBinding.SERVICE_DESCRIPTOR), + PATH(PathManager.PATH_SERVICE_DESCRIPTOR), + SOCKET_BINDING(SocketBinding.SERVICE_DESCRIPTOR), SSL_CONTEXT("org.wildfly.security.ssl-context", SSLContext.class), ; private final String name; private final Class type; private final UnaryServiceNameFactory factory = new UnaryRequirementServiceNameFactory(this); + CommonUnaryRequirement(UnaryServiceDescriptor descriptor) { + this(descriptor.getName(), descriptor.getType()); + } + CommonUnaryRequirement(String name, Class type) { this.name = name; this.type = type; diff --git a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/clustering/common/main/module.xml b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/clustering/common/main/module.xml index dd5502425f64..06bfad07b58b 100644 --- a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/clustering/common/main/module.xml +++ b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/clustering/common/main/module.xml @@ -32,5 +32,6 @@ + diff --git a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/ee/main/module.xml b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/ee/main/module.xml index db66bed68d26..087437b24db1 100644 --- a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/ee/main/module.xml +++ b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/ee/main/module.xml @@ -43,6 +43,7 @@ + diff --git a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/mail/main/module.xml b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/mail/main/module.xml index 83a79f70792f..217efac82be4 100644 --- a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/mail/main/module.xml +++ b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/jboss/as/mail/main/module.xml @@ -16,6 +16,7 @@ + @@ -35,6 +36,6 @@ - + diff --git a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/health/main/module.xml b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/health/main/module.xml index 9a4a83b4c3a0..a6364aa7307a 100644 --- a/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/health/main/module.xml +++ b/ee-feature-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/health/main/module.xml @@ -25,5 +25,6 @@ + diff --git a/ee/src/main/java/org/jboss/as/ee/concurrent/resource/definition/ManagedExecutorDefinitionInjectionSource.java b/ee/src/main/java/org/jboss/as/ee/concurrent/resource/definition/ManagedExecutorDefinitionInjectionSource.java index e263fa683c7a..97b766ffc2d4 100644 --- a/ee/src/main/java/org/jboss/as/ee/concurrent/resource/definition/ManagedExecutorDefinitionInjectionSource.java +++ b/ee/src/main/java/org/jboss/as/ee/concurrent/resource/definition/ManagedExecutorDefinitionInjectionSource.java @@ -7,6 +7,7 @@ import org.glassfish.enterprise.concurrent.AbstractManagedExecutorService; import org.glassfish.enterprise.concurrent.ManagedExecutorServiceAdapter; import org.jboss.as.controller.ProcessStateNotifier; +import org.jboss.as.controller.RequirementServiceBuilder; import org.jboss.as.controller.capability.CapabilityServiceSupport; import org.jboss.as.ee.concurrent.ContextServiceImpl; import org.jboss.as.ee.concurrent.deployers.EEConcurrentDefaultBindingProcessor; @@ -42,7 +43,6 @@ public class ManagedExecutorDefinitionInjectionSource extends ResourceDefinition public static final String HUNG_TASK_THRESHOLD_PROP = "hungTaskThreshold"; public static final String MAX_ASYNC_PROP = "maxAsync"; - private static final String PROCESS_STATE_NOTIFIER_CAPABILITY_NAME = "org.wildfly.management.process-state-notifier"; private static final String REQUEST_CONTROLLER_CAPABILITY_NAME = "org.wildfly.request-controller"; private String contextServiceRef; @@ -69,10 +69,10 @@ public void getResourceValue(final ResolutionContext context, final ServiceBuild try { // install the resource service final ServiceName resourceServiceName = ManagedExecutorServiceResourceDefinition.CAPABILITY.getCapabilityServiceName(resourceName); - final ServiceBuilder resourceServiceBuilder = phaseContext.getServiceTarget().addService(resourceServiceName); + final RequirementServiceBuilder resourceServiceBuilder = phaseContext.getRequirementServiceTarget().addService(); final Consumer consumer = resourceServiceBuilder.provides(resourceServiceName); final Supplier hungTasksPeriodicTerminationService = resourceServiceBuilder.requires(ConcurrentServiceNames.HUNG_TASK_PERIODIC_TERMINATION_SERVICE_NAME); - final Supplier processStateNotifierSupplier = resourceServiceBuilder.requires(capabilityServiceSupport.getCapabilityServiceName(PROCESS_STATE_NOTIFIER_CAPABILITY_NAME)); + final Supplier processStateNotifierSupplier = resourceServiceBuilder.requires(ProcessStateNotifier.SERVICE_DESCRIPTOR); Supplier requestControllerSupplier = null; if (capabilityServiceSupport.hasCapability(REQUEST_CONTROLLER_CAPABILITY_NAME)) { requestControllerSupplier = resourceServiceBuilder.requires(capabilityServiceSupport.getCapabilityServiceName(REQUEST_CONTROLLER_CAPABILITY_NAME)); diff --git a/ee/src/main/java/org/jboss/as/ee/concurrent/resource/definition/ManagedScheduledExecutorDefinitionInjectionSource.java b/ee/src/main/java/org/jboss/as/ee/concurrent/resource/definition/ManagedScheduledExecutorDefinitionInjectionSource.java index d15ea20bedbf..36c78778c951 100644 --- a/ee/src/main/java/org/jboss/as/ee/concurrent/resource/definition/ManagedScheduledExecutorDefinitionInjectionSource.java +++ b/ee/src/main/java/org/jboss/as/ee/concurrent/resource/definition/ManagedScheduledExecutorDefinitionInjectionSource.java @@ -11,6 +11,7 @@ import org.glassfish.enterprise.concurrent.AbstractManagedExecutorService; import org.glassfish.enterprise.concurrent.ManagedScheduledExecutorServiceAdapter; import org.jboss.as.controller.ProcessStateNotifier; +import org.jboss.as.controller.RequirementServiceBuilder; import org.jboss.as.controller.capability.CapabilityServiceSupport; import org.jboss.as.ee.concurrent.ContextServiceImpl; import org.jboss.as.ee.concurrent.deployers.EEConcurrentDefaultBindingProcessor; @@ -42,7 +43,6 @@ public class ManagedScheduledExecutorDefinitionInjectionSource extends ResourceD public static final String HUNG_TASK_THRESHOLD_PROP = "hungTaskThreshold"; public static final String MAX_ASYNC_PROP = "maxAsync"; - private static final String PROCESS_STATE_NOTIFIER_CAPABILITY_NAME = "org.wildfly.management.process-state-notifier"; private static final String REQUEST_CONTROLLER_CAPABILITY_NAME = "org.wildfly.request-controller"; private String contextServiceRef; @@ -68,10 +68,10 @@ public void getResourceValue(final ResolutionContext context, final ServiceBuild try { // install the resource service final ServiceName resourceServiceName = ManagedScheduledExecutorServiceResourceDefinition.CAPABILITY.getCapabilityServiceName(resourceName); - final ServiceBuilder resourceServiceBuilder = phaseContext.getServiceTarget().addService(resourceServiceName); + final RequirementServiceBuilder resourceServiceBuilder = phaseContext.getRequirementServiceTarget().addService(); final Consumer consumer = resourceServiceBuilder.provides(resourceServiceName); final Supplier hungTasksPeriodicTerminationService = resourceServiceBuilder.requires(ConcurrentServiceNames.HUNG_TASK_PERIODIC_TERMINATION_SERVICE_NAME); - final Supplier processStateNotifierSupplier = resourceServiceBuilder.requires(capabilityServiceSupport.getCapabilityServiceName(PROCESS_STATE_NOTIFIER_CAPABILITY_NAME)); + final Supplier processStateNotifierSupplier = resourceServiceBuilder.requires(ProcessStateNotifier.SERVICE_DESCRIPTOR); Supplier requestControllerSupplier = null; if (capabilityServiceSupport.hasCapability(REQUEST_CONTROLLER_CAPABILITY_NAME)) { requestControllerSupplier = resourceServiceBuilder.requires(capabilityServiceSupport.getCapabilityServiceName(REQUEST_CONTROLLER_CAPABILITY_NAME)); diff --git a/ee/src/main/java/org/jboss/as/ee/subsystem/EeCapabilities.java b/ee/src/main/java/org/jboss/as/ee/subsystem/EeCapabilities.java index c1045b5ab218..0f082b1dd58b 100644 --- a/ee/src/main/java/org/jboss/as/ee/subsystem/EeCapabilities.java +++ b/ee/src/main/java/org/jboss/as/ee/subsystem/EeCapabilities.java @@ -6,6 +6,7 @@ package org.jboss.as.ee.subsystem; import org.jboss.as.controller.capability.RuntimeCapability; +import org.jboss.as.controller.services.path.PathManager; /** * The capabilities provided by and required by this subsystem. @@ -15,13 +16,11 @@ public final class EeCapabilities { private static final String CAPABILITY_BASE = "org.wildfly.ee."; - static final String PATH_MANAGER_CAPABILITY = "org.wildfly.management.path-manager"; - public static final String EE_GLOBAL_DIRECTORY_CAPABILITY_NAME = CAPABILITY_BASE + "global-directory"; public static final RuntimeCapability EE_GLOBAL_DIRECTORY_CAPABILITY = RuntimeCapability .Builder.of(EE_GLOBAL_DIRECTORY_CAPABILITY_NAME, true, GlobalDirectoryService.class) - .addRequirements(PATH_MANAGER_CAPABILITY) + .addRequirements(PathManager.SERVICE_DESCRIPTOR) .build(); public static final String ELYTRON_JACC_CAPABILITY = "org.wildfly.security.jacc-policy"; diff --git a/ee/src/main/java/org/jboss/as/ee/subsystem/GlobalDirectoryResourceDefinition.java b/ee/src/main/java/org/jboss/as/ee/subsystem/GlobalDirectoryResourceDefinition.java index b2550010dd5f..3df2953f1a6b 100644 --- a/ee/src/main/java/org/jboss/as/ee/subsystem/GlobalDirectoryResourceDefinition.java +++ b/ee/src/main/java/org/jboss/as/ee/subsystem/GlobalDirectoryResourceDefinition.java @@ -9,7 +9,6 @@ import static org.jboss.as.controller.SimpleAttributeDefinitionBuilder.create; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.FILESYSTEM_PATH; import static org.jboss.as.ee.subsystem.EeCapabilities.EE_GLOBAL_DIRECTORY_CAPABILITY; -import static org.jboss.as.ee.subsystem.EeCapabilities.PATH_MANAGER_CAPABILITY; import java.nio.file.Path; import java.util.Arrays; @@ -110,7 +109,7 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod final CapabilityServiceBuilder serviceBuilder = context.getCapabilityServiceTarget() .addCapability(EE_GLOBAL_DIRECTORY_CAPABILITY); final Consumer provides = serviceBuilder.provides(EE_GLOBAL_DIRECTORY_CAPABILITY); - final Supplier pathManagerSupplier = serviceBuilder.requiresCapability(PATH_MANAGER_CAPABILITY, PathManager.class); + final Supplier pathManagerSupplier = serviceBuilder.requires(PathManager.SERVICE_DESCRIPTOR); Service globalDirectoryService = new GlobalDirectoryService(pathManagerSupplier, provides, context.getCurrentAddressValue(), path, relativeTo); diff --git a/ee/src/main/java/org/jboss/as/ee/subsystem/ManagedExecutorServiceAdd.java b/ee/src/main/java/org/jboss/as/ee/subsystem/ManagedExecutorServiceAdd.java index eb06febb4101..c62526d42e28 100644 --- a/ee/src/main/java/org/jboss/as/ee/subsystem/ManagedExecutorServiceAdd.java +++ b/ee/src/main/java/org/jboss/as/ee/subsystem/ManagedExecutorServiceAdd.java @@ -33,7 +33,6 @@ */ public class ManagedExecutorServiceAdd extends AbstractAddStepHandler { - private static final String PROCESS_STATE_NOTIFIER_CAPABILITY_NAME = "org.wildfly.management.process-state-notifier"; private static final String REQUEST_CONTROLLER_CAPABILITY_NAME = "org.wildfly.request-controller"; static final ManagedExecutorServiceAdd INSTANCE = new ManagedExecutorServiceAdd(); @@ -112,7 +111,7 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod } final Supplier threadFactorySupplier = threadFactory != null ? serviceBuilder.requiresCapability(ManagedThreadFactoryResourceDefinition.CAPABILITY.getName(), ManagedThreadFactoryImpl.class, threadFactory) : null; - final Supplier processStateNotifierSupplier = serviceBuilder.requiresCapability(PROCESS_STATE_NOTIFIER_CAPABILITY_NAME, ProcessStateNotifier.class); + final Supplier processStateNotifierSupplier = serviceBuilder.requires(ProcessStateNotifier.SERVICE_DESCRIPTOR); Supplier requestControllerSupplier = null; if (context.hasOptionalCapability(REQUEST_CONTROLLER_CAPABILITY_NAME, ManagedExecutorServiceResourceDefinition.CAPABILITY.getDynamicName(context.getCurrentAddress()), null)) { requestControllerSupplier = serviceBuilder.requiresCapability(REQUEST_CONTROLLER_CAPABILITY_NAME, RequestController.class); diff --git a/ee/src/main/java/org/jboss/as/ee/subsystem/ManagedScheduledExecutorServiceAdd.java b/ee/src/main/java/org/jboss/as/ee/subsystem/ManagedScheduledExecutorServiceAdd.java index 8542894666d4..61202893fc99 100644 --- a/ee/src/main/java/org/jboss/as/ee/subsystem/ManagedScheduledExecutorServiceAdd.java +++ b/ee/src/main/java/org/jboss/as/ee/subsystem/ManagedScheduledExecutorServiceAdd.java @@ -29,7 +29,6 @@ */ public class ManagedScheduledExecutorServiceAdd extends AbstractAddStepHandler { - private static final String PROCESS_STATE_NOTIFIER_CAPABILITY_NAME = "org.wildfly.management.process-state-notifier"; private static final String REQUEST_CONTROLLER_CAPABILITY_NAME = "org.wildfly.request-controller"; static final ManagedScheduledExecutorServiceAdd INSTANCE = new ManagedScheduledExecutorServiceAdd(); @@ -81,7 +80,7 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod } final Supplier managedThreadFactorySupplier = threadFactory != null ? serviceBuilder.requiresCapability(ManagedThreadFactoryResourceDefinition.CAPABILITY.getName(), ManagedThreadFactoryImpl.class, threadFactory) : null; - final Supplier processStateNotifierSupplier = serviceBuilder.requiresCapability(PROCESS_STATE_NOTIFIER_CAPABILITY_NAME, ProcessStateNotifier.class); + final Supplier processStateNotifierSupplier = serviceBuilder.requires(ProcessStateNotifier.SERVICE_DESCRIPTOR); Supplier requestControllerSupplier = null; if (context.hasOptionalCapability(REQUEST_CONTROLLER_CAPABILITY_NAME, ManagedScheduledExecutorServiceResourceDefinition.CAPABILITY.getDynamicName(context.getCurrentAddress()), null)) { requestControllerSupplier = serviceBuilder.requiresCapability(REQUEST_CONTROLLER_CAPABILITY_NAME, RequestController.class); diff --git a/ee/src/test/java/org/jboss/as/ee/subsystem/EeSubsystemTestCase.java b/ee/src/test/java/org/jboss/as/ee/subsystem/EeSubsystemTestCase.java index 922bb6d41b75..44e5bf603afb 100644 --- a/ee/src/test/java/org/jboss/as/ee/subsystem/EeSubsystemTestCase.java +++ b/ee/src/test/java/org/jboss/as/ee/subsystem/EeSubsystemTestCase.java @@ -6,6 +6,7 @@ import java.io.IOException; +import org.jboss.as.controller.services.path.PathManager; import org.jboss.as.subsystem.test.AbstractSubsystemBaseTest; import org.jboss.as.subsystem.test.AdditionalInitialization; @@ -31,6 +32,6 @@ protected String getSubsystemXsdPath() throws Exception { @Override protected AdditionalInitialization createAdditionalInitialization() { - return AdditionalInitialization.withCapabilities(EeCapabilities.PATH_MANAGER_CAPABILITY); + return AdditionalInitialization.withCapabilities(PathManager.SERVICE_DESCRIPTOR.getName()); } } diff --git a/ejb3/src/main/java/org/jboss/as/ejb3/subsystem/FileDataStoreAdd.java b/ejb3/src/main/java/org/jboss/as/ejb3/subsystem/FileDataStoreAdd.java index 095746033524..3c103247823b 100644 --- a/ejb3/src/main/java/org/jboss/as/ejb3/subsystem/FileDataStoreAdd.java +++ b/ejb3/src/main/java/org/jboss/as/ejb3/subsystem/FileDataStoreAdd.java @@ -31,7 +31,6 @@ public class FileDataStoreAdd extends AbstractAddStepHandler { private static final String TRANSACTION_SYNCHRONIZATION_REGISTRY_CAPABILITY_NAME = "org.wildfly.transactions.transaction-synchronization-registry"; private static final String TRANSACTION_GLOBAL_DEFAULT_LOCAL_PROVIDER_CAPABILITY_NAME = "org.wildfly.transactions.global-default-local-provider"; - private static final String PATH_MANAGER_CAPABILITY_NAME = "org.wildfly.management.path-manager"; FileDataStoreAdd(AttributeDefinition... attributes) { super(attributes); @@ -50,7 +49,7 @@ protected void performRuntime(final OperationContext context, ModelNode operatio builder.requiresCapability(TRANSACTION_GLOBAL_DEFAULT_LOCAL_PROVIDER_CAPABILITY_NAME, Void.class); final Supplier txnRegistrySupplier = builder.requiresCapability(TRANSACTION_SYNCHRONIZATION_REGISTRY_CAPABILITY_NAME, TransactionSynchronizationRegistry.class); final Supplier moduleLoaderSupplier = builder.requires(Services.JBOSS_SERVICE_MODULE_LOADER); - final Supplier pathManagerSupplier = builder.requiresCapability(PATH_MANAGER_CAPABILITY_NAME, PathManager.class); + final Supplier pathManagerSupplier = builder.requires(PathManager.SERVICE_DESCRIPTOR); final FileTimerPersistence fileTimerPersistence = new FileTimerPersistence(consumer, txnRegistrySupplier, moduleLoaderSupplier, pathManagerSupplier, true, path, relativeTo); builder.setInstance(fileTimerPersistence); builder.install(); diff --git a/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/micrometer/main/module.xml b/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/micrometer/main/module.xml index aff3adb45f33..4b71d76dd2fc 100644 --- a/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/micrometer/main/module.xml +++ b/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/micrometer/main/module.xml @@ -36,6 +36,7 @@ + diff --git a/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/microprofile/config-smallrye/main/module.xml b/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/microprofile/config-smallrye/main/module.xml index ef560bc5ea0f..4bc1b7ae755c 100644 --- a/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/microprofile/config-smallrye/main/module.xml +++ b/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/microprofile/config-smallrye/main/module.xml @@ -16,14 +16,15 @@ + - + + - - - + + diff --git a/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/microprofile/opentracing-smallrye/main/module.xml b/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/microprofile/opentracing-smallrye/main/module.xml index 9ae48be1c519..7bbadd27b166 100644 --- a/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/microprofile/opentracing-smallrye/main/module.xml +++ b/galleon-pack/galleon-shared/src/main/resources/modules/system/layers/base/org/wildfly/extension/microprofile/opentracing-smallrye/main/module.xml @@ -27,6 +27,7 @@ + diff --git a/health/src/main/java/org/wildfly/extension/health/HealthSubsystemDefinition.java b/health/src/main/java/org/wildfly/extension/health/HealthSubsystemDefinition.java index a3b2d21983e4..eaa5feacb93e 100644 --- a/health/src/main/java/org/wildfly/extension/health/HealthSubsystemDefinition.java +++ b/health/src/main/java/org/wildfly/extension/health/HealthSubsystemDefinition.java @@ -8,11 +8,13 @@ import java.util.Collection; import org.jboss.as.controller.AttributeDefinition; +import org.jboss.as.controller.ModelControllerClientFactory; import org.jboss.as.controller.PersistentResourceDefinition; import org.jboss.as.controller.ServiceRemoveStepHandler; import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.as.controller.SimpleResourceDefinition; import org.jboss.as.controller.capability.RuntimeCapability; +import org.jboss.as.controller.management.Capabilities; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; @@ -23,14 +25,12 @@ public class HealthSubsystemDefinition extends PersistentResourceDefinition { static final String HTTP_EXTENSIBILITY_CAPABILITY = "org.wildfly.management.http.extensible"; public static final String HEALTH_HTTP_SECURITY_CAPABILITY = "org.wildfly.extension.health.http-context.security-enabled"; - static final String CLIENT_FACTORY_CAPABILITY ="org.wildfly.management.model-controller-client-factory"; - static final String MANAGEMENT_EXECUTOR ="org.wildfly.management.executor"; static final RuntimeCapability HEALTH_HTTP_CONTEXT_CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.extension.health.http-context", HealthContextService.class) .addRequirements(HTTP_EXTENSIBILITY_CAPABILITY) .build(); static final RuntimeCapability SERVER_HEALTH_PROBES_CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.extension.health.server-probes", ServerProbesService.class) - .addRequirements(CLIENT_FACTORY_CAPABILITY, MANAGEMENT_EXECUTOR) + .addRequirements(ModelControllerClientFactory.SERVICE_DESCRIPTOR, Capabilities.MANAGEMENT_EXECUTOR) .build(); diff --git a/health/src/main/java/org/wildfly/extension/health/ServerProbes.java b/health/src/main/java/org/wildfly/extension/health/ServerProbes.java index f388523af9d4..bc46ef2223f2 100644 --- a/health/src/main/java/org/wildfly/extension/health/ServerProbes.java +++ b/health/src/main/java/org/wildfly/extension/health/ServerProbes.java @@ -20,12 +20,12 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUCCESS; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUSPEND_STATE; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE; -import static org.jboss.as.server.suspend.SuspendController.State.RUNNING; import java.util.List; import org.jboss.as.controller.LocalModelControllerClient; import org.jboss.as.controller.PathAddress; +import org.jboss.as.server.suspend.SuspendController; import org.jboss.dmr.ModelNode; class ServerProbes { @@ -125,7 +125,7 @@ public Outcome getOutcome() { String value = result.asString(); ModelNode data = new ModelNode(); data.add(VALUE, value); - return new Outcome(RUNNING.toString().equals(value), data); + return new Outcome(SuspendController.State.RUNNING.toString().equals(value), data); } @Override diff --git a/health/src/main/java/org/wildfly/extension/health/ServerProbesService.java b/health/src/main/java/org/wildfly/extension/health/ServerProbesService.java index 380763ef954d..192c2e3c8b6d 100644 --- a/health/src/main/java/org/wildfly/extension/health/ServerProbesService.java +++ b/health/src/main/java/org/wildfly/extension/health/ServerProbesService.java @@ -4,8 +4,6 @@ */ package org.wildfly.extension.health; -import static org.wildfly.extension.health.HealthSubsystemDefinition.CLIENT_FACTORY_CAPABILITY; -import static org.wildfly.extension.health.HealthSubsystemDefinition.MANAGEMENT_EXECUTOR; import static org.wildfly.extension.health.HealthSubsystemDefinition.SERVER_HEALTH_PROBES_CAPABILITY; import java.util.HashSet; @@ -14,11 +12,12 @@ import java.util.function.Consumer; import java.util.function.Supplier; +import org.jboss.as.controller.CapabilityServiceBuilder; import org.jboss.as.controller.LocalModelControllerClient; import org.jboss.as.controller.ModelControllerClientFactory; import org.jboss.as.controller.OperationContext; +import org.jboss.as.controller.management.Capabilities; import org.jboss.msc.Service; -import org.jboss.msc.service.ServiceBuilder; import org.jboss.msc.service.StartContext; import org.jboss.msc.service.StartException; import org.jboss.msc.service.StopContext; @@ -33,11 +32,11 @@ public class ServerProbesService implements Service { private final Set serverProbes = new HashSet<>(); static void install(OperationContext context) { - ServiceBuilder sb = context.getServiceTarget().addService(SERVER_HEALTH_PROBES_CAPABILITY.getCapabilityServiceName()); + CapabilityServiceBuilder sb = context.getCapabilityServiceTarget().addCapability(SERVER_HEALTH_PROBES_CAPABILITY); Consumer consumer = sb.provides(SERVER_HEALTH_PROBES_CAPABILITY.getCapabilityServiceName()); - Supplier modelControllerClientFactory = sb.requires(context.getCapabilityServiceName(CLIENT_FACTORY_CAPABILITY, ModelControllerClientFactory.class)); - Supplier managementExecutor = sb.requires(context.getCapabilityServiceName(MANAGEMENT_EXECUTOR, Executor.class)); + Supplier modelControllerClientFactory = sb.requires(ModelControllerClientFactory.SERVICE_DESCRIPTOR); + Supplier managementExecutor = sb.requires(Capabilities.MANAGEMENT_EXECUTOR); sb.setInstance(new ServerProbesService(consumer, modelControllerClientFactory, managementExecutor)) .install(); diff --git a/jdr/src/main/java/org/jboss/as/jdr/JdrReportService.java b/jdr/src/main/java/org/jboss/as/jdr/JdrReportService.java index b2562fbce297..aa21f2902656 100644 --- a/jdr/src/main/java/org/jboss/as/jdr/JdrReportService.java +++ b/jdr/src/main/java/org/jboss/as/jdr/JdrReportService.java @@ -5,11 +5,9 @@ package org.jboss.as.jdr; -import static org.jboss.as.jdr.JdrReportSubsystemDefinition.EXECUTOR_CAPABILITY; import static org.jboss.as.jdr.JdrReportSubsystemDefinition.JDR_CAPABILITY; -import static org.jboss.as.jdr.JdrReportSubsystemDefinition.MCF_CAPABILITY; -import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executor; import java.util.function.Consumer; import java.util.function.Supplier; @@ -18,8 +16,8 @@ import org.jboss.as.controller.LocalModelControllerClient; import org.jboss.as.controller.ModelControllerClientFactory; import org.jboss.as.controller.OperationFailedException; +import org.jboss.as.controller.management.Capabilities; import org.jboss.as.server.ServerEnvironment; -import org.jboss.as.server.ServerEnvironmentService; import org.jboss.msc.Service; import org.jboss.msc.service.ServiceController; import org.jboss.msc.service.StartContext; @@ -44,12 +42,10 @@ static void addService(final CapabilityServiceTarget target, final Consumer builder = target.addCapability(JDR_CAPABILITY); Consumer mscConsumer = builder.provides(JDR_CAPABILITY); - Supplier mcfSupplier = - builder.requiresCapability(MCF_CAPABILITY, ModelControllerClientFactory.class); - Supplier esSupplier = - builder.requiresCapability(EXECUTOR_CAPABILITY, ExecutorService.class); - Supplier seSupplier = builder.requires(ServerEnvironmentService.SERVICE_NAME); - builder.setInstance(new JdrReportService(subsystemConsumer, mscConsumer, mcfSupplier, esSupplier, seSupplier)) + Supplier mcfSupplier = builder.requires(ModelControllerClientFactory.SERVICE_DESCRIPTOR); + Supplier executorSupplier = builder.requires(Capabilities.MANAGEMENT_EXECUTOR); + Supplier seSupplier = builder.requires(ServerEnvironment.SERVICE_DESCRIPTOR); + builder.setInstance(new JdrReportService(subsystemConsumer, mscConsumer, mcfSupplier, executorSupplier, seSupplier)) .setInitialMode(ServiceController.Mode.ACTIVE).install(); } @@ -59,18 +55,18 @@ static void addService(final CapabilityServiceTarget target, final Consumer mscConsumer; private final Supplier serverEnvironmentSupplier; private final Supplier clientFactorySupplier; - private final Supplier executorServiceSupplier; + private final Supplier executorSupplier; private JdrReportService(final Consumer subsystemConsumer, final Consumer consumer, final Supplier mcfSupplier, - final Supplier executorServiceSupplier, + final Supplier executorSupplier, final Supplier seSupplier) { this.subsystemConsumer = subsystemConsumer; this.mscConsumer = consumer; this.serverEnvironmentSupplier = seSupplier; this.clientFactorySupplier = mcfSupplier; - this.executorServiceSupplier = executorServiceSupplier; + this.executorSupplier = executorSupplier; } /** @@ -78,7 +74,7 @@ private JdrReportService(final Consumer subsystemConsumer, */ public JdrReport collect() throws OperationFailedException { - try (LocalModelControllerClient client = clientFactorySupplier.get().createSuperUserClient(executorServiceSupplier.get())) { + try (LocalModelControllerClient client = clientFactorySupplier.get().createSuperUserClient(executorSupplier.get())) { JdrRunner runner = new JdrRunner(true); ServerEnvironment serverEnvironment = serverEnvironmentSupplier.get(); runner.setJbossHomeDir(serverEnvironment.getHomeDir().getAbsolutePath()); diff --git a/jdr/src/main/java/org/jboss/as/jdr/JdrReportSubsystemDefinition.java b/jdr/src/main/java/org/jboss/as/jdr/JdrReportSubsystemDefinition.java index ce43daab19a8..b99e9ebdb221 100644 --- a/jdr/src/main/java/org/jboss/as/jdr/JdrReportSubsystemDefinition.java +++ b/jdr/src/main/java/org/jboss/as/jdr/JdrReportSubsystemDefinition.java @@ -20,11 +20,8 @@ */ public class JdrReportSubsystemDefinition extends SimpleResourceDefinition { - static final String MCF_CAPABILITY = "org.wildfly.management.model-controller-client-factory"; - static final String EXECUTOR_CAPABILITY = "org.wildfly.management.executor"; - static final RuntimeCapability JDR_CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.jdr", JdrReportCollector.class) - //.addRequirements(MCF_CAPABILITY, EXECUTOR_CAPABILITY) TODO determine why this breaks domain mode provisioning + //.addRequirements(ModelControllerClientFactory.SERVICE_DESCRIPTOR, Capabilities.MANAGEMENT_EXECUTOR) TODO determine why this breaks domain mode provisioning .build(); private final AtomicReference collectorReference; diff --git a/jdr/src/test/java/org/jboss/as/jdr/JdrSubsystemTestCase.java b/jdr/src/test/java/org/jboss/as/jdr/JdrSubsystemTestCase.java index 76ce2fa9d271..48427007f1ba 100644 --- a/jdr/src/test/java/org/jboss/as/jdr/JdrSubsystemTestCase.java +++ b/jdr/src/test/java/org/jboss/as/jdr/JdrSubsystemTestCase.java @@ -5,19 +5,18 @@ */ package org.jboss.as.jdr; -import static org.jboss.as.jdr.JdrReportSubsystemDefinition.EXECUTOR_CAPABILITY; - import java.io.IOException; import java.util.Collections; import java.util.EnumSet; import java.util.Locale; -import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executor; import javax.xml.stream.XMLStreamException; import org.jboss.as.controller.RunningMode; import org.jboss.as.controller.capability.registry.RuntimeCapabilityRegistry; import org.jboss.as.controller.extension.ExtensionRegistry; +import org.jboss.as.controller.management.Capabilities; import org.jboss.as.controller.registry.ManagementResourceRegistration; import org.jboss.as.controller.registry.Resource; import org.jboss.as.subsystem.test.AbstractSubsystemBaseTest; @@ -82,7 +81,7 @@ protected RunningMode getRunningMode() { @Override protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) { super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry); - registerServiceCapabilities(capabilityRegistry, Collections.singletonMap(EXECUTOR_CAPABILITY, ExecutorService.class)); + registerServiceCapabilities(capabilityRegistry, Collections.singletonMap(Capabilities.MANAGEMENT_EXECUTOR.getName(), Executor.class)); } }; } diff --git a/legacy/opentracing-extension/pom.xml b/legacy/opentracing-extension/pom.xml index ad7589a2966a..41f78fbc72d9 100644 --- a/legacy/opentracing-extension/pom.xml +++ b/legacy/opentracing-extension/pom.xml @@ -55,6 +55,10 @@ org.wildfly.core wildfly-controller + + org.wildfly.core + wildfly-network + org.jboss.logging jboss-logging diff --git a/legacy/opentracing-extension/src/main/java/org/wildfly/extension/microprofile/opentracing/TracerAttributes.java b/legacy/opentracing-extension/src/main/java/org/wildfly/extension/microprofile/opentracing/TracerAttributes.java index 63b2b7efcf86..2d69719f2f7e 100644 --- a/legacy/opentracing-extension/src/main/java/org/wildfly/extension/microprofile/opentracing/TracerAttributes.java +++ b/legacy/opentracing-extension/src/main/java/org/wildfly/extension/microprofile/opentracing/TracerAttributes.java @@ -12,6 +12,7 @@ import org.jboss.as.controller.access.management.SensitiveTargetAccessConstraintDefinition; import org.jboss.as.controller.client.helpers.MeasurementUnit; import org.jboss.as.controller.operations.validation.StringAllowedValuesValidator; +import org.jboss.as.network.OutboundSocketBinding; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; @@ -22,8 +23,6 @@ */ public class TracerAttributes { - static final String OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME = "org.wildfly.network.outbound-socket-binding"; - private static final String[] ALLOWED_SAMPLER_TYPE = {"const", "probabilistic", "ratelimiting", "remote"}; public static final StringListAttributeDefinition PROPAGATION = StringListAttributeDefinition.Builder.of(TracerConfigurationConstants.PROPAGATION) @@ -55,7 +54,7 @@ public class TracerAttributes { public static final SimpleAttributeDefinition SENDER_BINDING = SimpleAttributeDefinitionBuilder.create(TracerConfigurationConstants.SENDER_AGENT_BINDING, ModelType.STRING, true) .setAttributeGroup("sender-configuration") - .setCapabilityReference(OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME) + .setCapabilityReference(OutboundSocketBinding.SERVICE_DESCRIPTOR.getName()) .addAccessConstraint(SensitiveTargetAccessConstraintDefinition.SOCKET_BINDING_REF) .setRestartAllServices() .build(); diff --git a/mail/src/main/java/org/jboss/as/mail/extension/MailServerDefinition.java b/mail/src/main/java/org/jboss/as/mail/extension/MailServerDefinition.java index d91e4f78c254..1b04020748d5 100644 --- a/mail/src/main/java/org/jboss/as/mail/extension/MailServerDefinition.java +++ b/mail/src/main/java/org/jboss/as/mail/extension/MailServerDefinition.java @@ -28,6 +28,7 @@ import org.jboss.as.controller.registry.ManagementResourceRegistration; import org.jboss.as.controller.registry.OperationEntry.Flag; import org.jboss.as.controller.security.CredentialReference; +import org.jboss.as.network.OutboundSocketBinding; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; @@ -36,7 +37,6 @@ * @since 7.1.0 */ class MailServerDefinition extends PersistentResourceDefinition { - static final String OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME = "org.wildfly.network.outbound-socket-binding"; static final String CREDENTIAL_STORE_CAPABILITY = "org.wildfly.security.credential-store"; static final RuntimeCapability SERVER_CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.mail.session.server", true) @@ -56,7 +56,7 @@ class MailServerDefinition extends PersistentResourceDefinition { .build(); static final SimpleAttributeDefinition OUTBOUND_SOCKET_BINDING_REF_OPTIONAL = SimpleAttributeDefinitionBuilder.create(OUTBOUND_SOCKET_BINDING_REF) - .setCapabilityReference(OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME) + .setCapabilityReference(OutboundSocketBinding.SERVICE_DESCRIPTOR.getName()) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setRequired(false) .build(); diff --git a/mail/src/main/java/org/jboss/as/mail/extension/MailSessionAdd.java b/mail/src/main/java/org/jboss/as/mail/extension/MailSessionAdd.java index 1022e6c0db26..fa2a6bcbfc3f 100644 --- a/mail/src/main/java/org/jboss/as/mail/extension/MailSessionAdd.java +++ b/mail/src/main/java/org/jboss/as/mail/extension/MailSessionAdd.java @@ -7,7 +7,6 @@ import static org.jboss.as.controller.security.CredentialReference.KEY_DELIMITER; import static org.jboss.as.controller.security.CredentialReference.rollbackCredentialStoreUpdate; -import static org.jboss.as.mail.extension.MailServerDefinition.OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME; import static org.jboss.as.mail.extension.MailSessionDefinition.ATTRIBUTES; import static org.jboss.as.mail.extension.MailSessionDefinition.SESSION_CAPABILITY; import static org.jboss.as.mail.extension.MailSubsystemModel.CUSTOM; @@ -203,7 +202,7 @@ public static String getJndiName(final String rawJndiName) { } private static Supplier requireOutboundSocketBinding(OperationContext context, ServiceBuilder builder, String ref) { - return (ref != null) ? builder.requires(context.getCapabilityServiceName(OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, OutboundSocketBinding.class, ref)) : null; + return (ref != null) ? builder.requires(context.getCapabilityServiceName(OutboundSocketBinding.SERVICE_DESCRIPTOR, ref)) : null; } static MailSessionConfig from(final OperationContext operationContext, final ModelNode model, ServiceBuilder builder) throws OperationFailedException { diff --git a/mail/src/test/java/org/jboss/as/mail/extension/MailSubsystemTestCase.java b/mail/src/test/java/org/jboss/as/mail/extension/MailSubsystemTestCase.java index 7f8e5fd2ec08..392cc077a8c5 100644 --- a/mail/src/test/java/org/jboss/as/mail/extension/MailSubsystemTestCase.java +++ b/mail/src/test/java/org/jboss/as/mail/extension/MailSubsystemTestCase.java @@ -306,7 +306,7 @@ protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegis registerServiceCapabilities(capabilityRegistry, capabilities); registerCapabilities(capabilityRegistry, - RuntimeCapability.Builder.of("org.wildfly.network.outbound-socket-binding", true, OutboundSocketBinding.class).build(), + RuntimeCapability.Builder.of(OutboundSocketBinding.SERVICE_DESCRIPTOR).build(), RuntimeCapability.Builder.of("org.wildfly.security.ssl-context", true, SSLContext.class).build() ); diff --git a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/Capabilities.java b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/Capabilities.java index a615a1f894bc..4b5d8f36b1e1 100644 --- a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/Capabilities.java +++ b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/Capabilities.java @@ -7,8 +7,6 @@ import javax.net.ssl.SSLContext; import org.jboss.as.controller.capability.RuntimeCapability; -import org.jboss.as.network.OutboundSocketBinding; -import org.jboss.as.network.SocketBinding; /** * Capabilities for the messaging-activemq extension. This is not to be used outside of this extension. @@ -60,13 +58,6 @@ public class Capabilities { */ static final String ELYTRON_DOMAIN_CAPABILITY = "org.wildfly.security.security-domain"; - /** - * The capability for the PathManager - * - * @see documentation - */ - static final String PATH_MANAGER_CAPABILITY = "org.wildfly.management.path-manager"; - /** * The capability for the Http Listener Registry * @@ -80,34 +71,6 @@ public class Capabilities { * @see documentation */ static final String HTTP_UPGRADE_REGISTRY_CAPABILITY_NAME = "org.wildfly.undertow.listener.http-upgrade-registry"; -/** - * The capability for the SocketBinding capability - * - * @see documentation - */ - public static final String SOCKET_BINDING_CAPABILITY_NAME = "org.wildfly.network.socket-binding"; - - /** - * The capability for the SocketBinding capability - * - * @see documentation - */ - public static final RuntimeCapability SOCKET_BINDING_CAPABILITY = RuntimeCapability.Builder.of(SOCKET_BINDING_CAPABILITY_NAME, true, SocketBinding.class) - .build(); - - /** - * A capability for the current messaging-activemq server configuration. - * - * @see Capability documentation - */ - public static final String OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME ="org.wildfly.network.outbound-socket-binding"; - /** - * A capability for the current messaging-activemq server configuration. - * - * @see Capability documentation - */ - public static final RuntimeCapability OUTBOUND_SOCKET_BINDING_CAPABILITY = RuntimeCapability.Builder.of(OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, true, OutboundSocketBinding.class) - .build(); /** * The capability name for the Elytron SSL context. diff --git a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/MessagingSubsystemAdd.java b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/MessagingSubsystemAdd.java index 030dcbd17f55..5c63b5a98156 100644 --- a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/MessagingSubsystemAdd.java +++ b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/MessagingSubsystemAdd.java @@ -7,9 +7,7 @@ import static org.apache.activemq.artemis.api.core.client.ActiveMQClient.SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY; import static org.apache.activemq.artemis.api.core.client.ActiveMQClient.THREAD_POOL_MAX_SIZE_PROPERTY_KEY; -import static org.jboss.as.server.services.net.SocketBindingResourceDefinition.SOCKET_BINDING_CAPABILITY; import static org.jboss.as.weld.Capabilities.WELD_CAPABILITY_NAME; -import static org.wildfly.extension.messaging.activemq.Capabilities.OUTBOUND_SOCKET_BINDING_CAPABILITY; import static org.wildfly.extension.messaging.activemq.CommonAttributes.JGROUPS_BROADCAST_GROUP; import static org.wildfly.extension.messaging.activemq.CommonAttributes.JGROUPS_DISCOVERY_GROUP; import static org.wildfly.extension.messaging.activemq.CommonAttributes.JGROUPS_CLUSTER; @@ -37,6 +35,8 @@ import org.jboss.as.controller.OperationStepHandler; import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.registry.Resource; +import org.jboss.as.network.OutboundSocketBinding; +import org.jboss.as.network.SocketBinding; import org.jboss.as.server.AbstractDeploymentChainStep; import org.jboss.as.server.DeploymentProcessorTarget; import org.jboss.as.server.deployment.Phase; @@ -159,12 +159,12 @@ public void execute(OperationContext context, ModelNode operation) throws Operat for (final String connectorSocketBinding : connectorsSocketBindings) { // find whether the connectorSocketBinding references a SocketBinding or an OutboundSocketBinding if (outbounds.get(connectorSocketBinding)) { - final ServiceName outboundSocketName = OUTBOUND_SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(connectorSocketBinding); + final ServiceName outboundSocketName = context.getCapabilityServiceName(OutboundSocketBinding.SERVICE_DESCRIPTOR, connectorSocketBinding); outboundSocketBindings.put(connectorSocketBinding, outboundSocketName); } else { // check if the socket binding has not already been added by the acceptors if (!socketBindings.containsKey(connectorSocketBinding)) { - socketBindings.put(connectorSocketBinding, SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(connectorSocketBinding)); + socketBindings.put(connectorSocketBinding, context.getCapabilityServiceName(SocketBinding.SERVICE_DESCRIPTOR, connectorSocketBinding)); } } } diff --git a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/ServerAdd.java b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/ServerAdd.java index 276a097261d2..0a1a1f09432b 100644 --- a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/ServerAdd.java +++ b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/ServerAdd.java @@ -17,10 +17,6 @@ import static org.wildfly.extension.messaging.activemq.Capabilities.ELYTRON_SSL_CONTEXT_CAPABILITY_NAME; import static org.wildfly.extension.messaging.activemq.Capabilities.HTTP_UPGRADE_REGISTRY_CAPABILITY_NAME; import static org.wildfly.extension.messaging.activemq.Capabilities.JMX_CAPABILITY; -import static org.wildfly.extension.messaging.activemq.Capabilities.OUTBOUND_SOCKET_BINDING_CAPABILITY; -import static org.wildfly.extension.messaging.activemq.Capabilities.OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME; -import static org.wildfly.extension.messaging.activemq.Capabilities.PATH_MANAGER_CAPABILITY; -import static org.wildfly.extension.messaging.activemq.Capabilities.SOCKET_BINDING_CAPABILITY_NAME; import static org.wildfly.extension.messaging.activemq.CommonAttributes.ADDRESS_SETTING; import static org.wildfly.extension.messaging.activemq.CommonAttributes.BINDINGS_DIRECTORY; import static org.wildfly.extension.messaging.activemq.CommonAttributes.HTTP_ACCEPTOR; @@ -298,8 +294,8 @@ public void execute(OperationContext context, ModelNode operation) throws Operat // Add the ActiveMQ Service ServiceName activeMQServiceName = MessagingServices.getActiveMQServiceName(serverName); - final CapabilityServiceBuilder serviceBuilder = capabilityServiceTarget.addCapability(ACTIVEMQ_SERVER_CAPABILITY); - Supplier pathManager = serviceBuilder.requiresCapability(PATH_MANAGER_CAPABILITY, PathManager.class); + final CapabilityServiceBuilder serviceBuilder = capabilityServiceTarget.addCapability(ACTIVEMQ_SERVER_CAPABILITY); + Supplier pathManager = serviceBuilder.requires(PathManager.SERVICE_DESCRIPTOR); Optional> dataSource = Optional.empty(); String dataSourceName = JOURNAL_DATASOURCE.resolveModelAttribute(context, model).asStringOrNull(); @@ -338,7 +334,7 @@ public void execute(OperationContext context, ModelNode operation) throws Operat Map> socketBindings = new HashMap<>(); for (final String socketBindingName : socketBindingNames) { - Supplier socketBinding = serviceBuilder.requiresCapability(SOCKET_BINDING_CAPABILITY_NAME, SocketBinding.class, socketBindingName); + Supplier socketBinding = serviceBuilder.requires(SocketBinding.SERVICE_DESCRIPTOR, socketBindingName); socketBindings.put(socketBindingName, socketBinding); } @@ -356,13 +352,12 @@ public void execute(OperationContext context, ModelNode operation) throws Operat for (final String connectorSocketBinding : connectorsSocketBindings) { // find whether the connectorSocketBinding references a SocketBinding or an OutboundSocketBinding if (outbounds.get(connectorSocketBinding)) { - final ServiceName outboundSocketName = OUTBOUND_SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(connectorSocketBinding); - Supplier outboundSocketBinding = serviceBuilder.requiresCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, OutboundSocketBinding.class, connectorSocketBinding); + Supplier outboundSocketBinding = serviceBuilder.requires(OutboundSocketBinding.SERVICE_DESCRIPTOR, connectorSocketBinding); outboundSocketBindings.put(connectorSocketBinding, outboundSocketBinding); } else { // check if the socket binding has not already been added by the acceptors if (!socketBindings.containsKey(connectorSocketBinding)) { - Supplier socketBinding = serviceBuilder.requiresCapability(SOCKET_BINDING_CAPABILITY_NAME, SocketBinding.class, connectorSocketBinding); + Supplier socketBinding = serviceBuilder.requires(SocketBinding.SERVICE_DESCRIPTOR, connectorSocketBinding); socketBindings.put(connectorSocketBinding, socketBinding); } } diff --git a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/TransportConfigOperationHandlers.java b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/TransportConfigOperationHandlers.java index b23a6142c18b..696805001eb1 100644 --- a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/TransportConfigOperationHandlers.java +++ b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/TransportConfigOperationHandlers.java @@ -7,8 +7,6 @@ import static org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME; import static org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.ACTIVEMQ_SERVER_NAME; import static org.wildfly.extension.messaging.activemq.AbstractTransportDefinition.CONNECTOR_CAPABILITY; -import static org.wildfly.extension.messaging.activemq.Capabilities.OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME; -import static org.wildfly.extension.messaging.activemq.Capabilities.SOCKET_BINDING_CAPABILITY_NAME; import static org.wildfly.extension.messaging.activemq.CommonAttributes.ACCEPTOR; import static org.wildfly.extension.messaging.activemq.CommonAttributes.CONNECTOR; import static org.wildfly.extension.messaging.activemq.CommonAttributes.FACTORY_CLASS; @@ -399,9 +397,9 @@ private static void processSocketBinding(OperationContext context, CapabilitySer Supplier socketBindingSupplier = null; if (socketBindingName != null) { if (listOutBoundSocketBinding(context, Collections.singleton(socketBindingName)).get(socketBindingName)) { - outboundSocketBindingSupplier = builder.requiresCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY_NAME, OutboundSocketBinding.class, socketBindingName); + outboundSocketBindingSupplier = builder.requires(OutboundSocketBinding.SERVICE_DESCRIPTOR, socketBindingName); } else { - socketBindingSupplier = builder.requiresCapability(SOCKET_BINDING_CAPABILITY_NAME, SocketBinding.class, socketBindingName); + socketBindingSupplier = builder.requires(SocketBinding.SERVICE_DESCRIPTOR, socketBindingName); } } Supplier serverSupplier = builder.requires(MessagingServices.getActiveMQServiceName(context.getCurrentAddress())); diff --git a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryAdd.java b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryAdd.java index c6dbfcfcf967..41c79bf02558 100644 --- a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryAdd.java +++ b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryAdd.java @@ -5,8 +5,6 @@ package org.wildfly.extension.messaging.activemq.jms; import static org.wildfly.extension.messaging.activemq.Capabilities.ELYTRON_SSL_CONTEXT_CAPABILITY; -import static org.wildfly.extension.messaging.activemq.Capabilities.OUTBOUND_SOCKET_BINDING_CAPABILITY; -import static org.wildfly.extension.messaging.activemq.Capabilities.SOCKET_BINDING_CAPABILITY; import static org.wildfly.extension.messaging.activemq.CommonAttributes.CALL_FAILOVER_TIMEOUT; import static org.wildfly.extension.messaging.activemq.CommonAttributes.CALL_TIMEOUT; import static org.wildfly.extension.messaging.activemq.CommonAttributes.CLIENT_ID; @@ -119,11 +117,11 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod for (final String connectorSocketBinding : connectorsSocketBindings) { // find whether the connectorSocketBinding references a SocketBinding or an OutboundSocketBinding if (outbounds.get(connectorSocketBinding)) { - final ServiceName outboundSocketName = OUTBOUND_SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(connectorSocketBinding); + final ServiceName outboundSocketName = context.getCapabilityServiceName(OutboundSocketBinding.SERVICE_DESCRIPTOR, connectorSocketBinding); Supplier outboundSupplier = builder.requires(outboundSocketName); outboundSocketBindings.put(connectorSocketBinding, outboundSupplier); } else { - final ServiceName socketName = SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(connectorSocketBinding); + final ServiceName socketName = context.getCapabilityServiceName(SocketBinding.SERVICE_DESCRIPTOR, connectorSocketBinding); Supplier socketBindingsSupplier = builder.requires(socketName); socketBindings.put(connectorSocketBinding, socketBindingsSupplier); } diff --git a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalPooledConnectionFactoryService.java b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalPooledConnectionFactoryService.java index 7b5f7a85e4b8..c696e89532b6 100644 --- a/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalPooledConnectionFactoryService.java +++ b/messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalPooledConnectionFactoryService.java @@ -6,8 +6,6 @@ import static org.jboss.as.naming.deployment.ContextNames.BindInfo; import static org.wildfly.extension.messaging.activemq.Capabilities.ELYTRON_SSL_CONTEXT_CAPABILITY; -import static org.wildfly.extension.messaging.activemq.Capabilities.OUTBOUND_SOCKET_BINDING_CAPABILITY; -import static org.wildfly.extension.messaging.activemq.Capabilities.SOCKET_BINDING_CAPABILITY; import static org.wildfly.extension.messaging.activemq.jms.ConnectionFactoryAttributes.Pooled.REBALANCE_CONNECTIONS_PROP_NAME; import java.io.InputStream; @@ -290,11 +288,11 @@ private static void installService0(OperationContext context, for (final String connectorSocketBinding : connectorsSocketBindings) { // find whether the connectorSocketBinding references a SocketBinding or an OutboundSocketBinding if (outbounds.get(connectorSocketBinding)) { - final ServiceName outboundSocketName = OUTBOUND_SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(connectorSocketBinding); + final ServiceName outboundSocketName = context.getCapabilityServiceName(OutboundSocketBinding.SERVICE_DESCRIPTOR, connectorSocketBinding); Supplier outboundSocketBindingSupplier = serviceBuilder.requires(outboundSocketName); service.outboundSocketBindings.put(connectorSocketBinding, outboundSocketBindingSupplier); } else { - final ServiceName socketName = SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(connectorSocketBinding); + final ServiceName socketName = context.getCapabilityServiceName(SocketBinding.SERVICE_DESCRIPTOR, connectorSocketBinding); Supplier socketBindingSupplier = serviceBuilder.requires(socketName); service.socketBindings.put(connectorSocketBinding, socketBindingSupplier); } diff --git a/metrics/src/main/java/org/wildfly/extension/metrics/MetricsCollectorService.java b/metrics/src/main/java/org/wildfly/extension/metrics/MetricsCollectorService.java index b128540023bf..ae35c6dbe634 100644 --- a/metrics/src/main/java/org/wildfly/extension/metrics/MetricsCollectorService.java +++ b/metrics/src/main/java/org/wildfly/extension/metrics/MetricsCollectorService.java @@ -4,9 +4,6 @@ */ package org.wildfly.extension.metrics; -import static org.wildfly.extension.metrics.MetricsSubsystemDefinition.CLIENT_FACTORY_CAPABILITY; -import static org.wildfly.extension.metrics.MetricsSubsystemDefinition.MANAGEMENT_EXECUTOR; -import static org.wildfly.extension.metrics.MetricsSubsystemDefinition.PROCESS_STATE_NOTIFIER; import static org.wildfly.extension.metrics.MetricsSubsystemDefinition.WILDFLY_COLLECTOR; import java.util.concurrent.Executor; @@ -17,8 +14,9 @@ import org.jboss.as.controller.ModelControllerClientFactory; import org.jboss.as.controller.OperationContext; import org.jboss.as.controller.ProcessStateNotifier; +import org.jboss.as.controller.RequirementServiceBuilder; +import org.jboss.as.controller.management.Capabilities; import org.jboss.msc.service.Service; -import org.jboss.msc.service.ServiceBuilder; import org.jboss.msc.service.StartContext; import org.jboss.msc.service.StopContext; @@ -36,10 +34,10 @@ public class MetricsCollectorService implements Service { private LocalModelControllerClient modelControllerClient; static void install(OperationContext context) { - ServiceBuilder serviceBuilder = context.getServiceTarget().addService(WILDFLY_COLLECTOR); - Supplier modelControllerClientFactory = serviceBuilder.requires(context.getCapabilityServiceName(CLIENT_FACTORY_CAPABILITY, ModelControllerClientFactory.class)); - Supplier managementExecutor = serviceBuilder.requires(context.getCapabilityServiceName(MANAGEMENT_EXECUTOR, Executor.class)); - Supplier processStateNotifier = serviceBuilder.requires(context.getCapabilityServiceName(PROCESS_STATE_NOTIFIER, ProcessStateNotifier.class)); + RequirementServiceBuilder serviceBuilder = context.getCapabilityServiceTarget().addService(WILDFLY_COLLECTOR); + Supplier modelControllerClientFactory = serviceBuilder.requires(ModelControllerClientFactory.SERVICE_DESCRIPTOR); + Supplier managementExecutor = serviceBuilder.requires(Capabilities.MANAGEMENT_EXECUTOR); + Supplier processStateNotifier = serviceBuilder.requires(ProcessStateNotifier.SERVICE_DESCRIPTOR); Consumer metricCollectorConsumer = serviceBuilder.provides(WILDFLY_COLLECTOR); MetricsCollectorService service = new MetricsCollectorService(modelControllerClientFactory, managementExecutor, processStateNotifier, metricCollectorConsumer); serviceBuilder.setInstance(service) diff --git a/metrics/src/main/java/org/wildfly/extension/metrics/MetricsSubsystemDefinition.java b/metrics/src/main/java/org/wildfly/extension/metrics/MetricsSubsystemDefinition.java index 4943155e365d..404072df6610 100644 --- a/metrics/src/main/java/org/wildfly/extension/metrics/MetricsSubsystemDefinition.java +++ b/metrics/src/main/java/org/wildfly/extension/metrics/MetricsSubsystemDefinition.java @@ -9,12 +9,15 @@ import java.util.Collection; import org.jboss.as.controller.AttributeDefinition; +import org.jboss.as.controller.ModelControllerClientFactory; import org.jboss.as.controller.PersistentResourceDefinition; +import org.jboss.as.controller.ProcessStateNotifier; import org.jboss.as.controller.ServiceRemoveStepHandler; import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.as.controller.SimpleResourceDefinition; import org.jboss.as.controller.StringListAttributeDefinition; import org.jboss.as.controller.capability.RuntimeCapability; +import org.jboss.as.controller.management.Capabilities; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; import org.jboss.msc.service.ServiceName; @@ -24,15 +27,12 @@ */ public class MetricsSubsystemDefinition extends PersistentResourceDefinition { - static final String CLIENT_FACTORY_CAPABILITY ="org.wildfly.management.model-controller-client-factory"; - static final String MANAGEMENT_EXECUTOR ="org.wildfly.management.executor"; - static final String PROCESS_STATE_NOTIFIER = "org.wildfly.management.process-state-notifier"; static final String HTTP_EXTENSIBILITY_CAPABILITY = "org.wildfly.management.http.extensible"; public static final String METRICS_HTTP_SECURITY_CAPABILITY = "org.wildfly.extension.metrics.http-context.security-enabled"; public static final String METRICS_SCAN_CAPABILITY = "org.wildfly.extension.metrics.scan"; private static final RuntimeCapability METRICS_COLLECTOR_RUNTIME_CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.extension.metrics.wildfly-collector", MetricCollector.class) - .addRequirements(CLIENT_FACTORY_CAPABILITY, MANAGEMENT_EXECUTOR, PROCESS_STATE_NOTIFIER) + .addRequirements(ModelControllerClientFactory.SERVICE_DESCRIPTOR, Capabilities.MANAGEMENT_EXECUTOR, ProcessStateNotifier.SERVICE_DESCRIPTOR) .build(); static final RuntimeCapability METRICS_HTTP_CONTEXT_CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.extension.metrics.http-context", MetricsContextService.class) diff --git a/microprofile/config-smallrye/src/main/java/org/wildfly/extension/microprofile/config/smallrye/ConfigSourceDefinition.java b/microprofile/config-smallrye/src/main/java/org/wildfly/extension/microprofile/config/smallrye/ConfigSourceDefinition.java index 15648c356f7e..ae873885d674 100644 --- a/microprofile/config-smallrye/src/main/java/org/wildfly/extension/microprofile/config/smallrye/ConfigSourceDefinition.java +++ b/microprofile/config-smallrye/src/main/java/org/wildfly/extension/microprofile/config/smallrye/ConfigSourceDefinition.java @@ -32,6 +32,7 @@ import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.as.controller.SimpleResourceDefinition; import org.jboss.as.controller.descriptions.ModelDescriptionConstants; +import org.jboss.as.controller.services.path.PathManager; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; import org.jboss.modules.Module; @@ -90,7 +91,7 @@ class ConfigSourceDefinition extends PersistentResourceDefinition { .setRequired(false) .setAttributeMarshaller(AttributeMarshaller.ATTRIBUTE_OBJECT) .setRestartAllServices() - .setCapabilityReference("org.wildfly.management.path-manager") + .setCapabilityReference(PathManager.SERVICE_DESCRIPTOR.getName()) .build(); static ObjectTypeAttributeDefinition DIR = ObjectTypeAttributeDefinition.Builder.of("dir", PATH, RELATIVE_TO, ROOT) @@ -98,7 +99,7 @@ class ConfigSourceDefinition extends PersistentResourceDefinition { .setRequired(false) .setAttributeMarshaller(AttributeMarshaller.ATTRIBUTE_OBJECT) .setRestartAllServices() - .setCapabilityReference("org.wildfly.management.path-manager") + .setCapabilityReference(PathManager.SERVICE_DESCRIPTOR.getName()) .build(); static AttributeDefinition[] ATTRIBUTES = {ORDINAL, PROPERTIES, CLASS, DIR}; diff --git a/microprofile/config-smallrye/src/main/java/org/wildfly/extension/microprofile/config/smallrye/ConfigSourceRootRegistrationService.java b/microprofile/config-smallrye/src/main/java/org/wildfly/extension/microprofile/config/smallrye/ConfigSourceRootRegistrationService.java index 74d2503cef20..385a04bd4c8a 100644 --- a/microprofile/config-smallrye/src/main/java/org/wildfly/extension/microprofile/config/smallrye/ConfigSourceRootRegistrationService.java +++ b/microprofile/config-smallrye/src/main/java/org/wildfly/extension/microprofile/config/smallrye/ConfigSourceRootRegistrationService.java @@ -54,7 +54,7 @@ private ConfigSourceRootRegistrationService(String name, String path, String rel static void install(OperationContext context, String name, String path, String relativeTo, int ordinal, Registry registry) { ServiceBuilder builder = context.getServiceTarget() .addService(ServiceNames.CONFIG_SOURCE_ROOT.append(name)); - Supplier pathManager = builder.requires(context.getCapabilityServiceName("org.wildfly.management.path-manager", PathManager.class)); + Supplier pathManager = builder.requires(context.getCapabilityServiceName(PathManager.SERVICE_DESCRIPTOR)); builder.setInstance(new ConfigSourceRootRegistrationService(name, path, relativeTo, ordinal, pathManager, registry)) .install(); diff --git a/mod_cluster/undertow/src/main/java/org/wildfly/mod_cluster/undertow/UndertowEventHandlerAdapterService.java b/mod_cluster/undertow/src/main/java/org/wildfly/mod_cluster/undertow/UndertowEventHandlerAdapterService.java index 3caa02d64f73..5aef64db7e50 100644 --- a/mod_cluster/undertow/src/main/java/org/wildfly/mod_cluster/undertow/UndertowEventHandlerAdapterService.java +++ b/mod_cluster/undertow/src/main/java/org/wildfly/mod_cluster/undertow/UndertowEventHandlerAdapterService.java @@ -14,7 +14,7 @@ import org.jboss.as.server.suspend.ServerActivity; import org.jboss.as.server.suspend.ServerActivityCallback; -import org.jboss.as.server.suspend.SuspendController.State; +import org.jboss.as.server.suspend.SuspendController; import org.jboss.logging.Logger; import org.jboss.modcluster.container.Connector; import org.jboss.modcluster.container.ContainerEventHandler; @@ -105,9 +105,9 @@ private Context createContext(String contextPath, Host host) { private synchronized void onStart(Context context) { ContainerEventHandler handler = this.configuration.getContainerEventHandler(); - State state = this.configuration.getSuspendController().getState(); + SuspendController.State state = this.configuration.getSuspendController().getState(); - if (state == State.RUNNING) { + if (state == SuspendController.State.RUNNING) { // Normal operation - trigger ENABLE-APP handler.start(context); } else { diff --git a/observability/micrometer/src/main/java/org/wildfly/extension/micrometer/MicrometerSubsystemRegistrar.java b/observability/micrometer/src/main/java/org/wildfly/extension/micrometer/MicrometerSubsystemRegistrar.java index 97acdc854611..7e96f887ee66 100644 --- a/observability/micrometer/src/main/java/org/wildfly/extension/micrometer/MicrometerSubsystemRegistrar.java +++ b/observability/micrometer/src/main/java/org/wildfly/extension/micrometer/MicrometerSubsystemRegistrar.java @@ -37,6 +37,7 @@ import org.jboss.as.controller.client.helpers.MeasurementUnit; import org.jboss.as.controller.descriptions.ParentResourceDescriptionResolver; import org.jboss.as.controller.descriptions.SubsystemResourceDescriptionResolver; +import org.jboss.as.controller.management.Capabilities; import org.jboss.as.controller.registry.ImmutableManagementResourceRegistration; import org.jboss.as.controller.registry.ManagementResourceRegistration; import org.jboss.as.controller.registry.OperationEntry; @@ -62,17 +63,13 @@ class MicrometerSubsystemRegistrar implements SubsystemResourceDefinitionRegistr private static final String MICROMETER_MODULE = "org.wildfly.extension.micrometer"; private static final String MICROMETER_API_MODULE = "org.wildfly.micrometer.deployment"; - static final String CLIENT_FACTORY_CAPABILITY = "org.wildfly.management.model-controller-client-factory"; - static final String MANAGEMENT_EXECUTOR = "org.wildfly.management.executor"; - static final String PROCESS_STATE_NOTIFIER = "org.wildfly.management.process-state-notifier"; - static final PathElement PATH = SubsystemResourceDefinitionRegistrar.pathElement(MicrometerConfigurationConstants.NAME); public static final ParentResourceDescriptionResolver RESOLVER = new SubsystemResourceDescriptionResolver(MicrometerConfigurationConstants.NAME, MicrometerSubsystemRegistrar.class); static final RuntimeCapability MICROMETER_COLLECTOR_RUNTIME_CAPABILITY = RuntimeCapability.Builder.of(MICROMETER_MODULE + ".wildfly-collector", MicrometerCollector.class) - .addRequirements(CLIENT_FACTORY_CAPABILITY, MANAGEMENT_EXECUTOR, PROCESS_STATE_NOTIFIER) + .addRequirements(ModelControllerClientFactory.SERVICE_DESCRIPTOR, Capabilities.MANAGEMENT_EXECUTOR, ProcessStateNotifier.SERVICE_DESCRIPTOR) .build(); static final String[] EXPORTED_MODULES = { @@ -154,9 +151,9 @@ public ResourceServiceInstaller configure(OperationContext context, ModelNode mo throw MICROMETER_LOGGER.failedInitializeJMXRegistrar(e); } - ServiceDependency mccf = ServiceDependency.on(CLIENT_FACTORY_CAPABILITY, ModelControllerClientFactory.class); - ServiceDependency executor = ServiceDependency.on(MANAGEMENT_EXECUTOR, Executor.class); - ServiceDependency processStateNotifier = ServiceDependency.on(PROCESS_STATE_NOTIFIER, ProcessStateNotifier.class); + ServiceDependency mccf = ServiceDependency.on(ModelControllerClientFactory.SERVICE_DESCRIPTOR); + ServiceDependency executor = ServiceDependency.on(Capabilities.MANAGEMENT_EXECUTOR); + ServiceDependency processStateNotifier = ServiceDependency.on(ProcessStateNotifier.SERVICE_DESCRIPTOR); Supplier collectorSupplier = () -> new MicrometerCollector(mccf.get().createClient(executor.get()), processStateNotifier.get(), wildFlyRegistry); diff --git a/transactions/src/main/java/org/jboss/as/txn/subsystem/TransactionSubsystemAdd.java b/transactions/src/main/java/org/jboss/as/txn/subsystem/TransactionSubsystemAdd.java index f43896776d05..758c0ad484d9 100644 --- a/transactions/src/main/java/org/jboss/as/txn/subsystem/TransactionSubsystemAdd.java +++ b/transactions/src/main/java/org/jboss/as/txn/subsystem/TransactionSubsystemAdd.java @@ -400,11 +400,11 @@ private void performRecoveryEnvBoottime(OperationContext context, ModelNode mode final CapabilityServiceBuilder recoveryManagerServiceServiceBuilder = serviceTarget.addCapability(XA_RESOURCE_RECOVERY_REGISTRY_CAPABILITY); final Consumer consumer = recoveryManagerServiceServiceBuilder.provides(XA_RESOURCE_RECOVERY_REGISTRY_CAPABILITY); - final Supplier recoveryBindingSupplier = recoveryManagerServiceServiceBuilder.requiresCapability("org.wildfly.network.socket-binding", SocketBinding.class, recoveryBindingName); - final Supplier statusBindingSupplier = recoveryManagerServiceServiceBuilder.requiresCapability("org.wildfly.network.socket-binding", SocketBinding.class, recoveryStatusBindingName); - final Supplier bindingManagerSupplier = recoveryManagerServiceServiceBuilder.requiresCapability("org.wildfly.management.socket-binding-manager", SocketBindingManager.class); + final Supplier recoveryBindingSupplier = recoveryManagerServiceServiceBuilder.requires(SocketBinding.SERVICE_DESCRIPTOR, recoveryBindingName); + final Supplier statusBindingSupplier = recoveryManagerServiceServiceBuilder.requires(SocketBinding.SERVICE_DESCRIPTOR, recoveryStatusBindingName); + final Supplier bindingManagerSupplier = recoveryManagerServiceServiceBuilder.requires(SocketBindingManager.SERVICE_DESCRIPTOR); final Supplier suspendControllerSupplier = recoveryManagerServiceServiceBuilder.requiresCapability("org.wildfly.server.suspend-controller", SuspendController.class); - final Supplier processStateSupplier = recoveryManagerServiceServiceBuilder.requiresCapability("org.wildfly.management.process-state-notifier", ProcessStateNotifier.class); + final Supplier processStateSupplier = recoveryManagerServiceServiceBuilder.requires(ProcessStateNotifier.SERVICE_DESCRIPTOR); recoveryManagerServiceServiceBuilder.requires(TxnServices.JBOSS_TXN_CORE_ENVIRONMENT); recoveryManagerServiceServiceBuilder.requires(TxnServices.JBOSS_TXN_ARJUNA_OBJECTSTORE_ENVIRONMENT); recoveryManagerServiceServiceBuilder.addAliases(TxnServices.JBOSS_TXN_ARJUNA_RECOVERY_MANAGER); diff --git a/undertow/src/test/java/org/wildfly/extension/undertow/DefaultInitialization.java b/undertow/src/test/java/org/wildfly/extension/undertow/DefaultInitialization.java index a92c5e4bee1d..e2f067adf649 100644 --- a/undertow/src/test/java/org/wildfly/extension/undertow/DefaultInitialization.java +++ b/undertow/src/test/java/org/wildfly/extension/undertow/DefaultInitialization.java @@ -127,7 +127,7 @@ protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegis registerServiceCapabilities(capabilityRegistry, capabilities); registerCapabilities(capabilityRegistry, - RuntimeCapability.Builder.of("org.wildfly.network.outbound-socket-binding", true, OutboundSocketBinding.class).build(), + RuntimeCapability.Builder.of(OutboundSocketBinding.SERVICE_DESCRIPTOR).build(), RuntimeCapability.Builder.of("org.wildfly.security.ssl-context", true, SSLContext.class).build() ); diff --git a/undertow/src/test/java/org/wildfly/extension/undertow/RuntimeInitialization.java b/undertow/src/test/java/org/wildfly/extension/undertow/RuntimeInitialization.java index b7a2a8e8db05..97df983c9ee0 100644 --- a/undertow/src/test/java/org/wildfly/extension/undertow/RuntimeInitialization.java +++ b/undertow/src/test/java/org/wildfly/extension/undertow/RuntimeInitialization.java @@ -88,7 +88,8 @@ protected void addExtraServices(ServiceTarget target) { try { SSLContext sslContext = SSLContext.getDefault(); - target.addService(ServiceName.parse(Capabilities.REF_SUSPEND_CONTROLLER)).setInstance(new SuspendController()).install(); + ServiceBuilder builder = target.addService(); + builder.setInstance(Service.newInstance(builder.provides(ServiceName.parse(Capabilities.REF_SUSPEND_CONTROLLER)), new SuspendController())).install(); target.addService(Services.JBOSS_SERVICE_MODULE_LOADER).setInstance(new ServiceModuleLoader(null)).install(); target.addService(ContextNames.JAVA_CONTEXT_SERVICE_NAME).setInstance(new NamingStoreService()).install(); target.addService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME).setInstance(new NamingStoreService()).install();