Search in sources :

Example 1 with LocalRouteServiceConfigurator

use of org.wildfly.clustering.web.cache.routing.LocalRouteServiceConfigurator in project wildfly by wildfly.

the class InfinispanRoutingProvider method getServiceConfigurators.

@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(String serverName, SupplierDependency<String> route) {
    String containerName = this.config.getContainerName();
    String cacheName = this.config.getCacheName();
    CapabilityServiceConfigurator localRouteConfigurator = new LocalRouteServiceConfigurator(serverName, route);
    CapabilityServiceConfigurator registryEntryConfigurator = new RouteRegistryEntryProviderServiceConfigurator(containerName, serverName);
    CapabilityServiceConfigurator configurationConfigurator = new TemplateConfigurationServiceConfigurator(ServiceNameFactory.parseServiceName(InfinispanCacheRequirement.CONFIGURATION.getName()).append(containerName, serverName), containerName, serverName, cacheName, this.config);
    CapabilityServiceConfigurator cacheConfigurator = new CacheServiceConfigurator<>(ServiceNameFactory.parseServiceName(InfinispanCacheRequirement.CACHE.getName()).append(containerName, serverName), containerName, serverName);
    List<Iterable<CapabilityServiceConfigurator>> configurators = new LinkedList<>();
    configurators.add(Arrays.asList(localRouteConfigurator, registryEntryConfigurator, configurationConfigurator, cacheConfigurator));
    ServiceNameRegistry<ClusteringCacheRequirement> registry = new ServiceNameRegistry<ClusteringCacheRequirement>() {

        @Override
        public ServiceName getServiceName(ClusteringCacheRequirement requirement) {
            return REGISTRY_REQUIREMENTS.contains(requirement) ? ServiceNameFactory.parseServiceName(requirement.getName()).append(containerName, serverName) : null;
        }
    };
    for (CacheServiceConfiguratorProvider provider : ServiceLoader.load(DistributedCacheServiceConfiguratorProvider.class, DistributedCacheServiceConfiguratorProvider.class.getClassLoader())) {
        configurators.add(provider.getServiceConfigurators(registry, containerName, serverName));
    }
    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) LocalRouteServiceConfigurator(org.wildfly.clustering.web.cache.routing.LocalRouteServiceConfigurator) 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

LinkedList (java.util.LinkedList)1 CapabilityServiceConfigurator (org.jboss.as.clustering.controller.CapabilityServiceConfigurator)1 CompositeIterable (org.wildfly.clustering.ee.CompositeIterable)1 CacheServiceConfigurator (org.wildfly.clustering.infinispan.spi.service.CacheServiceConfigurator)1 TemplateConfigurationServiceConfigurator (org.wildfly.clustering.infinispan.spi.service.TemplateConfigurationServiceConfigurator)1 ServiceNameRegistry (org.wildfly.clustering.service.ServiceNameRegistry)1 CacheServiceConfiguratorProvider (org.wildfly.clustering.spi.CacheServiceConfiguratorProvider)1 ClusteringCacheRequirement (org.wildfly.clustering.spi.ClusteringCacheRequirement)1 DistributedCacheServiceConfiguratorProvider (org.wildfly.clustering.spi.DistributedCacheServiceConfiguratorProvider)1 LocalRouteServiceConfigurator (org.wildfly.clustering.web.cache.routing.LocalRouteServiceConfigurator)1