Search in sources :

Example 6 with ServiceSupplierDependency

use of org.wildfly.clustering.service.ServiceSupplierDependency in project wildfly by wildfly.

the class SingleSignOnSessionFactoryServiceConfigurator method configure.

@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
    String keyStore = KEY_STORE.resolveModelAttribute(context, model).asString();
    this.keyStore = new ServiceSupplierDependency<>(CommonUnaryRequirement.KEY_STORE.getServiceName(context, keyStore));
    this.keyAlias = KEY_ALIAS.resolveModelAttribute(context, model).asString();
    this.credentialSource = new CredentialSourceDependency(context, CREDENTIAL, model);
    String sslContext = SSL_CONTEXT.resolveModelAttribute(context, model).asStringOrNull();
    this.sslContext = (sslContext != null) ? new ServiceSupplierDependency<>(CommonUnaryRequirement.SSL_CONTEXT.getServiceName(context, sslContext)) : null;
    return this;
}
Also used : CredentialSourceDependency(org.jboss.as.clustering.controller.CredentialSourceDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency)

Example 7 with ServiceSupplierDependency

use of org.wildfly.clustering.service.ServiceSupplierDependency in project wildfly by wildfly.

the class EJB3RemoteServiceAdd method installRuntimeServices.

void installRuntimeServices(final OperationContext context, final ModelNode model) throws OperationFailedException {
    final String clientMappingsClusterName = EJB3RemoteResourceDefinition.CLIENT_MAPPINGS_CLUSTER_NAME.resolveModelAttribute(context, model).asString();
    final List<ModelNode> connectorNameNodes = EJB3RemoteResourceDefinition.CONNECTORS.resolveModelAttribute(context, model).asList();
    final String threadPoolName = EJB3RemoteResourceDefinition.THREAD_POOL_NAME.resolveModelAttribute(context, model).asString();
    final boolean executeInWorker = EJB3RemoteResourceDefinition.EXECUTE_IN_WORKER.resolveModelAttribute(context, model).asBoolean();
    final ServiceTarget target = context.getServiceTarget();
    // for each connector specified, we need to set up a client-mappings cache
    for (ModelNode connectorNameNode : connectorNameNodes) {
        String connectorName = connectorNameNode.asString();
        // Install the client-mapping service for the remoting connector
        ServiceConfigurator clientMappingsEntryProviderConfigurator = new EJBRemotingConnectorClientMappingsEntryProviderService(clientMappingsClusterName, connectorName).configure(context);
        clientMappingsEntryProviderConfigurator.build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
        if (this.provider != null) {
            // Install the registry for the remoting connector's client mappings
            SupplierDependency<Map.Entry<String, List<ClientMapping>>> registryEntryDependency = new ServiceSupplierDependency<>(clientMappingsEntryProviderConfigurator.getServiceName());
            for (CapabilityServiceConfigurator configurator : this.provider.getServiceConfigurators(clientMappingsClusterName, connectorName, new FunctionSupplierDependency<>(registryEntryDependency, Map.Entry::getValue))) {
                configurator.configure(context).build(target).install();
            }
        }
    }
    final OptionMap channelCreationOptions = this.getChannelCreationOptions(context);
    // Install the Jakarta Enterprise Beans remoting connector service which will listen for client connections on the remoting channel
    // TODO: Externalize (expose via management API if needed) the version and the marshalling strategy
    final EJBRemoteConnectorService ejbRemoteConnectorService = new EJBRemoteConnectorService(channelCreationOptions, FilterSpecClassResolverFilter.getFilterForOperationContext(context));
    CapabilityServiceBuilder<?> builder = (CapabilityServiceBuilder<?>) context.getCapabilityServiceTarget().addCapability(EJB3RemoteResourceDefinition.EJB_REMOTE_CAPABILITY).setInstance(ejbRemoteConnectorService).addCapabilityRequirement(EJB3RemoteResourceDefinition.REMOTING_ENDPOINT_CAPABILITY_NAME, Endpoint.class, ejbRemoteConnectorService.getEndpointInjector());
    if (!executeInWorker) {
        builder.addCapabilityRequirement(EJB3RemoteResourceDefinition.THREAD_POOL_CAPABILITY_NAME, ExecutorService.class, ejbRemoteConnectorService.getExecutorService(), threadPoolName);
    }
    // add rest of the dependencies
    builder.addDependency(AssociationService.SERVICE_NAME, AssociationService.class, ejbRemoteConnectorService.getAssociationServiceInjector()).addCapabilityRequirement(EJB3RemoteResourceDefinition.REMOTE_TRANSACTION_SERVICE_CAPABILITY_NAME, RemotingTransactionService.class, ejbRemoteConnectorService.getRemotingTransactionServiceInjector()).addAliases(EJBRemoteConnectorService.SERVICE_NAME).setInitialMode(ServiceController.Mode.LAZY).install();
}
Also used : CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) EJBRemotingConnectorClientMappingsEntryProviderService(org.jboss.as.ejb3.remote.EJBRemotingConnectorClientMappingsEntryProviderService) ServiceTarget(org.jboss.msc.service.ServiceTarget) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) RemotingTransactionService(org.wildfly.transaction.client.provider.remoting.RemotingTransactionService) CapabilityServiceBuilder(org.jboss.as.controller.CapabilityServiceBuilder) Endpoint(org.jboss.remoting3.Endpoint) EJBRemoteConnectorService(org.jboss.as.ejb3.remote.EJBRemoteConnectorService) OptionMap(org.xnio.OptionMap) ClientMapping(org.jboss.as.network.ClientMapping) ModelNode(org.jboss.dmr.ModelNode) OptionMap(org.xnio.OptionMap) Map(java.util.Map) ServiceConfigurator(org.wildfly.clustering.service.ServiceConfigurator) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator)

Example 8 with ServiceSupplierDependency

use of org.wildfly.clustering.service.ServiceSupplierDependency in project wildfly by wildfly.

the class TransportConfigurationServiceConfigurator method configure.

@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
    this.socketBinding = new ServiceSupplierDependency<>(CommonUnaryRequirement.SOCKET_BINDING.getServiceName(context, SOCKET_BINDING.resolveModelAttribute(context, model).asString()));
    String diagnosticsSocketBinding = DIAGNOSTICS_SOCKET_BINDING.resolveModelAttribute(context, model).asStringOrNull();
    this.diagnosticsSocketBinding = (diagnosticsSocketBinding != null) ? new ServiceSupplierDependency<>(CommonUnaryRequirement.SOCKET_BINDING.getServiceName(context, diagnosticsSocketBinding)) : new SimpleSupplierDependency<>(null);
    ModelNode machine = MACHINE.resolveModelAttribute(context, model);
    ModelNode rack = RACK.resolveModelAttribute(context, model);
    ModelNode site = SITE.resolveModelAttribute(context, model);
    if (site.isDefined() || rack.isDefined() || machine.isDefined()) {
        this.topology = new Topology() {

            @Override
            public String getMachine() {
                return machine.asStringOrNull();
            }

            @Override
            public String getRack() {
                return rack.asStringOrNull();
            }

            @Override
            public String getSite() {
                return site.asStringOrNull();
            }
        };
    }
    return super.configure(context, model);
}
Also used : SimpleSupplierDependency(org.wildfly.clustering.service.SimpleSupplierDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) ModelNode(org.jboss.dmr.ModelNode)

Example 9 with ServiceSupplierDependency

use of org.wildfly.clustering.service.ServiceSupplierDependency in project wildfly by wildfly.

the class JChannelFactoryServiceConfigurator method configure.

@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
    this.statisticsEnabled = StackResourceDefinition.Attribute.STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean();
    Resource resource = context.readResourceFromRoot(this.address, false);
    Iterator<Resource.ResourceEntry> transports = resource.getChildren(TransportResourceDefinition.WILDCARD_PATH.getKey()).iterator();
    if (!transports.hasNext()) {
        throw JGroupsLogger.ROOT_LOGGER.transportNotDefined(this.getName());
    }
    this.transport = new ServiceSupplierDependency<>(new SingletonProtocolServiceNameProvider(this.address, transports.next().getPathElement()));
    Set<Resource.ResourceEntry> entries = resource.getChildren(ProtocolResourceDefinition.WILDCARD_PATH.getKey());
    this.protocols = new ArrayList<>(entries.size());
    for (Resource.ResourceEntry entry : entries) {
        this.protocols.add(new ServiceSupplierDependency<>(new ProtocolServiceNameProvider(this.address, entry.getPathElement())));
    }
    this.relay = resource.hasChild(RelayResourceDefinition.PATH) ? new ServiceSupplierDependency<>(new SingletonProtocolServiceNameProvider(this.address, RelayResourceDefinition.PATH)) : null;
    this.socketBindingManager = new ServiceSupplierDependency<>(CommonRequirement.SOCKET_BINDING_MANAGER.getServiceName(context));
    return this;
}
Also used : Resource(org.jboss.as.controller.registry.Resource) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency)

Example 10 with ServiceSupplierDependency

use of org.wildfly.clustering.service.ServiceSupplierDependency in project wildfly by wildfly.

the class UndertowDistributableServerRuntimeHandler method execute.

@Override
public void execute(OperationContext context, String serverName) {
    SupplierDependency<RoutingProvider> provider = getRoutingProvider(context, serverName);
    if (provider != null) {
        ServiceTarget target = context.getServiceTarget();
        CapabilityServiceSupport support = context.getCapabilityServiceSupport();
        SupplierDependency<Server> server = new ServiceSupplierDependency<>(UndertowUnaryRequirement.SERVER.getServiceName(context, serverName));
        SupplierDependency<String> route = new FunctionSupplierDependency<>(server, Server::getRoute);
        Consumer<ServiceTarget> installer = new Consumer<ServiceTarget>() {

            @Override
            public void accept(ServiceTarget target) {
                for (CapabilityServiceConfigurator configurator : provider.get().getServiceConfigurators(serverName, route)) {
                    configurator.configure(support).build(target).install();
                }
            }
        };
        ServiceName name = ServiceName.JBOSS.append("clustering", "web", "undertow", "routing", serverName);
        provider.register(target.addService(name)).setInstance(new ChildTargetService(installer)).install();
    }
}
Also used : RoutingProvider(org.wildfly.clustering.web.routing.RoutingProvider) FunctionSupplierDependency(org.wildfly.clustering.service.FunctionSupplierDependency) Server(org.wildfly.extension.undertow.Server) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ChildTargetService(org.wildfly.clustering.service.ChildTargetService) ServiceTarget(org.jboss.msc.service.ServiceTarget) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport) Consumer(java.util.function.Consumer) ServiceName(org.jboss.msc.service.ServiceName)

Aggregations

ServiceSupplierDependency (org.wildfly.clustering.service.ServiceSupplierDependency)10 ModelNode (org.jboss.dmr.ModelNode)5 CapabilityServiceConfigurator (org.jboss.as.clustering.controller.CapabilityServiceConfigurator)4 ServiceTarget (org.jboss.msc.service.ServiceTarget)4 SupplierDependency (org.wildfly.clustering.service.SupplierDependency)4 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)3 ServiceName (org.jboss.msc.service.ServiceName)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Resource (org.jboss.as.controller.registry.Resource)2 ChildTargetService (org.wildfly.clustering.service.ChildTargetService)2 Dependency (org.wildfly.clustering.service.Dependency)2 ServiceConfigurator (org.wildfly.clustering.service.ServiceConfigurator)2 SimpleSupplierDependency (org.wildfly.clustering.service.SimpleSupplierDependency)2 InetSocketAddress (java.net.InetSocketAddress)1 UnknownHostException (java.net.UnknownHostException)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Consumer (java.util.function.Consumer)1