use of org.wildfly.clustering.service.ServiceSupplierDependency in project wildfly by wildfly.
the class SingleSignOnSessionFactoryServiceConfigurator method configure.
@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
String keyStore = KEY_STORE.resolveModelAttribute(context, model).asString();
this.keyStore = new ServiceSupplierDependency<>(CommonUnaryRequirement.KEY_STORE.getServiceName(context, keyStore));
this.keyAlias = KEY_ALIAS.resolveModelAttribute(context, model).asString();
this.credentialSource = new CredentialSourceDependency(context, CREDENTIAL, model);
String sslContext = SSL_CONTEXT.resolveModelAttribute(context, model).asStringOrNull();
this.sslContext = (sslContext != null) ? new ServiceSupplierDependency<>(CommonUnaryRequirement.SSL_CONTEXT.getServiceName(context, sslContext)) : null;
return this;
}
use of org.wildfly.clustering.service.ServiceSupplierDependency 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();
}
use of org.wildfly.clustering.service.ServiceSupplierDependency in project wildfly by wildfly.
the class TransportConfigurationServiceConfigurator method configure.
@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
this.socketBinding = new ServiceSupplierDependency<>(CommonUnaryRequirement.SOCKET_BINDING.getServiceName(context, SOCKET_BINDING.resolveModelAttribute(context, model).asString()));
String diagnosticsSocketBinding = DIAGNOSTICS_SOCKET_BINDING.resolveModelAttribute(context, model).asStringOrNull();
this.diagnosticsSocketBinding = (diagnosticsSocketBinding != null) ? new ServiceSupplierDependency<>(CommonUnaryRequirement.SOCKET_BINDING.getServiceName(context, diagnosticsSocketBinding)) : new SimpleSupplierDependency<>(null);
ModelNode machine = MACHINE.resolveModelAttribute(context, model);
ModelNode rack = RACK.resolveModelAttribute(context, model);
ModelNode site = SITE.resolveModelAttribute(context, model);
if (site.isDefined() || rack.isDefined() || machine.isDefined()) {
this.topology = new Topology() {
@Override
public String getMachine() {
return machine.asStringOrNull();
}
@Override
public String getRack() {
return rack.asStringOrNull();
}
@Override
public String getSite() {
return site.asStringOrNull();
}
};
}
return super.configure(context, model);
}
use of org.wildfly.clustering.service.ServiceSupplierDependency in project wildfly by wildfly.
the class JChannelFactoryServiceConfigurator method configure.
@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
this.statisticsEnabled = StackResourceDefinition.Attribute.STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean();
Resource resource = context.readResourceFromRoot(this.address, false);
Iterator<Resource.ResourceEntry> transports = resource.getChildren(TransportResourceDefinition.WILDCARD_PATH.getKey()).iterator();
if (!transports.hasNext()) {
throw JGroupsLogger.ROOT_LOGGER.transportNotDefined(this.getName());
}
this.transport = new ServiceSupplierDependency<>(new SingletonProtocolServiceNameProvider(this.address, transports.next().getPathElement()));
Set<Resource.ResourceEntry> entries = resource.getChildren(ProtocolResourceDefinition.WILDCARD_PATH.getKey());
this.protocols = new ArrayList<>(entries.size());
for (Resource.ResourceEntry entry : entries) {
this.protocols.add(new ServiceSupplierDependency<>(new ProtocolServiceNameProvider(this.address, entry.getPathElement())));
}
this.relay = resource.hasChild(RelayResourceDefinition.PATH) ? new ServiceSupplierDependency<>(new SingletonProtocolServiceNameProvider(this.address, RelayResourceDefinition.PATH)) : null;
this.socketBindingManager = new ServiceSupplierDependency<>(CommonRequirement.SOCKET_BINDING_MANAGER.getServiceName(context));
return this;
}
use of org.wildfly.clustering.service.ServiceSupplierDependency in project wildfly by wildfly.
the class UndertowDistributableServerRuntimeHandler method execute.
@Override
public void execute(OperationContext context, String serverName) {
SupplierDependency<RoutingProvider> provider = getRoutingProvider(context, serverName);
if (provider != null) {
ServiceTarget target = context.getServiceTarget();
CapabilityServiceSupport support = context.getCapabilityServiceSupport();
SupplierDependency<Server> server = new ServiceSupplierDependency<>(UndertowUnaryRequirement.SERVER.getServiceName(context, serverName));
SupplierDependency<String> route = new FunctionSupplierDependency<>(server, Server::getRoute);
Consumer<ServiceTarget> installer = new Consumer<ServiceTarget>() {
@Override
public void accept(ServiceTarget target) {
for (CapabilityServiceConfigurator configurator : provider.get().getServiceConfigurators(serverName, route)) {
configurator.configure(support).build(target).install();
}
}
};
ServiceName name = ServiceName.JBOSS.append("clustering", "web", "undertow", "routing", serverName);
provider.register(target.addService(name)).setInstance(new ChildTargetService(installer)).install();
}
}
Aggregations