Search in sources :

Example 6 with IdentityGroupServiceConfiguratorProvider

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

the class JGroupsSubsystemServiceHandler method removeServices.

@Override
public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    String defaultChannel = DEFAULT_CHANNEL.resolveModelAttribute(context, model).asStringOrNull();
    if (defaultChannel != null) {
        ServiceNameRegistry<ClusteringRequirement> registry = new CapabilityServiceNameRegistry<>(CLUSTERING_CAPABILITIES, address);
        for (IdentityGroupServiceConfiguratorProvider provider : ServiceLoader.load(IdentityGroupServiceConfiguratorProvider.class, IdentityGroupServiceConfiguratorProvider.class.getClassLoader())) {
            for (ServiceNameProvider configurator : provider.getServiceConfigurators(registry, null, defaultChannel)) {
                context.removeService(configurator.getServiceName());
            }
        }
        if (!defaultChannel.equals(JndiNameFactory.DEFAULT_LOCAL_NAME)) {
            context.removeService(JGroupsBindingFactory.createChannelFactoryBinding(JndiNameFactory.DEFAULT_LOCAL_NAME).getBinderServiceName());
            context.removeService(JGroupsBindingFactory.createChannelBinding(JndiNameFactory.DEFAULT_LOCAL_NAME).getBinderServiceName());
        }
        for (Capability capability : CAPABILITIES.values()) {
            context.removeService(capability.getServiceName(address));
        }
    }
    context.removeService(ProtocolDefaultsServiceConfigurator.SERVICE_NAME);
}
Also used : IdentityGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider) CapabilityServiceNameRegistry(org.wildfly.clustering.spi.CapabilityServiceNameRegistry) Capability(org.jboss.as.clustering.controller.Capability) PathAddress(org.jboss.as.controller.PathAddress) ClusteringRequirement(org.wildfly.clustering.spi.ClusteringRequirement) ServiceNameProvider(org.wildfly.clustering.service.ServiceNameProvider)

Example 7 with IdentityGroupServiceConfiguratorProvider

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

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

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

the class ForkServiceHandler method removeServices.

@Override
public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    String name = context.getCurrentAddressValue();
    String channel = address.getParent().getLastElement().getValue();
    ServiceNameRegistry<ClusteringRequirement> registry = new CapabilityServiceNameRegistry<>(CLUSTERING_CAPABILITIES, address);
    for (IdentityGroupServiceConfiguratorProvider provider : ServiceLoader.load(IdentityGroupServiceConfiguratorProvider.class, IdentityGroupServiceConfiguratorProvider.class.getClassLoader())) {
        for (ServiceNameProvider configurator : provider.getServiceConfigurators(registry, name, channel)) {
            context.removeService(configurator.getServiceName());
        }
    }
    context.removeService(JGroupsBindingFactory.createChannelBinding(name).getBinderServiceName());
    context.removeService(JGroupsBindingFactory.createChannelFactoryBinding(name).getBinderServiceName());
    // FORK_CHANNEL_FACTORY is removed by super impl
    for (Capability capability : EnumSet.complementOf(EnumSet.of(FORK_CHANNEL_FACTORY))) {
        context.removeService(capability.getServiceName(address));
    }
    super.removeServices(context, model);
}
Also used : IdentityGroupServiceConfiguratorProvider(org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider) CapabilityServiceNameRegistry(org.wildfly.clustering.spi.CapabilityServiceNameRegistry) Capability(org.jboss.as.clustering.controller.Capability) PathAddress(org.jboss.as.controller.PathAddress) ClusteringRequirement(org.wildfly.clustering.spi.ClusteringRequirement) ServiceNameProvider(org.wildfly.clustering.service.ServiceNameProvider)

Example 10 with IdentityGroupServiceConfiguratorProvider

use of org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider 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)

Aggregations

PathAddress (org.jboss.as.controller.PathAddress)10 CapabilityServiceNameRegistry (org.wildfly.clustering.spi.CapabilityServiceNameRegistry)10 ClusteringRequirement (org.wildfly.clustering.spi.ClusteringRequirement)10 IdentityGroupServiceConfiguratorProvider (org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider)10 CapabilityServiceConfigurator (org.jboss.as.clustering.controller.CapabilityServiceConfigurator)6 ServiceTarget (org.jboss.msc.service.ServiceTarget)5 ServiceNameProvider (org.wildfly.clustering.service.ServiceNameProvider)5 Capability (org.jboss.as.clustering.controller.Capability)3 BinderServiceConfigurator (org.jboss.as.clustering.naming.BinderServiceConfigurator)2 IdentityServiceConfigurator (org.wildfly.clustering.service.IdentityServiceConfigurator)2 GroupServiceConfiguratorProvider (org.wildfly.clustering.spi.GroupServiceConfiguratorProvider)2 LocalGroupServiceConfiguratorProvider (org.wildfly.clustering.spi.LocalGroupServiceConfiguratorProvider)2 Map (java.util.Map)1 JGroupsRequirement (org.wildfly.clustering.jgroups.spi.JGroupsRequirement)1