Permalink
Comparing changes
Open a pull request
- 3 commits
- 13 files changed
- 0 commit comments
- 2 contributors
Unified
Split
Showing
with
41 additions
and 15 deletions.
- +9 −2 controller/src/main/java/org/jboss/as/controller/CapabilityServiceBuilder.java
- +6 −0 controller/src/main/java/org/jboss/as/controller/OperationContextImpl.java
- +3 −1 elytron/src/main/java/org/wildfly/extension/elytron/TrivialAddHandler.java
- +2 −1 host-controller/src/main/java/org/jboss/as/host/controller/operations/HttpManagementAddHandler.java
- +4 −2 io/subsystem/src/main/java/org/wildfly/extension/io/BufferPoolResourceDefinition.java
- +2 −1 io/subsystem/src/main/java/org/wildfly/extension/io/WorkerAdd.java
- +2 −1 remoting/subsystem/src/main/java/org/jboss/as/remoting/RemotingSubsystemAdd.java
- +3 −2 server/src/main/java/org/jboss/as/server/operations/HttpManagementAddHandler.java
- +2 −1 server/src/main/java/org/jboss/as/server/services/net/BindingAddHandler.java
- +2 −1 server/src/main/java/org/jboss/as/server/services/net/BindingGroupAddHandler.java
- +2 −1 ...c/main/java/org/jboss/as/server/services/net/LocalDestinationOutboundSocketBindingAddHandler.java
- +2 −1 .../main/java/org/jboss/as/server/services/net/RemoteDestinationOutboundSocketBindingAddHandler.java
- +2 −1 server/src/main/java/org/jboss/as/server/services/net/SpecifiedInterfaceAddHandler.java
| @@ -20,7 +20,7 @@ | ||
|
|
||
| import org.jboss.as.controller.capability.RuntimeCapability; | ||
| import org.jboss.msc.inject.Injector; | ||
| import org.jboss.msc.service.Service; | ||
| import org.jboss.msc.Service; | ||
| import org.jboss.msc.service.ServiceBuilder; | ||
| import org.jboss.msc.service.ServiceController; | ||
| import org.jboss.msc.service.ServiceName; | ||
| @@ -29,7 +29,7 @@ | ||
|
|
||
| /** | ||
| * A builder for an individual service in a {@code CapabilityServiceTarget}. | ||
| * Create an instance via the {@link CapabilityServiceTarget#addCapability(RuntimeCapability, Service)}, | ||
| * Create an instance via the {@link CapabilityServiceTarget#addCapability(RuntimeCapability)}, | ||
| * {@link #addCapabilityRequirement(String, Class, Injector)} or other methods. | ||
| * Builder also add supports to add capability requirement for service injection via {@link #addCapabilityRequirement(String, Class, Injector)} | ||
| * | ||
| @@ -103,6 +103,13 @@ | ||
| @Override | ||
| CapabilityServiceBuilder<T> setInitialMode(ServiceController.Mode mode); | ||
|
|
||
| /** | ||
| * {@inheritDoc} | ||
| * @return this builder | ||
| */ | ||
| @Override | ||
| CapabilityServiceBuilder<T> setInstance(Service service); | ||
|
|
||
| /** | ||
| * Capability requirement. | ||
| * | ||
| @@ -2639,6 +2639,12 @@ public ServiceName getCapabilityServiceName(String capabilityBaseName, String .. | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public CapabilityServiceBuilder<T> setInstance(org.jboss.msc.Service service) { | ||
| super.setInstance(service); | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public <V> Supplier<V> requiresCapability(String capabilityBaseName, Class<V> dependencyType, String... referenceNames) { | ||
| String capabilityName; | ||
| @@ -58,12 +58,14 @@ | ||
| this.initialMode = checkNotNullParam("initialMode", initialMode); | ||
| } | ||
|
|
||
| @SuppressWarnings("unchecked") | ||
| @Override | ||
| protected final void performRuntime(OperationContext context, ModelNode operation, Resource resource) | ||
| throws OperationFailedException { | ||
| TrivialService<T> trivialService = new TrivialService<T>(); | ||
|
|
||
| ServiceBuilder<T> serviceBuilder = context.getCapabilityServiceTarget().addCapability(runtimeCapability, trivialService); | ||
| ServiceBuilder<T> serviceBuilder = (ServiceBuilder<T>)context.getCapabilityServiceTarget().addCapability(runtimeCapability); | ||
| serviceBuilder.setInstance(trivialService); | ||
|
|
||
| trivialService.setValueSupplier(getValueSupplier(serviceBuilder, context, resource.getModel())); | ||
|
|
||
| @@ -142,7 +142,8 @@ protected boolean requiresRuntime(OperationContext context) { | ||
| service.getPortInjector().inject(port); | ||
| service.getSecurePortInjector().inject(securePort); | ||
| service.getAllowedOriginsInjector().inject(commonPolicy.getAllowedOrigins()); | ||
| CapabilityServiceBuilder<?> builder = serviceTarget.addCapability(EXTENSIBLE_HTTP_MANAGEMENT_CAPABILITY, service) | ||
| CapabilityServiceBuilder<?> builder = serviceTarget.addCapability(EXTENSIBLE_HTTP_MANAGEMENT_CAPABILITY) | ||
| .setInstance(service) | ||
| .addCapabilityRequirement("org.wildfly.network.interface", | ||
| NetworkInterfaceBinding.class, service.getInterfaceInjector(), interfaceName) | ||
| .addCapabilityRequirement("org.wildfly.network.interface", | ||
| @@ -155,13 +155,15 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod | ||
| final boolean direct = directModel.isDefined() ? directModel.asBoolean() : defaultDirectBuffers; | ||
|
|
||
| final BufferPoolService service = new BufferPoolService(bufferSize, bufferPerSlice, direct); | ||
| context.getCapabilityServiceTarget().addCapability(IO_POOL_RUNTIME_CAPABILITY, service) | ||
| context.getCapabilityServiceTarget().addCapability(IO_POOL_RUNTIME_CAPABILITY) | ||
| .setInstance(service) | ||
| .setInitialMode(ServiceController.Mode.ON_DEMAND) | ||
| .install(); | ||
|
|
||
| ByteBufferPoolService poolService = new ByteBufferPoolService(); | ||
|
|
||
| context.getCapabilityServiceTarget().addCapability(IO_BYTE_BUFFER_POOL_RUNTIME_CAPABILITY, poolService) | ||
| context.getCapabilityServiceTarget().addCapability(IO_BYTE_BUFFER_POOL_RUNTIME_CAPABILITY) | ||
| .setInstance(poolService) | ||
| .addCapabilityRequirement(IO_POOL_RUNTIME_CAPABILITY.getDynamicName(address), Pool.class, poolService.bufferPool) | ||
| .setInitialMode(ServiceController.Mode.ON_DEMAND) | ||
| .install(); | ||
| @@ -217,7 +217,8 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod | ||
| registerMax(context, name, workerThreads); | ||
|
|
||
| final WorkerService workerService = new WorkerService(builder); | ||
| context.getCapabilityServiceTarget().addCapability(IO_WORKER_RUNTIME_CAPABILITY, workerService) | ||
| context.getCapabilityServiceTarget().addCapability(IO_WORKER_RUNTIME_CAPABILITY) | ||
| .setInstance(workerService) | ||
| .addCapabilityRequirement("org.wildfly.management.executor", | ||
| ExecutorService.class, workerService.injectedExecutor) | ||
| .setInitialMode(ServiceController.Mode.ON_DEMAND) | ||
| @@ -83,7 +83,8 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod | ||
| } | ||
| } | ||
|
|
||
| context.getCapabilityServiceTarget().addCapability(REMOTING_ENDPOINT_CAPABILITY, endpointService) | ||
| context.getCapabilityServiceTarget().addCapability(REMOTING_ENDPOINT_CAPABILITY) | ||
| .setInstance(endpointService) | ||
| .addCapabilityRequirement(IO_WORKER_CAPABILITY_NAME, XnioWorker.class, endpointService.getWorker(), workerName) | ||
| .install(); | ||
| } | ||
| @@ -66,7 +66,6 @@ | ||
| import org.jboss.as.server.mgmt.HttpShutdownService; | ||
| import org.jboss.as.server.mgmt.ManagementWorkerService; | ||
| import org.jboss.as.server.mgmt.UndertowHttpManagementService; | ||
| import org.jboss.as.server.mgmt.domain.HttpManagement; | ||
| import org.jboss.dmr.ModelNode; | ||
| import org.jboss.msc.service.ServiceBuilder; | ||
| import org.jboss.msc.service.ServiceName; | ||
| @@ -137,8 +136,10 @@ protected boolean requiresRuntime(OperationContext context) { | ||
| ServerEnvironment environment = (ServerEnvironment) context.getServiceRegistry(false).getRequiredService(ServerEnvironmentService.SERVICE_NAME).getValue(); | ||
| final UndertowHttpManagementService undertowService = new UndertowHttpManagementService(consoleMode, environment.getProductConfig().getConsoleSlot()); | ||
| undertowService.getAllowedOriginsInjector().inject(commonPolicy.getAllowedOrigins()); | ||
| CapabilityServiceBuilder<HttpManagement> undertowBuilder = serviceTarget.addCapability(EXTENSIBLE_HTTP_MANAGEMENT_CAPABILITY, undertowService).addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, undertowService.getModelControllerInjector()) | ||
| CapabilityServiceBuilder<?> undertowBuilder = serviceTarget.addCapability(EXTENSIBLE_HTTP_MANAGEMENT_CAPABILITY) | ||
| .setInstance(undertowService) | ||
| .addCapabilityRequirement("org.wildfly.management.socket-binding-manager", SocketBindingManager.class, undertowService.getSocketBindingManagerInjector()) | ||
| .addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, undertowService.getModelControllerInjector()) | ||
| .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, undertowService.getControlledProcessStateServiceInjector()) | ||
| .addDependency(RemotingServices.HTTP_LISTENER_REGISTRY, ListenerRegistry.class, undertowService.getListenerRegistry()) | ||
| .addDependency(requestProcessorName, ManagementHttpRequestProcessor.class, undertowService.getRequestProcessorValue()) | ||
| @@ -99,7 +99,8 @@ static void installBindingService(OperationContext context, ModelNode config, St | ||
| final List<ClientMapping> clientMappings = mappingsNode.isDefined() ? parseClientMappings(context, mappingsNode) : null; | ||
|
|
||
| final SocketBindingService service = new SocketBindingService(name, port, fixedPort, mcastInet, mcastPort, clientMappings); | ||
| final CapabilityServiceBuilder<SocketBinding> builder = serviceTarget.addCapability(SOCKET_BINDING_CAPABILITY, service); | ||
| final CapabilityServiceBuilder<?> builder = serviceTarget.addCapability(SOCKET_BINDING_CAPABILITY); | ||
| builder.setInstance(service); | ||
| if (intf != null) { | ||
| builder.addCapabilityRequirement("org.wildfly.network.interface", NetworkInterfaceBinding.class, service.getInterfaceBinding(), intf); | ||
| } | ||
| @@ -108,7 +108,8 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod | ||
| String defaultInterface = SocketBindingGroupResourceDefinition.DEFAULT_INTERFACE.resolveModelAttribute(context, model).asString(); | ||
|
|
||
| SocketBindingManagerService service = new SocketBindingManagerService(portOffset); | ||
| context.getCapabilityServiceTarget().addCapability(SOCKET_BINDING_MANAGER_CAPABILITY, service) | ||
| context.getCapabilityServiceTarget().addCapability(SOCKET_BINDING_MANAGER_CAPABILITY) | ||
| .setInstance(service) | ||
| .addCapabilityRequirement("org.wildfly.network.interface", NetworkInterfaceBinding.class, service.getDefaultInterfaceBindingInjector(), defaultInterface) | ||
| .setInitialMode(ServiceController.Mode.ON_DEMAND) | ||
| .addAliases(SocketBindingManager.SOCKET_BINDING_MANAGER) | ||
| @@ -147,7 +147,8 @@ static void installOutboundSocketBindingService(final OperationContext context, | ||
|
|
||
| // create the service | ||
| final LocalDestinationOutboundSocketBindingService outboundSocketBindingService = new LocalDestinationOutboundSocketBindingService(outboundSocketName, sourcePort, fixedSourcePort); | ||
| final CapabilityServiceBuilder<OutboundSocketBinding> serviceBuilder = serviceTarget.addCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY, outboundSocketBindingService); | ||
| final CapabilityServiceBuilder<?> serviceBuilder = serviceTarget.addCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY); | ||
| serviceBuilder.setInstance(outboundSocketBindingService); | ||
| // if a source interface has been specified then add a dependency on it | ||
| if (sourceInterfaceName != null) { | ||
| serviceBuilder.addCapabilityRequirement("org.wildfly.network.interface", NetworkInterfaceBinding.class, outboundSocketBindingService.getSourceNetworkInterfaceBindingInjector(), sourceInterfaceName); | ||
| @@ -147,7 +147,8 @@ static void installOutboundSocketBindingService(final OperationContext context, | ||
|
|
||
| // create the service | ||
| final OutboundSocketBindingService outboundSocketBindingService = new RemoteDestinationOutboundSocketBindingService(outboundSocketName, destinationHost, destinationPort, sourcePort, fixedSourcePort); | ||
| final CapabilityServiceBuilder<OutboundSocketBinding> serviceBuilder = serviceTarget.addCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY, outboundSocketBindingService); | ||
| final CapabilityServiceBuilder<?> serviceBuilder = serviceTarget.addCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY); | ||
| serviceBuilder.setInstance(outboundSocketBindingService); | ||
| // if a source interface has been specified then add a dependency on it | ||
| if (sourceInterfaceName != null) { | ||
| serviceBuilder.addCapabilityRequirement("org.wildfly.network.interface", NetworkInterfaceBinding.class, outboundSocketBindingService.getSourceNetworkInterfaceBindingInjector(), sourceInterfaceName); | ||
| @@ -45,7 +45,8 @@ protected boolean requiresRuntime(OperationContext context) { | ||
|
|
||
| @Override | ||
| protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, String name, ParsedInterfaceCriteria criteria) { | ||
| context.getCapabilityServiceTarget().addCapability(InterfaceResourceDefinition.INTERFACE_CAPABILITY.fromBaseCapability(name), createInterfaceService(name, criteria)) | ||
| context.getCapabilityServiceTarget().addCapability(InterfaceResourceDefinition.INTERFACE_CAPABILITY.fromBaseCapability(name)) | ||
| .setInstance(createInterfaceService(name, criteria)) | ||
| .addAliases(NetworkInterfaceService.JBOSS_NETWORK_INTERFACE.append(name)) | ||
| .setInitialMode(ServiceController.Mode.ON_DEMAND) | ||
| .install(); | ||