@Override protected ServiceName getParentServiceName(PathAddress parentAddress) { return UndertowService.SERVLET_CONTAINER.append(parentAddress.getLastElement().getValue()); } }
public static void install(OperationContext context, String name, ConfigSourceProvider configSourceProvider) { ConfigSourceProviderService service = new ConfigSourceProviderService(name, configSourceProvider); ServiceBuilder<ConfigSourceProvider> serviceBuilder = context.getServiceTarget().addService(CONFIG_SOURCE_PROVIDER.append(name), service); serviceBuilder.install(); }
@Override protected void startConfigAndAddDependency(ServiceBuilder<?> dataSourceServiceBuilder, AbstractDataSourceService dataSourceService, String jndiName, ServiceTarget serviceTarget, final ModelNode operation) throws OperationFailedException { final ServiceName dataSourceCongServiceName = XADataSourceConfigService.SERVICE_NAME_BASE.append(jndiName); dataSourceServiceBuilder.addDependency(dataSourceCongServiceName, ModifiableXaDataSource.class, ((XaDataSourceService) dataSourceService).getDataSourceConfigInjector()); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final String name = address.getLastElement().getValue(); int bufferSize = BufferCacheDefinition.BUFFER_SIZE.resolveModelAttribute(context, model).asInt(); int buffersPerRegions = BufferCacheDefinition.BUFFERS_PER_REGION.resolveModelAttribute(context, model).asInt(); int maxRegions = BufferCacheDefinition.MAX_REGIONS.resolveModelAttribute(context, model).asInt(); final BufferCacheService service = new BufferCacheService(bufferSize, buffersPerRegions, maxRegions); final ServiceTarget target = context.getServiceTarget(); target.addService(BufferCacheService.SERVICE_NAME.append(name), service) .setInitialMode(ServiceController.Mode.ON_DEMAND) .install(); } }
void install() { assertState(); createDestroyServiceBuilder.install(); startStopServiceBuilder.install(); // Add service to register the mbean in the mbean server final ServiceBuilder<?> sb = target.addService(MBeanRegistrationService.SERVICE_NAME.append(mBeanName)); final Supplier<MBeanServer> mBeanServerSupplier = sb.requires(mbeanServerServiceName); final Supplier<Object> objectSupplier = sb.requires(startStopServiceName); sb.setInstance(new MBeanRegistrationService(mBeanName, setupActions, mBeanServerSupplier, objectSupplier)); sb.install(); installed = true; }
@Override public void installServices(OperationContext context, ModelNode model) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); PathAddress hostAddress = address.getParent(); PathAddress serverAddress = hostAddress.getParent(); String hostName = hostAddress.getLastElement().getValue(); String serverName = serverAddress.getLastElement().getValue(); String domain = ModelNodes.optionalString(DOMAIN.resolveModelAttribute(context, model)).orElse(null); String path = PATH.resolveModelAttribute(context, model).asString(); boolean secure = SECURE.resolveModelAttribute(context, model).asBoolean(); boolean httpOnly = HTTP_ONLY.resolveModelAttribute(context, model).asBoolean(); String cookieName = COOKIE_NAME.resolveModelAttribute(context, model).asString(); ServiceName serviceName = UndertowService.ssoServiceName(serverName, hostName); ServiceName virtualHostServiceName = HostDefinition.HOST_CAPABILITY.getCapabilityServiceName(serverName,hostName); CapabilityServiceTarget target = context.getCapabilityServiceTarget(); ServiceName managerServiceName = serviceName.append("manager"); DistributableHostSingleSignOnManagerServiceConfiguratorProvider.INSTANCE.map(provider -> provider.getServiceConfigurator(managerServiceName, serverName, hostName)) .orElse(new SimpleCapabilityServiceConfigurator<>(managerServiceName, new InMemorySingleSignOnManager())) .configure(context).build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install(); SingleSignOnService service = new SingleSignOnService(domain, path, httpOnly, secure, cookieName); target.addCapability(HostSingleSignOnDefinition.HOST_SSO_CAPABILITY, service) .addAliases(serviceName) .addDependency(virtualHostServiceName, Host.class, service.getHost()) .addDependency(managerServiceName, SingleSignOnManager.class, service.getSingleSignOnSessionManager()) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); }
@Override public SingletonServiceBuilder<?> build(ServiceTarget target) { ServiceBuilder<?> builder = target.addService(this.getServiceName().append("singleton")); return new DistributedSingletonServiceBuilder<>(this, new CompositeDependency(this.registry, this.dispatcherFactory).register(builder)); }
@Override public Lifecycle apply(ServiceTarget target) { Lifecycle primaryLifecycle = new ServiceLifecycle(target.addService(this.name.append("primary"), this.primaryService).setInitialMode(ServiceController.Mode.NEVER).install()); Lifecycle backupLifecycle = new ServiceLifecycle(target.addService(this.name.append("backup"), this.backupService).setInitialMode(ServiceController.Mode.ACTIVE).install()); return new PrimaryBackupLifecycle(primaryLifecycle, backupLifecycle); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode recoveryEnvModel) throws OperationFailedException { final String configPropertyValue = CONNECTION_PROPERTY_VALUE.resolveModelAttribute(context, recoveryEnvModel).asString(); final ModelNode address = operation.require(OP_ADDR); PathAddress path = PathAddress.pathAddress(address); final String jndiName = path.getElement(path.size() - 2).getValue(); final String configPropertyName = PathAddress.pathAddress(address).getLastElement().getValue(); ServiceName serviceName = DataSourceConfigService.SERVICE_NAME_BASE.append(jndiName).append("connection-properties").append(configPropertyName); final ServiceRegistry registry = context.getServiceRegistry(true); final ServiceName dataSourceConfigServiceName = DataSourceConfigService.SERVICE_NAME_BASE .append(jndiName); final ServiceController<?> dataSourceConfigController = registry .getService(dataSourceConfigServiceName); if (dataSourceConfigController == null || !((DataSource) dataSourceConfigController.getValue()).isEnabled()) { final ServiceTarget serviceTarget = context.getServiceTarget(); final ConnectionPropertiesService service = new ConnectionPropertiesService(configPropertyName, configPropertyValue); serviceTarget.addService(serviceName, service).setInitialMode(ServiceController.Mode.NEVER) .install(); } else { context.reloadRequired(); } }
@Override protected ServiceName getParentServiceName(PathAddress parentAddress) { return UndertowService.SERVLET_CONTAINER.append(parentAddress.getLastElement().getValue()); } }
@Override public ServiceName install(ServiceTarget serviceTarget, DeploymentUnit deploymentUnit, boolean jtsEnabled) { final ServiceName weldTransactionServiceName = deploymentUnit.getServiceName().append(WeldTransactionServices.SERVICE_NAME); final ServiceBuilder<?> sb = serviceTarget.addService(weldTransactionServiceName); final Consumer<WeldTransactionServices> weldTransactionServicesConsumer = sb.provides(weldTransactionServiceName); // Ensure the local transaction provider is started before we start sb.requires(ServiceNames.capabilityServiceName(deploymentUnit, "org.wildfly.transactions.global-default-local-provider")); sb.setInstance(new WeldTransactionServices(jtsEnabled, weldTransactionServicesConsumer)); sb.install(); return weldTransactionServiceName; }
final MailSessionService service = new MailSessionService(config); final CapabilityServiceBuilder<Session> mailSessionBuilder = serviceTarget.addCapability(SESSION_CAPABILITY.fromBaseCapability(address.getLastElement().getValue()), service); addOutboundSocketDependency(service, mailSessionBuilder, config.getImapServer()); addCredentialStoreReference(config.getImapServer(), context, fullModel, mailSessionBuilder, MailSubsystemModel.IMAP_SERVER_PATH.getKey(), MailSubsystemModel.IMAP_SERVER_PATH.getValue()); addOutboundSocketDependency(service, mailSessionBuilder, config.getPop3Server()); addCredentialStoreReference(config.getPop3Server(), context, fullModel, mailSessionBuilder, MailSubsystemModel.POP3_SERVER_PATH.getKey(), MailSubsystemModel.POP3_SERVER_PATH.getValue()); addOutboundSocketDependency(service, mailSessionBuilder, config.getSmtpServer()); addCredentialStoreReference(config.getSmtpServer(), context, fullModel, mailSessionBuilder, MailSubsystemModel.SMTP_SERVER_PATH.getKey(), MailSubsystemModel.SMTP_SERVER_PATH.getValue()); mailSessionBuilder.addAliases(MAIL_SESSION_SERVICE_NAME.append(address.getLastElement().getValue())); final ServiceBuilder<?> binderBuilder = serviceTarget .addService(bindInfo.getBinderServiceName(), binderService) .addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).addListener(new LifecycleListener() { public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { switch (event) { .install(); binderBuilder .setInitialMode(ServiceController.Mode.ACTIVE) .install();
@Override protected void startConfigAndAddDependency(ServiceBuilder<?> dataSourceServiceBuilder, AbstractDataSourceService dataSourceService, String jndiName, ServiceTarget serviceTarget, final ModelNode operation) throws OperationFailedException { final ServiceName dataSourceCongServiceName = DataSourceConfigService.SERVICE_NAME_BASE.append(jndiName); dataSourceServiceBuilder.addDependency(dataSourceCongServiceName, ModifiableDataSource.class, ((LocalDataSourceService) dataSourceService).getDataSourceConfigInjector()); }
static void install(OperationContext context, String name, ConfigSource configSource) { context.getServiceTarget() .addService(ServiceNames.CONFIG_SOURCE.append(name)) .setInstance(new ConfigSourceService(name, configSource)) .install(); }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode recoveryEnvModel) throws OperationFailedException { final String configPropertyValue = XADATASOURCE_PROPERTY_VALUE.resolveModelAttribute(context, recoveryEnvModel).asString(); final ModelNode address = operation.require(OP_ADDR); PathAddress path = PathAddress.pathAddress(address); final String dsName = path.getElement(path.size() - 2).getValue(); final String configPropertyName = PathAddress.pathAddress(address).getLastElement().getValue(); ServiceName serviceName = XADataSourceConfigService.SERVICE_NAME_BASE.append(dsName).append("xa-datasource-properties").append(configPropertyName); final ServiceRegistry registry = context.getServiceRegistry(true); final ServiceName dataSourceConfigServiceName = XADataSourceConfigService.SERVICE_NAME_BASE .append(dsName); final ServiceController<?> dataSourceConfigController = registry .getService(dataSourceConfigServiceName); if (dataSourceConfigController == null || !((XaDataSource) dataSourceConfigController.getValue()).isEnabled()) { final ServiceTarget serviceTarget = context.getServiceTarget(); final XaDataSourcePropertiesService service = new XaDataSourcePropertiesService(configPropertyName, configPropertyValue); ServiceController<?> controller = serviceTarget.addService(serviceName, service).setInitialMode(ServiceController.Mode.NEVER) .install(); } else { context.reloadRequired(); } }
@Override protected ServiceName getParentServiceName(PathAddress parentAddress) { return UndertowService.SERVLET_CONTAINER.append(parentAddress.getLastElement().getValue()); } }
private static ServiceName addWeldInterceptorBindingService(final ServiceTarget target, final ComponentConfiguration configuration, final Class<?> componentClass, final String beanName, final ServiceName weldServiceName, final ServiceName weldStartService, final String beanDeploymentArchiveId, final ComponentInterceptorSupport componentInterceptorSupport) { ServiceName bindingServiceName = configuration.getComponentDescription().getServiceName().append(WeldInterceptorBindingsService.SERVICE_NAME); final ServiceBuilder<?> sb = target.addService(bindingServiceName); final Consumer<InterceptorBindings> interceptorBindingsConsumer = sb.provides(bindingServiceName); final Supplier<WeldBootstrapService> weldContainerSupplier = sb.requires(weldServiceName); sb.requires(weldStartService); sb.setInstance(new WeldInterceptorBindingsService(interceptorBindingsConsumer, weldContainerSupplier, beanDeploymentArchiveId, beanName, componentClass, componentInterceptorSupport)); sb.install(); return bindingServiceName; }
@Override public void configureDependency(ServiceBuilder<?> serviceBuilder, Service<Component> service) throws DeploymentUnitProcessingException { final StatelessSessionComponentCreateService statelessSessionComponentService = (StatelessSessionComponentCreateService) service; final String poolName = this.statelessComponentDescription.getPoolConfigName(); // if no pool name has been explicitly set, then inject the *optional* "default slsb pool config". // If the default slsb pool config itself is not configured, then the pooling is disabled for the bean if (poolName == null) { if (statelessComponentDescription.isDefaultSlsbPoolAvailable()) { serviceBuilder.addDependency(StrictMaxPoolConfigService.DEFAULT_SLSB_POOL_CONFIG_SERVICE_NAME, PoolConfig.class, statelessSessionComponentService.getPoolConfigInjector()); } } else { // pool name has been explicitly set so the pool config is a required dependency serviceBuilder.addDependency(StrictMaxPoolConfigService.EJB_POOL_CONFIG_BASE_SERVICE_NAME.append(poolName), PoolConfig.class, statelessSessionComponentService.getPoolConfigInjector()); } } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final String name = context.getCurrentAddressValue(); final FilterService service = new FilterService(handler, getResolvedModel(context, model)); final ServiceTarget target = context.getServiceTarget(); target.addService(UndertowService.FILTER.append(name), service) .setInitialMode(ServiceController.Mode.ON_DEMAND) .install(); }
protected void performRuntime(final OperationContext context, ModelNode operation, final ModelNode model) throws OperationFailedException { final ModelNode pathNode = FileDataStoreResourceDefinition.PATH.resolveModelAttribute(context, model); final String path = pathNode.isDefined() ? pathNode.asString() : null; final ModelNode relativeToNode = FileDataStoreResourceDefinition.RELATIVE_TO.resolveModelAttribute(context, model); final String relativeTo = relativeToNode.isDefined() ? relativeToNode.asString() : null; final FileTimerPersistence fileTimerPersistence = new FileTimerPersistence(true, path, relativeTo); final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final ServiceName serviceName = TimerPersistence.SERVICE_NAME.append(address.getLastElement().getValue()); final ServiceBuilder sb = context.getServiceTarget().addService(serviceName, fileTimerPersistence); sb.addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ModuleLoader.class, fileTimerPersistence.getModuleLoader()); sb.addDependency(PathManagerService.SERVICE_NAME, PathManager.class, fileTimerPersistence.getPathManager()); sb.requires(context.getCapabilityServiceName("org.wildfly.transactions.global-default-local-provider", null)); sb.addDependency(context.getCapabilityServiceName("org.wildfly.transactions.transaction-synchronization-registry", null), TransactionSynchronizationRegistry.class, fileTimerPersistence.getTransactionSynchronizationRegistry()); sb.install(); }