Search in sources :

Example 21 with CapabilityServiceConfigurator

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

the class ChannelServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    String name = context.getCurrentAddressValue();
    String stack = STACK.resolveModelAttribute(context, model).asString();
    ServiceTarget target = context.getServiceTarget();
    new ChannelClusterServiceConfigurator(address).configure(context, model).build(target).install();
    ChannelServiceConfigurator channelBuilder = new ChannelServiceConfigurator(JCHANNEL, address).statisticsEnabled(STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean());
    channelBuilder.configure(context, model).build(target).install();
    new IdentityServiceConfigurator<>(JCHANNEL_FACTORY.getServiceName(address), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, stack)).build(target).install();
    new ForkChannelFactoryServiceConfigurator(FORK_CHANNEL_FACTORY, address.append(ForkResourceDefinition.pathElement(name))).configure(context, new ModelNode()).build(target).install();
    new ModuleServiceConfigurator(JCHANNEL_MODULE.getServiceName(address), MODULE).configure(context, model).build(target).setInitialMode(ServiceController.Mode.PASSIVE).install();
    new ServiceValueCaptorServiceConfigurator<>(this.registry.add(channelBuilder.getServiceName())).build(target).install();
    new BinderServiceConfigurator(JGroupsBindingFactory.createChannelBinding(name), JGroupsRequirement.CHANNEL.getServiceName(context, name)).build(target).install();
    new BinderServiceConfigurator(JGroupsBindingFactory.createChannelFactoryBinding(name), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, name)).build(target).install();
    // Install group services for channel
    ServiceNameRegistry<ClusteringRequirement> registry = new CapabilityServiceNameRegistry<>(CLUSTERING_CAPABILITIES, address);
    for (GroupServiceConfiguratorProvider provider : ServiceLoader.load(DistributedGroupServiceConfiguratorProvider.class, DistributedGroupServiceConfiguratorProvider.class.getClassLoader())) {
        for (CapabilityServiceConfigurator configurator : provider.getServiceConfigurators(registry, name)) {
            JGroupsLogger.ROOT_LOGGER.debugf("Installing %s for channel %s", configurator.getServiceName(), name);
            configurator.configure(context).build(target).install();
        }
    }
}
Also used : CapabilityServiceNameRegistry(org.wildfly.clustering.spi.CapabilityServiceNameRegistry) BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ServiceTarget(org.jboss.msc.service.ServiceTarget) ServiceValueCaptorServiceConfigurator(org.jboss.as.clustering.controller.ServiceValueCaptorServiceConfigurator) DistributedGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.DistributedGroupServiceConfiguratorProvider) GroupServiceConfiguratorProvider(org.wildfly.clustering.spi.GroupServiceConfiguratorProvider) DistributedGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.DistributedGroupServiceConfiguratorProvider) ModuleServiceConfigurator(org.jboss.as.clustering.controller.ModuleServiceConfigurator) PathAddress(org.jboss.as.controller.PathAddress) ClusteringRequirement(org.wildfly.clustering.spi.ClusteringRequirement) ModelNode(org.jboss.dmr.ModelNode) IdentityServiceConfigurator(org.wildfly.clustering.service.IdentityServiceConfigurator)

Example 22 with CapabilityServiceConfigurator

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

the class ForkServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    super.installServices(context, model);
    PathAddress address = context.getCurrentAddress();
    String name = address.getLastElement().getValue();
    String channel = address.getParent().getLastElement().getValue();
    ServiceTarget target = context.getServiceTarget();
    new IdentityServiceConfigurator<>(FORK_CHANNEL_SOURCE.getServiceName(address), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, channel)).build(target).install();
    new IdentityServiceConfigurator<>(FORK_CHANNEL_MODULE.getServiceName(address), JGroupsRequirement.CHANNEL_MODULE.getServiceName(context, channel)).build(target).install();
    new IdentityServiceConfigurator<>(FORK_CHANNEL_CLUSTER.getServiceName(address), JGroupsRequirement.CHANNEL_CLUSTER.getServiceName(context, channel)).build(target).install();
    new ChannelServiceConfigurator(FORK_CHANNEL, address).configure(context, model).build(target).install();
    new BinderServiceConfigurator(JGroupsBindingFactory.createChannelBinding(name), JGroupsRequirement.CHANNEL.getServiceName(context, name)).build(target).install();
    new BinderServiceConfigurator(JGroupsBindingFactory.createChannelFactoryBinding(name), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, name)).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, name, channel)) {
            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) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget) ClusteringRequirement(org.wildfly.clustering.spi.ClusteringRequirement) IdentityServiceConfigurator(org.wildfly.clustering.service.IdentityServiceConfigurator)

Example 23 with CapabilityServiceConfigurator

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

the class GroupRequirementServiceConfiguratorProvider method getServiceConfigurators.

@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(ServiceNameRegistry<ClusteringRequirement> registry, String group) {
    ServiceName name = registry.getServiceName(this.requirement);
    if (name == null)
        return Collections.emptySet();
    CapabilityServiceConfigurator configurator = this.factory.createServiceConfigurator(name, group);
    if (this.jndiNameFactory == null) {
        return Collections.singleton(configurator);
    }
    ContextNames.BindInfo binding = ContextNames.bindInfoFor(this.jndiNameFactory.apply(group).getAbsoluteName());
    CapabilityServiceConfigurator binderConfigurator = new BinderServiceConfigurator(binding, configurator.getServiceName());
    return Arrays.asList(configurator, binderConfigurator);
}
Also used : BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ServiceName(org.jboss.msc.service.ServiceName) ContextNames(org.jboss.as.naming.deployment.ContextNames)

Example 24 with CapabilityServiceConfigurator

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

the class IdentityGroupRequirementServiceConfiguratorProvider method getServiceConfigurators.

@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(ServiceNameRegistry<ClusteringRequirement> registry, String group, String targetGroup) {
    ServiceName name = registry.getServiceName(this.requirement);
    if (name == null)
        return Collections.emptySet();
    CapabilityServiceConfigurator configurator = new IdentityCapabilityServiceConfigurator<>(name, this.requirement, targetGroup);
    if ((this.jndiNameFactory == null) || JndiNameFactory.DEFAULT_LOCAL_NAME.equals(targetGroup)) {
        return Collections.singleton(configurator);
    }
    ContextNames.BindInfo binding = ContextNames.bindInfoFor(this.jndiNameFactory.apply(group).getAbsoluteName());
    CapabilityServiceConfigurator binderConfigurator = new BinderServiceConfigurator(binding, configurator.getServiceName());
    return Arrays.asList(configurator, binderConfigurator);
}
Also used : BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) 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) ContextNames(org.jboss.as.naming.deployment.ContextNames)

Example 25 with CapabilityServiceConfigurator

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

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