Search in sources :

Example 1 with BinderServiceConfigurator

use of org.jboss.as.clustering.naming.BinderServiceConfigurator in project wildfly by wildfly.

the class RemoteCacheContainerServiceHandler method installServices.

@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
    super.installServices(context, model);
    PathAddress address = context.getCurrentAddress();
    String name = context.getCurrentAddressValue();
    ServiceTarget target = context.getServiceTarget();
    Module defaultModule = Module.forClass(RemoteCacheContainer.class);
    new ModulesServiceConfigurator(RemoteCacheContainerComponent.MODULES.getServiceName(address), MODULES, Collections.singletonList(defaultModule)).configure(context, model).build(target).setInitialMode(ServiceController.Mode.PASSIVE).install();
    ServiceConfigurator containerBuilder = new RemoteCacheContainerServiceConfigurator(address).configure(context, model);
    containerBuilder.build(target).install();
    new ServiceValueCaptorServiceConfigurator<>(this.registry.add(containerBuilder.getServiceName())).build(target).install();
    new BinderServiceConfigurator(InfinispanBindingFactory.createRemoteCacheContainerBinding(name), containerBuilder.getServiceName()).build(target).install();
}
Also used : ModulesServiceConfigurator(org.jboss.as.clustering.controller.ModulesServiceConfigurator) BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget) ServiceValueCaptorServiceConfigurator(org.jboss.as.clustering.controller.ServiceValueCaptorServiceConfigurator) Module(org.jboss.modules.Module) BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) ServiceValueCaptorServiceConfigurator(org.jboss.as.clustering.controller.ServiceValueCaptorServiceConfigurator) ModulesServiceConfigurator(org.jboss.as.clustering.controller.ModulesServiceConfigurator) ServiceConfigurator(org.wildfly.clustering.service.ServiceConfigurator)

Example 2 with BinderServiceConfigurator

use of org.jboss.as.clustering.naming.BinderServiceConfigurator in project wildfly by wildfly.

the class CacheRequirementServiceConfiguratorProvider method getServiceConfigurators.

@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(ServiceNameRegistry<ClusteringCacheRequirement> registry, String containerName, String cacheName) {
    ServiceName name = registry.getServiceName(this.requirement);
    if (name == null)
        return Collections.emptySet();
    CapabilityServiceConfigurator configurator = this.factory.createServiceConfigurator(name, containerName, cacheName);
    if (this.jndiNameFactory == null) {
        return Collections.singleton(configurator);
    }
    ContextNames.BindInfo binding = ContextNames.bindInfoFor(this.jndiNameFactory.apply(containerName, cacheName).getAbsoluteName());
    CapabilityServiceConfigurator binderConfigurator = new BinderServiceConfigurator(binding, configurator.getServiceName());
    return Arrays.asList(configurator, binderConfigurator);
}
Also used : BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ServiceName(org.jboss.msc.service.ServiceName) ContextNames(org.jboss.as.naming.deployment.ContextNames)

Example 3 with BinderServiceConfigurator

use of org.jboss.as.clustering.naming.BinderServiceConfigurator in project wildfly by wildfly.

the class IdentityCacheRequirementServiceConfiguratorProvider method getServiceConfigurators.

@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(ServiceNameRegistry<ClusteringCacheRequirement> registry, String containerName, String cacheName, String targetCacheName) {
    ServiceName name = registry.getServiceName(this.requirement);
    if (name == null)
        return Collections.emptySet();
    CapabilityServiceConfigurator configurator = new IdentityCapabilityServiceConfigurator<>(name, this.requirement, containerName, targetCacheName);
    if ((this.jndiNameFactory == null) || JndiNameFactory.DEFAULT_LOCAL_NAME.equals(targetCacheName)) {
        return Collections.singleton(configurator);
    }
    ContextNames.BindInfo binding = ContextNames.bindInfoFor(this.jndiNameFactory.apply(containerName, cacheName).getAbsoluteName());
    CapabilityServiceConfigurator binderConfigurator = new BinderServiceConfigurator(binding, configurator.getServiceName());
    return Arrays.asList(configurator, binderConfigurator);
}
Also used : BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) IdentityCapabilityServiceConfigurator(org.jboss.as.clustering.controller.IdentityCapabilityServiceConfigurator) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ServiceName(org.jboss.msc.service.ServiceName) IdentityCapabilityServiceConfigurator(org.jboss.as.clustering.controller.IdentityCapabilityServiceConfigurator) ContextNames(org.jboss.as.naming.deployment.ContextNames)

Example 4 with BinderServiceConfigurator

use of org.jboss.as.clustering.naming.BinderServiceConfigurator 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)

Example 5 with BinderServiceConfigurator

use of org.jboss.as.clustering.naming.BinderServiceConfigurator 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();
        }
    }
}
Also used : ModulesServiceConfigurator(org.jboss.as.clustering.controller.ModulesServiceConfigurator) CapabilityServiceNameRegistry(org.wildfly.clustering.spi.CapabilityServiceNameRegistry) CacheServiceConfiguratorProvider(org.wildfly.clustering.spi.CacheServiceConfiguratorProvider) BinderServiceConfigurator(org.jboss.as.clustering.naming.BinderServiceConfigurator) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ServiceTarget(org.jboss.msc.service.ServiceTarget) ClusteringCacheRequirement(org.wildfly.clustering.spi.ClusteringCacheRequirement) ServiceName(org.jboss.msc.service.ServiceName) PathAddress(org.jboss.as.controller.PathAddress) IdentityServiceConfigurator(org.wildfly.clustering.service.IdentityServiceConfigurator)

Aggregations

BinderServiceConfigurator (org.jboss.as.clustering.naming.BinderServiceConfigurator)10 CapabilityServiceConfigurator (org.jboss.as.clustering.controller.CapabilityServiceConfigurator)9 PathAddress (org.jboss.as.controller.PathAddress)6 ServiceTarget (org.jboss.msc.service.ServiceTarget)6 ServiceName (org.jboss.msc.service.ServiceName)5 IdentityServiceConfigurator (org.wildfly.clustering.service.IdentityServiceConfigurator)5 CapabilityServiceNameRegistry (org.wildfly.clustering.spi.CapabilityServiceNameRegistry)5 ContextNames (org.jboss.as.naming.deployment.ContextNames)4 ModulesServiceConfigurator (org.jboss.as.clustering.controller.ModulesServiceConfigurator)3 ServiceValueCaptorServiceConfigurator (org.jboss.as.clustering.controller.ServiceValueCaptorServiceConfigurator)3 ClusteringRequirement (org.wildfly.clustering.spi.ClusteringRequirement)3 Map (java.util.Map)2 Capability (org.jboss.as.clustering.controller.Capability)2 IdentityCapabilityServiceConfigurator (org.jboss.as.clustering.controller.IdentityCapabilityServiceConfigurator)2 ClusteringCacheRequirement (org.wildfly.clustering.spi.ClusteringCacheRequirement)2 IdentityGroupServiceConfiguratorProvider (org.wildfly.clustering.spi.IdentityGroupServiceConfiguratorProvider)2 ModuleServiceConfigurator (org.jboss.as.clustering.controller.ModuleServiceConfigurator)1 ModelNode (org.jboss.dmr.ModelNode)1 Module (org.jboss.modules.Module)1 InfinispanCacheRequirement (org.wildfly.clustering.infinispan.spi.InfinispanCacheRequirement)1