Search in sources :

Example 11 with CapabilityServiceConfigurator

use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator 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 12 with CapabilityServiceConfigurator

use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator in project wildfly by wildfly.

the class CacheServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress cacheAddress = context.getCurrentAddress();
    PathAddress containerAddress = cacheAddress.getParent();
    String containerName = containerAddress.getLastElement().getValue();
    String cacheName = cacheAddress.getLastElement().getValue();
    ServiceTarget target = context.getServiceTarget();
    ServiceName moduleServiceName = CacheComponent.MODULES.getServiceName(cacheAddress);
    if (model.hasDefined(MODULES.getName())) {
        new ModulesServiceConfigurator(moduleServiceName, MODULES, Collections.emptyList()).configure(context, model).build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
    } else {
        new IdentityServiceConfigurator<>(moduleServiceName, CacheContainerComponent.MODULES.getServiceName(containerAddress)).build(target).install();
    }
    this.configuratorFactory.createServiceConfigurator(cacheAddress).configure(context, model).build(target).install();
    new CacheServiceConfigurator<>(CACHE.getServiceName(cacheAddress), containerName, cacheName).configure(context).build(target).install();
    if (context.hasOptionalCapability(XA_RESOURCE_RECOVERY_REGISTRY.getName(), null, null)) {
        new XAResourceRecoveryServiceConfigurator(cacheAddress).configure(context).build(target).install();
    }
    new BinderServiceConfigurator(InfinispanBindingFactory.createCacheConfigurationBinding(containerName, cacheName), CONFIGURATION.getServiceName(cacheAddress)).build(target).install();
    new BinderServiceConfigurator(InfinispanBindingFactory.createCacheBinding(containerName, cacheName), CACHE.getServiceName(cacheAddress)).build(target).install();
    ServiceNameRegistry<ClusteringCacheRequirement> registry = new CapabilityServiceNameRegistry<>(CLUSTERING_CAPABILITIES, cacheAddress);
    for (CacheServiceConfiguratorProvider provider : ServiceLoader.load(this.providerClass, this.providerClass.getClassLoader())) {
        for (CapabilityServiceConfigurator configurator : provider.getServiceConfigurators(registry, containerName, cacheName)) {
            configurator.configure(context).build(target).install();
        }
    }
}
Also used : ModulesServiceConfigurator(org.jboss.as.clustering.controller.ModulesServiceConfigurator) CapabilityServiceNameRegistry(org.wildfly.clustering.spi.CapabilityServiceNameRegistry) CacheServiceConfiguratorProvider(org.wildfly.clustering.spi.CacheServiceConfiguratorProvider) BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ServiceTarget(org.jboss.msc.service.ServiceTarget) ClusteringCacheRequirement(org.wildfly.clustering.spi.ClusteringCacheRequirement) ServiceName(org.jboss.msc.service.ServiceName) PathAddress(org.jboss.as.controller.PathAddress) IdentityServiceConfigurator(org.wildfly.clustering.service.IdentityServiceConfigurator)

Example 13 with CapabilityServiceConfigurator

use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator in project wildfly by wildfly.

the class JGroupsSubsystemServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    ROOT_LOGGER.activatingSubsystem(Version.printVersion());
    ServiceTarget target = context.getServiceTarget();
    PathAddress address = context.getCurrentAddress();
    // In this case, the Infinispan subsystem may have already registered default group capabilities
    if (context.getProcessType().isServer() && !context.isBooting()) {
        if (context.readResourceFromRoot(address.getParent(), false).hasChild(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "infinispan"))) {
            // Following restart, default group services will be installed by this handler, rather than the infinispan subsystem handler
            context.addStep((ctx, operation) -> {
                ctx.reloadRequired();
                ctx.completeStep(OperationContext.RollbackHandler.REVERT_RELOAD_REQUIRED_ROLLBACK_HANDLER);
            }, OperationContext.Stage.RUNTIME);
            return;
        }
    }
    new ProtocolDefaultsServiceConfigurator().build(target).install();
    String defaultChannel = DEFAULT_CHANNEL.resolveModelAttribute(context, model).asStringOrNull();
    if (defaultChannel != null) {
        for (Map.Entry<JGroupsRequirement, Capability> entry : CAPABILITIES.entrySet()) {
            new IdentityServiceConfigurator<>(entry.getValue().getServiceName(address), entry.getKey().getServiceName(context, defaultChannel)).build(target).install();
        }
        if (!defaultChannel.equals(JndiNameFactory.DEFAULT_LOCAL_NAME)) {
            new BinderServiceConfigurator(JGroupsBindingFactory.createChannelBinding(JndiNameFactory.DEFAULT_LOCAL_NAME), JGroupsRequirement.CHANNEL.getServiceName(context, defaultChannel)).build(target).install();
            new BinderServiceConfigurator(JGroupsBindingFactory.createChannelFactoryBinding(JndiNameFactory.DEFAULT_LOCAL_NAME), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, defaultChannel)).build(target).install();
        }
        ServiceNameRegistry<ClusteringRequirement> registry = new CapabilityServiceNameRegistry<>(CLUSTERING_CAPABILITIES, address);
        for (IdentityGroupServiceConfiguratorProvider provider : ServiceLoader.load(IdentityGroupServiceConfiguratorProvider.class, IdentityGroupServiceConfiguratorProvider.class.getClassLoader())) {
            for (CapabilityServiceConfigurator configurator : provider.getServiceConfigurators(registry, null, defaultChannel)) {
                configurator.configure(context).build(target).install();
            }
        }
    }
}
Also used : IdentityGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider) CapabilityServiceNameRegistry(org.wildfly.clustering.spi.CapabilityServiceNameRegistry) BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) Capability(org.jboss.as.clustering.controller.Capability) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ServiceTarget(org.jboss.msc.service.ServiceTarget) JGroupsRequirement(org.wildfly.clustering.jgroups.spi.JGroupsRequirement) PathAddress(org.jboss.as.controller.PathAddress) ClusteringRequirement(org.wildfly.clustering.spi.ClusteringRequirement) Map(java.util.Map) IdentityServiceConfigurator(org.wildfly.clustering.service.IdentityServiceConfigurator)

Example 14 with CapabilityServiceConfigurator

use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator in project wildfly by wildfly.

the class SingletonServiceConfiguratorFactoryServiceConfiguratorProvider method getServiceConfigurators.

@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(ServiceNameRegistry<ClusteringCacheRequirement> registry, String containerName, String cacheName) {
    Iterable<CapabilityServiceConfigurator> configurators = super.getServiceConfigurators(registry, containerName, cacheName);
    @SuppressWarnings("deprecation") ServiceName name = registry.getServiceName(ClusteringCacheRequirement.SINGLETON_SERVICE_BUILDER_FACTORY);
    if (name == null)
        return configurators;
    // Add configurator for deprecated capability
    CapabilityServiceConfigurator deprecatedConfigurator = new IdentityCapabilityServiceConfigurator<>(name, ClusteringCacheRequirement.SINGLETON_SERVICE_CONFIGURATOR_FACTORY, containerName, cacheName);
    return new CompositeIterable<>(configurators, Collections.singleton(deprecatedConfigurator));
}
Also used : IdentityCapabilityServiceConfigurator(org.jboss.as.clustering.controller.IdentityCapabilityServiceConfigurator) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ServiceName(org.jboss.msc.service.ServiceName) IdentityCapabilityServiceConfigurator(org.jboss.as.clustering.controller.IdentityCapabilityServiceConfigurator) CompositeIterable(org.wildfly.clustering.ee.CompositeIterable)

Example 15 with CapabilityServiceConfigurator

use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator in project wildfly by wildfly.

the class IdentityRegistryFactoryServiceConfiguratorProvider method getServiceConfigurators.

@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(ServiceNameRegistry<ClusteringCacheRequirement> registry, String containerName, String aliasCacheName, String targetCacheName) {
    Iterable<CapabilityServiceConfigurator> configurators = super.getServiceConfigurators(registry, containerName, aliasCacheName, targetCacheName);
    ServiceName registryServiceName = registry.getServiceName(ClusteringCacheRequirement.REGISTRY);
    ServiceName registryEntryServiceName = registry.getServiceName(ClusteringCacheRequirement.REGISTRY_ENTRY);
    if ((registryServiceName == null) && (registryEntryServiceName == null))
        return configurators;
    List<CapabilityServiceConfigurator> registryConfigurators = new ArrayList<>(2);
    if (registryServiceName != null) {
        registryConfigurators.add(new IdentityCapabilityServiceConfigurator<>(registryServiceName, ClusteringCacheRequirement.REGISTRY, containerName, targetCacheName));
    }
    if (registryEntryServiceName != null) {
        registryConfigurators.add(new IdentityCapabilityServiceConfigurator<>(registryEntryServiceName, ClusteringCacheRequirement.REGISTRY_ENTRY, containerName, targetCacheName));
    }
    return new CompositeIterable<>(configurators, registryConfigurators);
}
Also used : IdentityCapabilityServiceConfigurator(org.jboss.as.clustering.controller.IdentityCapabilityServiceConfigurator) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ServiceName(org.jboss.msc.service.ServiceName) ArrayList(java.util.ArrayList) CompositeIterable(org.wildfly.clustering.ee.CompositeIterable)

Aggregations

CapabilityServiceConfigurator (org.jboss.as.clustering.controller.CapabilityServiceConfigurator)25 ServiceName (org.jboss.msc.service.ServiceName)12 ServiceTarget (org.jboss.msc.service.ServiceTarget)11 BinderServiceConfigurator (org.jboss.as.clustering.naming.BinderServiceConfigurator)9 PathAddress (org.jboss.as.controller.PathAddress)9 CapabilityServiceNameRegistry (org.wildfly.clustering.spi.CapabilityServiceNameRegistry)9 ClusteringRequirement (org.wildfly.clustering.spi.ClusteringRequirement)7 IdentityGroupServiceConfiguratorProvider (org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider)6 CompositeIterable (org.wildfly.clustering.ee.CompositeIterable)5 ClusteringCacheRequirement (org.wildfly.clustering.spi.ClusteringCacheRequirement)5 IdentityCapabilityServiceConfigurator (org.jboss.as.clustering.controller.IdentityCapabilityServiceConfigurator)4 ContextNames (org.jboss.as.naming.deployment.ContextNames)4 IdentityServiceConfigurator (org.wildfly.clustering.service.IdentityServiceConfigurator)4 CacheServiceConfiguratorProvider (org.wildfly.clustering.spi.CacheServiceConfiguratorProvider)4 LinkedList (java.util.LinkedList)3 Map (java.util.Map)3 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)3 CacheServiceConfigurator (org.wildfly.clustering.infinispan.spi.service.CacheServiceConfigurator)3 TemplateConfigurationServiceConfigurator (org.wildfly.clustering.infinispan.spi.service.TemplateConfigurationServiceConfigurator)3 DistributedCacheServiceConfiguratorProvider (org.wildfly.clustering.spi.DistributedCacheServiceConfiguratorProvider)3