Search in sources :

Example 1 with InfinispanCacheRequirement

use of org.wildfly.clustering.infinispan.spi.InfinispanCacheRequirement in project wildfly by wildfly.

the class CacheContainerServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    String name = context.getCurrentAddressValue();
    ServiceTarget target = context.getServiceTarget();
    new ModulesServiceConfigurator(CacheContainerComponent.MODULES.getServiceName(address), MODULES, Collections.singletonList(Module.forClass(WildFlyInfinispanModuleLifecycle.class))).configure(context, model).build(target).setInitialMode(ServiceController.Mode.PASSIVE).install();
    GlobalConfigurationServiceConfigurator configBuilder = new GlobalConfigurationServiceConfigurator(address);
    configBuilder.configure(context, model).build(target).install();
    CacheContainerServiceConfigurator containerBuilder = new CacheContainerServiceConfigurator(address, this.cacheRegistry).configure(context, model);
    containerBuilder.build(target).install();
    new ServiceValueCaptorServiceConfigurator<>(this.containerRegistry.add(containerBuilder.getServiceName())).build(target).install();
    new KeyAffinityServiceFactoryServiceConfigurator(address).build(target).install();
    new BinderServiceConfigurator(InfinispanBindingFactory.createCacheContainerBinding(name), containerBuilder.getServiceName()).build(target).install();
    String defaultCache = DEFAULT_CACHE.resolveModelAttribute(context, model).asString(null);
    if (defaultCache != null) {
        for (Map.Entry<InfinispanCacheRequirement, Capability> entry : DEFAULT_CAPABILITIES.entrySet()) {
            new IdentityServiceConfigurator<>(entry.getValue().getServiceName(address), entry.getKey().getServiceName(context, name, defaultCache)).build(target).install();
        }
        if (!defaultCache.equals(JndiNameFactory.DEFAULT_LOCAL_NAME)) {
            new BinderServiceConfigurator(InfinispanBindingFactory.createCacheBinding(name, JndiNameFactory.DEFAULT_LOCAL_NAME), DEFAULT_CAPABILITIES.get(InfinispanCacheRequirement.CACHE).getServiceName(address)).build(target).install();
            new BinderServiceConfigurator(InfinispanBindingFactory.createCacheConfigurationBinding(name, JndiNameFactory.DEFAULT_LOCAL_NAME), DEFAULT_CAPABILITIES.get(InfinispanCacheRequirement.CONFIGURATION).getServiceName(address)).build(target).install();
        }
        ServiceNameRegistry<ClusteringCacheRequirement> registry = new CapabilityServiceNameRegistry<>(DEFAULT_CLUSTERING_CAPABILITIES, address);
        for (IdentityCacheServiceConfiguratorProvider provider : ServiceLoader.load(IdentityCacheServiceConfiguratorProvider.class, IdentityCacheServiceConfiguratorProvider.class.getClassLoader())) {
            for (CapabilityServiceConfigurator configurator : provider.getServiceConfigurators(registry, name, null, defaultCache)) {
                configurator.configure(context).build(target).install();
            }
        }
    }
}
Also used : ModulesServiceConfigurator(org.jboss.as.clustering.controller.ModulesServiceConfigurator) 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) ServiceValueCaptorServiceConfigurator(org.jboss.as.clustering.controller.ServiceValueCaptorServiceConfigurator) ClusteringCacheRequirement(org.wildfly.clustering.spi.ClusteringCacheRequirement) InfinispanCacheRequirement(org.wildfly.clustering.infinispan.spi.InfinispanCacheRequirement) IdentityCacheServiceConfiguratorProvider(org.wildfly.clustering.spi.IdentityCacheServiceConfiguratorProvider) PathAddress(org.jboss.as.controller.PathAddress) Map(java.util.Map) IdentityServiceConfigurator(org.wildfly.clustering.service.IdentityServiceConfigurator)

Aggregations

Map (java.util.Map)1 Capability (org.jboss.as.clustering.controller.Capability)1 CapabilityServiceConfigurator (org.jboss.as.clustering.controller.CapabilityServiceConfigurator)1 ModulesServiceConfigurator (org.jboss.as.clustering.controller.ModulesServiceConfigurator)1 ServiceValueCaptorServiceConfigurator (org.jboss.as.clustering.controller.ServiceValueCaptorServiceConfigurator)1 BinderServiceConfigurator (org.jboss.as.clustering.naming.BinderServiceConfigurator)1 PathAddress (org.jboss.as.controller.PathAddress)1 ServiceTarget (org.jboss.msc.service.ServiceTarget)1 InfinispanCacheRequirement (org.wildfly.clustering.infinispan.spi.InfinispanCacheRequirement)1 IdentityServiceConfigurator (org.wildfly.clustering.service.IdentityServiceConfigurator)1 CapabilityServiceNameRegistry (org.wildfly.clustering.spi.CapabilityServiceNameRegistry)1 ClusteringCacheRequirement (org.wildfly.clustering.spi.ClusteringCacheRequirement)1 IdentityCacheServiceConfiguratorProvider (org.wildfly.clustering.spi.IdentityCacheServiceConfiguratorProvider)1