Search in sources :

Example 6 with CacheServiceConfiguratorProvider

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

the class InfinispanClientMappingsRegistryProvider method getServiceConfigurators.

@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(String containerName, String connectorName, SupplierDependency<List<ClientMapping>> clientMappings) {
    CapabilityServiceConfigurator configurationConfigurator = new TemplateConfigurationServiceConfigurator(ServiceNameFactory.parseServiceName(InfinispanCacheRequirement.CONFIGURATION.getName()).append(containerName, connectorName), containerName, connectorName, null, this);
    CapabilityServiceConfigurator cacheConfigurator = new CacheServiceConfigurator<>(ServiceNameFactory.parseServiceName(InfinispanCacheRequirement.CACHE.getName()).append(containerName, connectorName), containerName, connectorName);
    CapabilityServiceConfigurator registryEntryConfigurator = new ClientMappingsRegistryEntryServiceConfigurator(containerName, connectorName, clientMappings);
    List<Iterable<CapabilityServiceConfigurator>> configurators = new LinkedList<>();
    configurators.add(Arrays.asList(configurationConfigurator, cacheConfigurator, registryEntryConfigurator));
    ServiceNameRegistry<ClusteringCacheRequirement> routingRegistry = new ServiceNameRegistry<ClusteringCacheRequirement>() {

        @Override
        public ServiceName getServiceName(ClusteringCacheRequirement requirement) {
            return REGISTRY_REQUIREMENTS.contains(requirement) ? ServiceNameFactory.parseServiceName(requirement.getName()).append(containerName, connectorName) : null;
        }
    };
    for (CacheServiceConfiguratorProvider provider : ServiceLoader.load(DistributedCacheServiceConfiguratorProvider.class, DistributedCacheServiceConfiguratorProvider.class.getClassLoader())) {
        configurators.add(provider.getServiceConfigurators(routingRegistry, containerName, connectorName));
    }
    return new CompositeIterable<>(configurators);
}
Also used : DistributedCacheServiceConfiguratorProvider(org.wildfly.clustering.spi.DistributedCacheServiceConfiguratorProvider) DistributedCacheServiceConfiguratorProvider(org.wildfly.clustering.spi.DistributedCacheServiceConfiguratorProvider) CacheServiceConfiguratorProvider(org.wildfly.clustering.spi.CacheServiceConfiguratorProvider) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) CompositeIterable(org.wildfly.clustering.ee.CompositeIterable) CompositeIterable(org.wildfly.clustering.ee.CompositeIterable) ClusteringCacheRequirement(org.wildfly.clustering.spi.ClusteringCacheRequirement) LinkedList(java.util.LinkedList) TemplateConfigurationServiceConfigurator(org.wildfly.clustering.infinispan.spi.service.TemplateConfigurationServiceConfigurator) CacheServiceConfigurator(org.wildfly.clustering.infinispan.spi.service.CacheServiceConfigurator) ServiceNameRegistry(org.wildfly.clustering.service.ServiceNameRegistry)

Aggregations

CacheServiceConfiguratorProvider (org.wildfly.clustering.spi.CacheServiceConfiguratorProvider)6 CapabilityServiceConfigurator (org.jboss.as.clustering.controller.CapabilityServiceConfigurator)5 ClusteringCacheRequirement (org.wildfly.clustering.spi.ClusteringCacheRequirement)5 CacheServiceConfigurator (org.wildfly.clustering.infinispan.spi.service.CacheServiceConfigurator)4 TemplateConfigurationServiceConfigurator (org.wildfly.clustering.infinispan.spi.service.TemplateConfigurationServiceConfigurator)4 DistributedCacheServiceConfiguratorProvider (org.wildfly.clustering.spi.DistributedCacheServiceConfiguratorProvider)4 LinkedList (java.util.LinkedList)3 CompositeIterable (org.wildfly.clustering.ee.CompositeIterable)3 ServiceNameRegistry (org.wildfly.clustering.service.ServiceNameRegistry)3 PathAddress (org.jboss.as.controller.PathAddress)2 ServiceName (org.jboss.msc.service.ServiceName)2 CapabilityServiceNameRegistry (org.wildfly.clustering.spi.CapabilityServiceNameRegistry)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 ServiceLoader (java.util.ServiceLoader)1 Consumer (java.util.function.Consumer)1 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1 ExpirationConfiguration (org.infinispan.configuration.cache.ExpirationConfiguration)1 StorageType (org.infinispan.configuration.cache.StorageType)1