use of org.wildfly.clustering.service.ServiceConfigurator 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();
}
use of org.wildfly.clustering.service.ServiceConfigurator in project wildfly by wildfly.
the class DistributableSingleSignOnManagerServiceConfigurator method configure.
@Override
public ServiceConfigurator configure(OperationContext context) {
String securityDomainName = this.configuration.getSecurityDomainName();
Supplier<String> generator = this.configuration.getIdentifierGenerator();
CapabilityServiceSupport support = context.getCapabilityServiceSupport();
SupplierDependency<DistributableSSOManagementProvider> provider = getProvider(context, securityDomainName);
ServiceName managerServiceName = this.getServiceName().append("manager");
this.manager = new ServiceSupplierDependency<>(managerServiceName);
this.provider = provider;
this.installer = new Consumer<ServiceTarget>() {
@Override
public void accept(ServiceTarget target) {
ServiceConfigurator factoryConfigurator = provider.get().getServiceConfigurator(securityDomainName).configure(support);
factoryConfigurator.build(target).install();
SupplierDependency<SSOManagerFactory<ElytronAuthentication, String, Map.Entry<String, URI>, Batch>> factoryDependency = new ServiceSupplierDependency<>(factoryConfigurator);
SupplierDependency<SessionIdGenerator> generatorDependency = new SimpleSupplierDependency<>(new SessionIdGeneratorAdapter(generator));
new SSOManagerServiceConfigurator<>(managerServiceName, factoryDependency, generatorDependency, new LocalSSOContextFactory()).configure(support).build(target).install();
}
};
return this;
}
use of org.wildfly.clustering.service.ServiceConfigurator in project wildfly by wildfly.
the class ModClusterSubsystemServiceHandler method installServices.
@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
if (!context.isBooting())
return;
Resource subsystemResource = context.readResource(PathAddress.EMPTY_ADDRESS);
if (subsystemResource.hasChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey())) {
Set<String> adapterNames = new HashSet<>();
Set<LoadMetric> enabledMetrics = new HashSet<>();
for (Resource.ResourceEntry proxyResource : subsystemResource.getChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey())) {
String proxyName = proxyResource.getName();
PathAddress proxyAddress = context.getCurrentAddress().append(ProxyConfigurationResourceDefinition.pathElement(proxyName));
adapterNames.add(proxyName);
ModelNode proxyModel = Resource.Tools.readModel(proxyResource);
ServiceTarget target = context.getServiceTarget();
ProxyConfigurationServiceConfigurator configurationBuilder = new ProxyConfigurationServiceConfigurator(proxyAddress);
configurationBuilder.configure(context, proxyModel).build(target).install();
// Construct LoadBalanceFactorProvider and call pluggable boot time metric
Set<LoadMetric> metrics = new HashSet<>();
LoadBalanceFactorProvider loadProvider = this.getLoadProvider(proxyName, metrics, context, proxyModel);
enabledMetrics.addAll(metrics);
String listenerName = LISTENER.resolveModelAttribute(context, proxyModel).asString();
int statusInterval = STATUS_INTERVAL.resolveModelAttribute(context, proxyModel).asInt();
ServiceConfigurator configurator = new ContainerEventHandlerServiceConfigurator(proxyAddress, loadProvider);
configurator.build(target).install();
new ServiceValueCaptorServiceConfigurator<>(this.registry.add(configurator.getServiceName())).build(target).install();
// Install services for web container integration
for (ContainerEventHandlerAdapterServiceConfiguratorProvider provider : ServiceLoader.load(ContainerEventHandlerAdapterServiceConfiguratorProvider.class, ContainerEventHandlerAdapterServiceConfiguratorProvider.class.getClassLoader())) {
provider.getServiceConfigurator(proxyName, listenerName, Duration.ofSeconds(statusInterval)).configure(context).build(target).setInitialMode(Mode.PASSIVE).install();
}
}
for (BoottimeHandlerProvider handler : ServiceLoader.load(BoottimeHandlerProvider.class, BoottimeHandlerProvider.class.getClassLoader())) {
handler.performBoottime(context, adapterNames, enabledMetrics);
}
}
}
use of org.wildfly.clustering.service.ServiceConfigurator 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.ServiceConfigurator in project wildfly by wildfly.
the class EJB3RemoteServiceAdd method installRuntimeServices.
void installRuntimeServices(final OperationContext context, final ModelNode model) throws OperationFailedException {
final String clientMappingsClusterName = EJB3RemoteResourceDefinition.CLIENT_MAPPINGS_CLUSTER_NAME.resolveModelAttribute(context, model).asString();
final List<ModelNode> connectorNameNodes = EJB3RemoteResourceDefinition.CONNECTORS.resolveModelAttribute(context, model).asList();
final String threadPoolName = EJB3RemoteResourceDefinition.THREAD_POOL_NAME.resolveModelAttribute(context, model).asString();
final boolean executeInWorker = EJB3RemoteResourceDefinition.EXECUTE_IN_WORKER.resolveModelAttribute(context, model).asBoolean();
final ServiceTarget target = context.getServiceTarget();
// for each connector specified, we need to set up a client-mappings cache
for (ModelNode connectorNameNode : connectorNameNodes) {
String connectorName = connectorNameNode.asString();
// Install the client-mapping service for the remoting connector
ServiceConfigurator clientMappingsEntryProviderConfigurator = new EJBRemotingConnectorClientMappingsEntryProviderService(clientMappingsClusterName, connectorName).configure(context);
clientMappingsEntryProviderConfigurator.build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
if (this.provider != null) {
// Install the registry for the remoting connector's client mappings
SupplierDependency<Map.Entry<String, List<ClientMapping>>> registryEntryDependency = new ServiceSupplierDependency<>(clientMappingsEntryProviderConfigurator.getServiceName());
for (CapabilityServiceConfigurator configurator : this.provider.getServiceConfigurators(clientMappingsClusterName, connectorName, new FunctionSupplierDependency<>(registryEntryDependency, Map.Entry::getValue))) {
configurator.configure(context).build(target).install();
}
}
}
final OptionMap channelCreationOptions = this.getChannelCreationOptions(context);
// Install the Jakarta Enterprise Beans remoting connector service which will listen for client connections on the remoting channel
// TODO: Externalize (expose via management API if needed) the version and the marshalling strategy
final EJBRemoteConnectorService ejbRemoteConnectorService = new EJBRemoteConnectorService(channelCreationOptions, FilterSpecClassResolverFilter.getFilterForOperationContext(context));
CapabilityServiceBuilder<?> builder = (CapabilityServiceBuilder<?>) context.getCapabilityServiceTarget().addCapability(EJB3RemoteResourceDefinition.EJB_REMOTE_CAPABILITY).setInstance(ejbRemoteConnectorService).addCapabilityRequirement(EJB3RemoteResourceDefinition.REMOTING_ENDPOINT_CAPABILITY_NAME, Endpoint.class, ejbRemoteConnectorService.getEndpointInjector());
if (!executeInWorker) {
builder.addCapabilityRequirement(EJB3RemoteResourceDefinition.THREAD_POOL_CAPABILITY_NAME, ExecutorService.class, ejbRemoteConnectorService.getExecutorService(), threadPoolName);
}
// add rest of the dependencies
builder.addDependency(AssociationService.SERVICE_NAME, AssociationService.class, ejbRemoteConnectorService.getAssociationServiceInjector()).addCapabilityRequirement(EJB3RemoteResourceDefinition.REMOTE_TRANSACTION_SERVICE_CAPABILITY_NAME, RemotingTransactionService.class, ejbRemoteConnectorService.getRemotingTransactionServiceInjector()).addAliases(EJBRemoteConnectorService.SERVICE_NAME).setInitialMode(ServiceController.Mode.LAZY).install();
}
Aggregations