Search in sources :

Example 1 with GroupServiceConfiguratorProvider

use of org.wildfly.clustering.spi.GroupServiceConfiguratorProvider in project wildfly by wildfly.

the class InfinispanSubsystemServiceHandler method removeServices.

@Override
public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    ServiceNameRegistry<ClusteringRequirement> localRegistry = new CapabilityServiceNameRegistry<>(LOCAL_CLUSTERING_CAPABILITIES, address);
    for (GroupServiceConfiguratorProvider provider : ServiceLoader.load(LocalGroupServiceConfiguratorProvider.class, LocalGroupServiceConfiguratorProvider.class.getClassLoader())) {
        for (ServiceNameProvider configurator : provider.getServiceConfigurators(localRegistry, LocalGroupServiceConfiguratorProvider.LOCAL)) {
            context.removeService(configurator.getServiceName());
        }
    }
    if (!context.hasOptionalCapability(JGroupsRequirement.CHANNEL.getDefaultRequirement().getName(), null, null)) {
        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, LocalGroupServiceConfiguratorProvider.LOCAL)) {
                context.removeService(configurator.getServiceName());
            }
        }
    }
}
Also used : IdentityGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider) CapabilityServiceNameRegistry(org.wildfly.clustering.spi.CapabilityServiceNameRegistry) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) PathAddress(org.jboss.as.controller.PathAddress) LocalGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.LocalGroupServiceConfiguratorProvider) ClusteringRequirement(org.wildfly.clustering.spi.ClusteringRequirement) ServiceNameProvider(org.wildfly.clustering.service.ServiceNameProvider) GroupServiceConfiguratorProvider(org.wildfly.clustering.spi.GroupServiceConfiguratorProvider) LocalGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.LocalGroupServiceConfiguratorProvider) IdentityGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider)

Example 2 with GroupServiceConfiguratorProvider

use of org.wildfly.clustering.spi.GroupServiceConfiguratorProvider in project wildfly by wildfly.

the class InfinispanSubsystemServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    InfinispanLogger.ROOT_LOGGER.activatingSubsystem();
    PathAddress address = context.getCurrentAddress();
    ServiceTarget target = context.getServiceTarget();
    // Install local group services
    ServiceNameRegistry<ClusteringRequirement> localRegistry = new CapabilityServiceNameRegistry<>(LOCAL_CLUSTERING_CAPABILITIES, address);
    for (GroupServiceConfiguratorProvider provider : ServiceLoader.load(LocalGroupServiceConfiguratorProvider.class, LocalGroupServiceConfiguratorProvider.class.getClassLoader())) {
        InfinispanLogger.ROOT_LOGGER.debugf("Installing %s for %s group", provider.getClass().getSimpleName(), LocalGroupServiceConfiguratorProvider.LOCAL);
        for (CapabilityServiceConfigurator configurator : provider.getServiceConfigurators(localRegistry, LocalGroupServiceConfiguratorProvider.LOCAL)) {
            configurator.configure(context).build(target).install();
        }
    }
    // If JGroups subsystem is not available, install default group aliases to local group.
    if (!context.hasOptionalCapability(JGroupsRequirement.CHANNEL.getDefaultRequirement().getName(), null, null)) {
        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, LocalGroupServiceConfiguratorProvider.LOCAL)) {
                configurator.configure(context).build(target).install();
            }
        }
    }
}
Also used : IdentityGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider) CapabilityServiceNameRegistry(org.wildfly.clustering.spi.CapabilityServiceNameRegistry) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget) LocalGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.LocalGroupServiceConfiguratorProvider) ClusteringRequirement(org.wildfly.clustering.spi.ClusteringRequirement) GroupServiceConfiguratorProvider(org.wildfly.clustering.spi.GroupServiceConfiguratorProvider) LocalGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.LocalGroupServiceConfiguratorProvider) IdentityGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider)

Example 3 with GroupServiceConfiguratorProvider

use of org.wildfly.clustering.spi.GroupServiceConfiguratorProvider 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 4 with GroupServiceConfiguratorProvider

use of org.wildfly.clustering.spi.GroupServiceConfiguratorProvider in project wildfly by wildfly.

the class ChannelServiceHandler method removeServices.

@Override
public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    String name = context.getCurrentAddressValue();
    for (Capability capability : EnumSet.allOf(Capability.class)) {
        context.removeService(capability.getServiceName(address));
    }
    context.removeService(JGroupsBindingFactory.createChannelBinding(name).getBinderServiceName());
    context.removeService(JGroupsBindingFactory.createChannelFactoryBinding(name).getBinderServiceName());
    ServiceNameRegistry<ClusteringRequirement> registry = new CapabilityServiceNameRegistry<>(CLUSTERING_CAPABILITIES, address);
    for (GroupServiceConfiguratorProvider provider : ServiceLoader.load(DistributedGroupServiceConfiguratorProvider.class, DistributedGroupServiceConfiguratorProvider.class.getClassLoader())) {
        for (ServiceNameProvider configurator : provider.getServiceConfigurators(registry, name)) {
            JGroupsLogger.ROOT_LOGGER.debugf("Removing %s for channel %s", configurator.getServiceName(), name);
            context.removeService(configurator.getServiceName());
        }
    }
    context.removeService(new ServiceValueCaptorServiceConfigurator<>(this.registry.remove(JCHANNEL.getServiceName(address))).getServiceName());
}
Also used : CapabilityServiceNameRegistry(org.wildfly.clustering.spi.CapabilityServiceNameRegistry) Capability(org.jboss.as.clustering.jgroups.subsystem.ChannelResourceDefinition.Capability) PathAddress(org.jboss.as.controller.PathAddress) ServiceValueCaptorServiceConfigurator(org.jboss.as.clustering.controller.ServiceValueCaptorServiceConfigurator) DistributedGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.DistributedGroupServiceConfiguratorProvider) ClusteringRequirement(org.wildfly.clustering.spi.ClusteringRequirement) ServiceNameProvider(org.wildfly.clustering.service.ServiceNameProvider) GroupServiceConfiguratorProvider(org.wildfly.clustering.spi.GroupServiceConfiguratorProvider) DistributedGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.DistributedGroupServiceConfiguratorProvider)

Aggregations

PathAddress (org.jboss.as.controller.PathAddress)4 CapabilityServiceNameRegistry (org.wildfly.clustering.spi.CapabilityServiceNameRegistry)4 ClusteringRequirement (org.wildfly.clustering.spi.ClusteringRequirement)4 GroupServiceConfiguratorProvider (org.wildfly.clustering.spi.GroupServiceConfiguratorProvider)4 CapabilityServiceConfigurator (org.jboss.as.clustering.controller.CapabilityServiceConfigurator)3 ServiceValueCaptorServiceConfigurator (org.jboss.as.clustering.controller.ServiceValueCaptorServiceConfigurator)2 ServiceTarget (org.jboss.msc.service.ServiceTarget)2 ServiceNameProvider (org.wildfly.clustering.service.ServiceNameProvider)2 DistributedGroupServiceConfiguratorProvider (org.wildfly.clustering.spi.DistributedGroupServiceConfiguratorProvider)2 IdentityGroupServiceConfiguratorProvider (org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider)2 LocalGroupServiceConfiguratorProvider (org.wildfly.clustering.spi.LocalGroupServiceConfiguratorProvider)2 ModuleServiceConfigurator (org.jboss.as.clustering.controller.ModuleServiceConfigurator)1 Capability (org.jboss.as.clustering.jgroups.subsystem.ChannelResourceDefinition.Capability)1 BinderServiceConfigurator (org.jboss.as.clustering.naming.BinderServiceConfigurator)1 ModelNode (org.jboss.dmr.ModelNode)1 IdentityServiceConfigurator (org.wildfly.clustering.service.IdentityServiceConfigurator)1