use of org.wildfly.clustering.service.IdentityServiceConfigurator 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();
}
}
}
}
use of org.wildfly.clustering.service.IdentityServiceConfigurator in project wildfly by wildfly.
the class EJB3SubsystemDefaultCacheWriteHandler method updateCacheService.
void updateCacheService(final OperationContext context, final ModelNode model) throws OperationFailedException {
ModelNode cacheName = this.attribute.resolveModelAttribute(context, model);
ServiceRegistry registry = context.getServiceRegistry(true);
if (registry.getService(this.serviceName) != null) {
context.removeService(this.serviceName);
}
if (cacheName.isDefined()) {
new IdentityServiceConfigurator<>(this.serviceName, new CacheFactoryBuilderServiceNameProvider(cacheName.asString()).getServiceName()).build(context.getServiceTarget()).install();
}
}
use of org.wildfly.clustering.service.IdentityServiceConfigurator in project wildfly by wildfly.
the class CacheFactoryAdd method performRuntime.
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
final String name = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).getLastElement().getValue();
ModelNode passivationStoreModel = CacheFactoryResourceDefinition.PASSIVATION_STORE.resolveModelAttribute(context, model);
String passivationStore = passivationStoreModel.isDefined() ? passivationStoreModel.asString() : null;
final Collection<String> unwrappedAliasValues = CacheFactoryResourceDefinition.ALIASES.unwrap(context, model);
final Set<String> aliases = unwrappedAliasValues != null ? new HashSet<>(unwrappedAliasValues) : Collections.<String>emptySet();
ServiceTarget target = context.getServiceTarget();
// set up the CacheFactoryBuilder service
ServiceConfigurator configurator = (passivationStore != null) ? new IdentityServiceConfigurator<>(new CacheFactoryBuilderServiceNameProvider(name).getServiceName(), new DistributableCacheFactoryBuilderServiceNameProvider(passivationStore).getServiceName()) : new SimpleCacheFactoryBuilderServiceConfigurator<>(name);
ServiceBuilder<?> builder = configurator.build(target);
// set up aliases to the CacheFactoryBuilder service
for (String alias : aliases) {
new IdentityServiceConfigurator<>(new CacheFactoryBuilderServiceNameProvider(alias).getServiceName(), configurator.getServiceName()).build(target).install();
}
builder.install();
}
use of org.wildfly.clustering.service.IdentityServiceConfigurator 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.service.IdentityServiceConfigurator in project wildfly by wildfly.
the class JGroupsSubsystemServiceHandler method installServices.
@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
ROOT_LOGGER.activatingSubsystem(Version.printVersion());
ServiceTarget target = context.getServiceTarget();
PathAddress address = context.getCurrentAddress();
// In this case, the Infinispan subsystem may have already registered default group capabilities
if (context.getProcessType().isServer() && !context.isBooting()) {
if (context.readResourceFromRoot(address.getParent(), false).hasChild(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "infinispan"))) {
// Following restart, default group services will be installed by this handler, rather than the infinispan subsystem handler
context.addStep((ctx, operation) -> {
ctx.reloadRequired();
ctx.completeStep(OperationContext.RollbackHandler.REVERT_RELOAD_REQUIRED_ROLLBACK_HANDLER);
}, OperationContext.Stage.RUNTIME);
return;
}
}
new ProtocolDefaultsServiceConfigurator().build(target).install();
String defaultChannel = DEFAULT_CHANNEL.resolveModelAttribute(context, model).asStringOrNull();
if (defaultChannel != null) {
for (Map.Entry<JGroupsRequirement, Capability> entry : CAPABILITIES.entrySet()) {
new IdentityServiceConfigurator<>(entry.getValue().getServiceName(address), entry.getKey().getServiceName(context, defaultChannel)).build(target).install();
}
if (!defaultChannel.equals(JndiNameFactory.DEFAULT_LOCAL_NAME)) {
new BinderServiceConfigurator(JGroupsBindingFactory.createChannelBinding(JndiNameFactory.DEFAULT_LOCAL_NAME), JGroupsRequirement.CHANNEL.getServiceName(context, defaultChannel)).build(target).install();
new BinderServiceConfigurator(JGroupsBindingFactory.createChannelFactoryBinding(JndiNameFactory.DEFAULT_LOCAL_NAME), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, defaultChannel)).build(target).install();
}
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, defaultChannel)) {
configurator.configure(context).build(target).install();
}
}
}
}
Aggregations