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);
}
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();
}
}
}
}
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();
}
}
}
}
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);
}
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();
}
}
}
Aggregations