use of org.wildfly.clustering.spi.CapabilityServiceNameRegistry 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());
}
}
}
}
use of org.wildfly.clustering.spi.CapabilityServiceNameRegistry in project wildfly by wildfly.
the class CacheContainerServiceHandler method removeServices.
@Override
public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException {
PathAddress address = context.getCurrentAddress();
String name = context.getCurrentAddressValue();
String defaultCache = DEFAULT_CACHE.resolveModelAttribute(context, model).asString(null);
if (defaultCache != null) {
ServiceNameRegistry<ClusteringCacheRequirement> registry = new CapabilityServiceNameRegistry<>(DEFAULT_CLUSTERING_CAPABILITIES, address);
for (IdentityCacheServiceConfiguratorProvider provider : ServiceLoader.load(IdentityCacheServiceConfiguratorProvider.class, IdentityCacheServiceConfiguratorProvider.class.getClassLoader())) {
for (ServiceNameProvider configurator : provider.getServiceConfigurators(registry, name, null, defaultCache)) {
context.removeService(configurator.getServiceName());
}
}
if (!defaultCache.equals(JndiNameFactory.DEFAULT_LOCAL_NAME)) {
context.removeService(InfinispanBindingFactory.createCacheBinding(name, JndiNameFactory.DEFAULT_LOCAL_NAME).getBinderServiceName());
context.removeService(InfinispanBindingFactory.createCacheConfigurationBinding(name, JndiNameFactory.DEFAULT_LOCAL_NAME).getBinderServiceName());
}
for (Capability capability : DEFAULT_CAPABILITIES.values()) {
context.removeService(capability.getServiceName(address));
}
}
context.removeService(InfinispanBindingFactory.createCacheContainerBinding(name).getBinderServiceName());
context.removeService(CacheContainerComponent.MODULES.getServiceName(address));
for (Capability capability : EnumSet.allOf(CacheContainerResourceDefinition.Capability.class)) {
context.removeService(capability.getServiceName(address));
}
context.removeService(new ServiceValueCaptorServiceConfigurator<>(this.containerRegistry.remove(CacheContainerResourceDefinition.Capability.CONTAINER.getServiceName(address))).getServiceName());
}
use of org.wildfly.clustering.spi.CapabilityServiceNameRegistry 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();
}
}
}
use of org.wildfly.clustering.spi.CapabilityServiceNameRegistry in project wildfly by wildfly.
the class CacheServiceHandler method removeServices.
@Override
public void removeServices(OperationContext context, ModelNode model) {
PathAddress cacheAddress = context.getCurrentAddress();
PathAddress containerAddress = cacheAddress.getParent();
String containerName = containerAddress.getLastElement().getValue();
String cacheName = cacheAddress.getLastElement().getValue();
ServiceNameRegistry<ClusteringCacheRequirement> registry = new CapabilityServiceNameRegistry<>(CLUSTERING_CAPABILITIES, cacheAddress);
for (CacheServiceConfiguratorProvider provider : ServiceLoader.load(this.providerClass, this.providerClass.getClassLoader())) {
for (ServiceNameProvider configurator : provider.getServiceConfigurators(registry, containerName, cacheName)) {
context.removeService(configurator.getServiceName());
}
}
context.removeService(InfinispanBindingFactory.createCacheBinding(containerName, cacheName).getBinderServiceName());
context.removeService(InfinispanBindingFactory.createCacheConfigurationBinding(containerName, cacheName).getBinderServiceName());
context.removeService(new XAResourceRecoveryServiceConfigurator(cacheAddress).getServiceName());
context.removeService(CacheComponent.MODULES.getServiceName(cacheAddress));
for (Capability capability : EnumSet.allOf(Capability.class)) {
context.removeService(capability.getServiceName(cacheAddress));
}
}
use of org.wildfly.clustering.spi.CapabilityServiceNameRegistry 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();
}
}
}
}
Aggregations