@Override public ServiceConfigurator configure(OperationContext context) { this.enabled = context.hasOptionalCapability(CommonRequirement.NAMING_STORE.getName(), null, null); return this; }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode strictMaxPoolModel) throws OperationFailedException { final String poolName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).getLastElement().getValue(); final int maxPoolSize = StrictMaxPoolResourceDefinition.MAX_POOL_SIZE.resolveModelAttribute(context, strictMaxPoolModel).asInt(); final Derive derive = StrictMaxPoolResourceDefinition.parseDeriveSize(context, strictMaxPoolModel); final long timeout = StrictMaxPoolResourceDefinition.INSTANCE_ACQUISITION_TIMEOUT.resolveModelAttribute(context, strictMaxPoolModel).asLong(); final String unit = StrictMaxPoolResourceDefinition.INSTANCE_ACQUISITION_TIMEOUT_UNIT.resolveModelAttribute(context, strictMaxPoolModel).asString(); // create and install the service final StrictMaxPoolConfigService poolConfigService = new StrictMaxPoolConfigService(poolName, maxPoolSize, derive, timeout, TimeUnit.valueOf(unit)); final ServiceName serviceName = StrictMaxPoolConfigService.EJB_POOL_CONFIG_BASE_SERVICE_NAME.append(poolName); ServiceBuilder<StrictMaxPoolConfig> svcBuilder = context.getServiceTarget().addService(serviceName, poolConfigService); if (context.hasOptionalCapability(IO_MAX_THREADS_RUNTIME_CAPABILITY_NAME, null, null)) { ServiceName name = context.getCapabilityServiceName(IO_MAX_THREADS_RUNTIME_CAPABILITY_NAME, Integer.class); svcBuilder.addDependency(name, Integer.class, poolConfigService.getMaxThreadsInjector()); } svcBuilder.install(); }
@Override public void installServices(OperationContext context, ModelNode model) throws OperationFailedException { InfinispanLogger.ROOT_LOGGER.activatingSubsystem(); PathAddress address = context.getCurrentAddress(); ServiceTarget target = context.getServiceTarget(); // Install local group services ServiceNameRegistry<ClusteringRequirement> localRegistry = new CapabilityServiceNameRegistry<>(LOCAL_CLUSTERING_CAPABILITIES, address); for (GroupServiceConfiguratorProvider provider : ServiceLoader.load(LocalGroupServiceConfiguratorProvider.class, LocalGroupServiceConfiguratorProvider.class.getClassLoader())) { InfinispanLogger.ROOT_LOGGER.debugf("Installing %s for %s group", provider.getClass().getSimpleName(), LocalGroupServiceConfiguratorProvider.LOCAL); for (CapabilityServiceConfigurator configurator : provider.getServiceConfigurators(localRegistry, LocalGroupServiceConfiguratorProvider.LOCAL)) { configurator.configure(context).build(target).install(); } } // If JGroups subsystem is not available, install default group aliases to local group. if (!context.hasOptionalCapability(JGroupsRequirement.CHANNEL.getDefaultRequirement().getName(), null, null)) { 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, LocalGroupServiceConfiguratorProvider.LOCAL)) { configurator.configure(context).build(target).install(); } } } }
@Override public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); ServiceNameRegistry<ClusteringRequirement> localRegistry = new CapabilityServiceNameRegistry<>(LOCAL_CLUSTERING_CAPABILITIES, address); for (GroupServiceConfiguratorProvider provider : ServiceLoader.load(LocalGroupServiceConfiguratorProvider.class, LocalGroupServiceConfiguratorProvider.class.getClassLoader())) { for (ServiceNameProvider configurator : provider.getServiceConfigurators(localRegistry, LocalGroupServiceConfiguratorProvider.LOCAL)) { context.removeService(configurator.getServiceName()); } } if (!context.hasOptionalCapability(JGroupsRequirement.CHANNEL.getDefaultRequirement().getName(), null, null)) { 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, LocalGroupServiceConfiguratorProvider.LOCAL)) { context.removeService(configurator.getServiceName()); } } } } }
private static void addClusteringServices(final OperationContext context, final boolean appclient) { ServiceTarget target = context.getServiceTarget(); if (appclient) { return; } if (context.hasOptionalCapability(SingletonDefaultRequirement.POLICY.getName(), CLUSTERED_SINGLETON_CAPABILITY.getName(), null)) { ServiceBuilder<?> builder = target.addService(SingletonBarrierService.SERVICE_NAME); Supplier<SingletonPolicy> policy = builder.requires(context.getCapabilityServiceName(SingletonDefaultRequirement.POLICY.getName(), SingletonDefaultRequirement.POLICY.getType())); builder.setInstance(new SingletonBarrierService(policy)).setInitialMode(ServiceController.Mode.ON_DEMAND).install(); } } }
if(context.hasOptionalCapability(REMOTING_ENDPOINT_CAPABILITY, EJB3SubsystemRootResourceDefinition.EJB_CLIENT_CONFIGURATOR.getName(), null)) { ServiceName serviceName = context.getCapabilityServiceName(REMOTING_ENDPOINT_CAPABILITY, Endpoint.class); configuratorBuilder.addDependency(serviceName, Endpoint.class, clientConfiguratorService.getEndpointInjector());
if(context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, NamingService.CAPABILITY_NAME, null)) { HttpRemoteNamingServerService httpRemoteNamingServerService = new HttpRemoteNamingServerService(); context.getServiceTarget().addService(HttpRemoteNamingServerService.SERVICE_NAME, httpRemoteNamingServerService)
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.cluster = new ServiceSupplierDependency<>(JGroupsRequirement.CHANNEL_CLUSTER.getServiceName(context, this.name)); this.factory = new ServiceSupplierDependency<>(JGroupsRequirement.CHANNEL_SOURCE.getServiceName(context, this.name)); this.server = context.hasOptionalCapability(CommonRequirement.MBEAN_SERVER.getName(), null, null) ? new ServiceSupplierDependency<>(CommonRequirement.MBEAN_SERVER.getServiceName(context)) : null; return this; }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.server = context.hasOptionalCapability(CommonRequirement.MBEAN_SERVER.getName(), null, null) ? new ServiceSupplierDependency<>(CommonRequirement.MBEAN_SERVER.getServiceName(context)) : null; this.defaultCache = DEFAULT_CACHE.resolveModelAttribute(context, model).asStringOrNull(); this.statisticsEnabled = STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean(); return this; }
String templateCacheName = null; if (!context.hasOptionalCapability(defaultCacheRequirementName, capabilityName, cacheTypeAttributeName) && context.hasOptionalCapability(legacyCacheRequirementName, capabilityName, cacheTypeAttributeName)) { SecurityLogger.ROOT_LOGGER.defaultCacheRequirementMissing(CACHE_CONTAINER_NAME, LEGACY_CACHE_NAME); templateCacheName = LEGACY_CACHE_NAME;
if(context.hasOptionalCapability("org.wildfly.transactions", SECURITY_SUBSYSTEM.getName(), null)) { TransactionManagerLocatorService service = new TransactionManagerLocatorService(); target.addService(TransactionManagerLocatorService.SERVICE_NAME, service)
.install(); if (context.hasOptionalCapability(REMOTING_ENDPOINT_CAPABILITY_NAME, TransactionSubsystemRootResourceDefinition.TRANSACTION_CAPABILITY.getName(),null)) { final RemotingTransactionServiceService remoteTransactionServiceService = new RemotingTransactionServiceService(); serviceTarget.addService(TxnServices.JBOSS_TXN_REMOTE_TRANSACTION_SERVICE, remoteTransactionServiceService) if(context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, TransactionSubsystemRootResourceDefinition.TRANSACTION_CAPABILITY.getName(), null)) { final TransactionRemoteHTTPService remoteHTTPService = new TransactionRemoteHTTPService(); serviceTarget.addService(TxnServices.JBOSS_TXN_HTTP_REMOTE_TRANSACTION_SERVICE, remoteHTTPService)
private ServiceController<WebHost> addCommonHost(OperationContext context, List<String> aliases, String serverName, ServiceName virtualHostServiceName) { WebHostService service = new WebHostService(); final CapabilityServiceBuilder<WebHost> builder = context.getCapabilityServiceTarget() .addCapability(WebHost.CAPABILITY, service) .addCapabilityRequirement(Capabilities.CAPABILITY_SERVER, Server.class, service.getServer(), serverName) .addCapabilityRequirement(CommonWebServer.CAPABILITY_NAME, CommonWebServer.class) .addDependency(virtualHostServiceName, Host.class, service.getHost()); if(context.hasOptionalCapability(Capabilities.REF_REQUEST_CONTROLLER, null, null)) { builder.addCapabilityRequirement(Capabilities.REF_REQUEST_CONTROLLER, RequestController.class, service.getRequestControllerInjectedValue()); } builder.addAliases(WebHost.SERVICE_NAME.append(context.getCurrentAddressValue())); if (aliases != null) { for (String alias : aliases) { builder.addAliases(WebHost.SERVICE_NAME.append(alias)); } } builder.setInitialMode(Mode.PASSIVE); return builder.install(); } }
@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.MODULE.getServiceName(cacheAddress); if (model.hasDefined(MODULE.getName())) { new ModuleServiceConfigurator(moduleServiceName, MODULE).configure(context, model).build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install(); } else { new IdentityServiceConfigurator<>(moduleServiceName, CacheContainerComponent.MODULE.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(); } } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final String name = context.getCurrentAddressValue(); final HandlerService service = new HandlerService(handler.createHandler(context, model), name); CapabilityServiceBuilder<HttpHandler> builder = context.getCapabilityServiceTarget().addCapability(Handler.CAPABILITY, service) .setInitialMode(ServiceController.Mode.ON_DEMAND); final RuntimeCapability newCapability = Handler.CAPABILITY.fromBaseCapability(context.getCurrentAddress()); if (context.hasOptionalCapability(Capabilities.REF_REQUEST_CONTROLLER, newCapability.getName(), null)) { builder.addCapabilityRequirement(Capabilities.REF_REQUEST_CONTROLLER, RequestController.class, service.getRequestControllerInjectedValue()); } builder.install(); } }
if(context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, EJB3SubsystemRootResourceDefinition.EJB_CAPABILITY.getName(), null)) { EJB3RemoteHTTPService service = new EJB3RemoteHTTPService();
protected void execute(DeploymentProcessorTarget processorTarget) { processorTarget.addDeploymentProcessor(JSFExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_JSF_VERSION, new JSFVersionProcessor(defaultJSFSlot)); processorTarget.addDeploymentProcessor(JSFExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_JSF_SHARED_TLDS, new JSFSharedTldsProcessor()); processorTarget.addDeploymentProcessor(JSFExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_JSF_METADATA, new JSFMetadataProcessor(disallowDoctypeDecl)); processorTarget.addDeploymentProcessor(JSFExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_JSF, new JSFDependencyProcessor()); processorTarget.addDeploymentProcessor(JSFExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JSF_MANAGED_BEANS, new JSFComponentProcessor()); processorTarget.addDeploymentProcessor(JSFExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JSF_CDI_EXTENSIONS, new JSFCdiExtensionDeploymentProcessor()); processorTarget.addDeploymentProcessor(JSFExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_JSF_ANNOTATIONS, new JSFAnnotationProcessor()); if (context.hasOptionalCapability("org.wildfly.bean-validation", null, null)) { processorTarget.addDeploymentProcessor(JSFExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_JSF_VALIDATOR_FACTORY, new JSFBeanValidationFactoryProcessor()); } } }, OperationContext.Stage.RUNTIME);
@Override public ServiceConfigurator configure(OperationContext context) { this.enabled = context.hasOptionalCapability(CommonRequirement.NAMING_STORE.getName(), null, null); return this; }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.server = context.hasOptionalCapability(CommonRequirement.MBEAN_SERVER.getName(), null, null) ? new ServiceSupplierDependency<>(CommonRequirement.MBEAN_SERVER.getServiceName(context)) : null; this.defaultCache = DEFAULT_CACHE.resolveModelAttribute(context, model).asStringOrNull(); this.statisticsEnabled = STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean(); return this; }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.cluster = new ServiceSupplierDependency<>(JGroupsRequirement.CHANNEL_CLUSTER.getServiceName(context, this.name)); this.factory = new ServiceSupplierDependency<>(JGroupsRequirement.CHANNEL_SOURCE.getServiceName(context, this.name)); this.server = context.hasOptionalCapability(CommonRequirement.MBEAN_SERVER.getName(), null, null) ? new ServiceSupplierDependency<>(CommonRequirement.MBEAN_SERVER.getServiceName(context)) : null; return this; }