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(); }
protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) throws OperationFailedException { final String defaultDataStore = TimerServiceResourceDefinition.DEFAULT_DATA_STORE.resolveModelAttribute(context, model).asString(); final String threadPoolName = TimerServiceResourceDefinition.THREAD_POOL_NAME.resolveModelAttribute(context, model).asString(); final ServiceName threadPoolServiceName = EJB3SubsystemModel.BASE_THREAD_POOL_SERVICE_NAME.append(threadPoolName); context.addStep(new AbstractDeploymentChainStep() { protected void execute(DeploymentProcessorTarget processorTarget) { ROOT_LOGGER.debug("Configuring timers"); //we only add the timer service DUP's when the timer service in enabled in XML processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_TIMEOUT_ANNOTATION, new TimerServiceAnnotationProcessor()); processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_AROUNDTIMEOUT_ANNOTATION, new AroundTimeoutAnnotationParsingProcessor()); processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_TIMER_METADATA_MERGE, new TimerMethodMergingProcessor()); processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_TIMER_SERVICE, new TimerServiceDeploymentProcessor(threadPoolServiceName, defaultDataStore)); } }, OperationContext.Stage.RUNTIME); context.getServiceTarget().addService(TimerServiceDeploymentProcessor.TIMER_SERVICE_NAME, new TimerValueService()) .install(); }
@Override protected void recreateParentService(OperationContext context, PathAddress parentAddress, ModelNode parentModel) throws OperationFailedException { this.parentFactory.createServiceConfigurator(parentAddress).configure(context, parentModel).build(context.getServiceTarget()).install(); }
protected void install(OperationContext context, ModelNode operation, final int maxSize, final String containerName, final String cacheName) { final String name = context.getCurrentAddressValue(); BeanManagerFactoryServiceConfiguratorConfiguration config = new BeanManagerFactoryServiceConfiguratorConfiguration() { @Override public String getContainerName() { return containerName; } @Override public String getCacheName() { return cacheName; } @Override public int getMaxSize() { return maxSize; } }; new DistributableCacheFactoryBuilderServiceConfigurator<>(name, config).build(context.getServiceTarget()) .setInitialMode(ServiceController.Mode.ON_DEMAND) .install(); } }
@Override public void installServices(OperationContext context, ModelNode model) throws OperationFailedException { String defaultPolicy = DEFAULT.resolveModelAttribute(context, model).asString(); ServiceTarget target = context.getServiceTarget(); ServiceName serviceName = Capability.DEFAULT_POLICY.getServiceName(context.getCurrentAddress()); ServiceName targetServiceName = SingletonServiceNameFactory.SINGLETON_POLICY.getServiceName(context, defaultPolicy); new IdentityServiceConfigurator<>(serviceName, targetServiceName).build(target).install(); // Use legacy service installation for legacy capability ServiceName legacyServiceName = Capability.DEFAULT_LEGACY_POLICY.getServiceName(context.getCurrentAddress()); new AliasServiceBuilder<>(legacyServiceName, targetServiceName, SingletonRequirement.SINGLETON_POLICY.getType()).build(target).install(); }
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final ModelNode address = operation.require(OP_ADDR); final String driverName = PathAddress.pathAddress(address).getLastElement().getValue(); if (operation.get(DRIVER_NAME.getName()).isDefined() && !driverName.equals(operation.get(DRIVER_NAME.getName()).asString())) { throw ConnectorLogger.ROOT_LOGGER.driverNameAndResourceNameNotEquals(operation.get(DRIVER_NAME.getName()).asString(), driverName); String moduleName = DRIVER_MODULE_NAME.resolveModelAttribute(context, model).asString(); final Integer majorVersion = model.hasDefined(DRIVER_MAJOR_VERSION.getName()) ? DRIVER_MAJOR_VERSION.resolveModelAttribute(context, model).asInt() : null; final Integer minorVersion = model.hasDefined(DRIVER_MINOR_VERSION.getName()) ? DRIVER_MINOR_VERSION.resolveModelAttribute(context, model).asInt() : null; final String driverClassName = model.hasDefined(DRIVER_CLASS_NAME.getName()) ? DRIVER_CLASS_NAME.resolveModelAttribute(context, model).asString() : null; final String dataSourceClassName = model.hasDefined(DRIVER_DATASOURCE_CLASS_NAME.getName()) ? DRIVER_DATASOURCE_CLASS_NAME.resolveModelAttribute(context, model).asString() : null; final String xaDataSourceClassName = model.hasDefined(DRIVER_XA_DATASOURCE_CLASS_NAME.getName()) ? DRIVER_XA_DATASOURCE_CLASS_NAME.resolveModelAttribute(context, model).asString() : null; final ServiceTarget target = context.getServiceTarget();
@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(); }
static void install(OperationContext context, String name, ConfigSource configSource) { context.getServiceTarget() .addService(ServiceNames.CONFIG_SOURCE.append(name)) .setInstance(new ConfigSourceService(name, configSource)) .install(); }
@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(); new ModuleServiceConfigurator(RemoteCacheContainerComponent.MODULE.getServiceName(address), MODULE).configure(context, model).build(target).setInitialMode(ServiceController.Mode.PASSIVE).install(); ServiceConfigurator containerBuilder = new RemoteCacheContainerServiceConfigurator(address).configure(context, model); containerBuilder.build(target).install(); new BinderServiceConfigurator(InfinispanBindingFactory.createRemoteCacheContainerBinding(name), containerBuilder.getServiceName()).build(target).install(); }
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(); } } }
@Override protected void recreateParentService(OperationContext context, PathAddress parentAddress, ModelNode parentModel) throws OperationFailedException { this.parentFactory.createServiceConfigurator(parentAddress).configure(context, parentModel).build(context.getServiceTarget()).install(); }
void installRuntimeServices(final OperationContext context) throws OperationFailedException { final RemoteNamingServerService remoteNamingServerService = new RemoteNamingServerService(); final ServiceBuilder<RemoteNamingService> builder = context.getServiceTarget().addService(RemoteNamingServerService.SERVICE_NAME, remoteNamingServerService); builder.addDependency(RemotingServices.SUBSYSTEM_ENDPOINT, Endpoint.class, remoteNamingServerService.getEndpointInjector()) .addDependency(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, NamingStore.class, remoteNamingServerService.getNamingStoreInjector()) .install(); }
static void install(OperationContext context) { context.getServiceTarget().addService(ServiceNames.CONFIG_PROVIDER) .setInstance(new ConfigProviderService()) .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 public void installServices(OperationContext context, ModelNode model) throws OperationFailedException { this.factory.createServiceConfigurator(context.getCurrentAddress()).configure(context, model).build(context.getServiceTarget()).install(); }
@Override protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { Map<String, Object> vaultOptions = new HashMap<String, Object>(); ModelNode vaultClassNode = CODE.resolveModelAttribute(context, model); String vaultClass = vaultClassNode.getType() == ModelType.UNDEFINED ? null : vaultClassNode.asString(); if (operation.hasDefined(Constants.VAULT_OPTIONS)) { for (Map.Entry<String,String> vaultOption : OPTIONS.unwrap(context,model).entrySet()) { vaultOptions.put(vaultOption.getKey(), vaultOption.getValue()); } } // add security vault service if (vaultClass != null || !vaultOptions.isEmpty()) { final SecurityVaultService vaultService = new SecurityVaultService(vaultClass, vaultOptions); context.getServiceTarget() .addService(SecurityVaultService.SERVICE_NAME, vaultService) .setInitialMode(ServiceController.Mode.ACTIVE).install(); } } }
static void install(OperationContext context, String name, String path, String relativeTo, int ordinal) { ServiceBuilder<?> builder = context.getServiceTarget() .addService(ServiceNames.CONFIG_SOURCE.append(name)); Supplier<PathManager> pathManager = builder.requires(context.getCapabilityServiceName("org.wildfly.management.path-manager", PathManager.class)); builder.setInstance(new DirConfigSourceService(name, path, relativeTo, ordinal, pathManager)) .install(); }
@Override public void installServices(OperationContext context, ModelNode model) throws OperationFailedException { super.installServices(context, model); String name = context.getCurrentAddressValue(); new BinderServiceConfigurator(JGroupsBindingFactory.createChannelFactoryBinding(name), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, name)).build(context.getServiceTarget()).install(); }
@Override protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { final boolean enabled = TracerDefinition.TracerParameters.TRACER_ENABLED.getAttribute().resolveModelAttribute(context, model).asBoolean(); ServiceName serviceName = ConnectorServices.TRACER_CONFIG_SERVICE; ServiceName jcaConfigServiceName = ConnectorServices.CONNECTOR_CONFIG_SERVICE; final ServiceTarget serviceTarget = context.getServiceTarget(); final TracerService.Tracer config = new TracerService.Tracer(enabled); final TracerService service = new TracerService(config); serviceTarget.addService(serviceName, service).setInitialMode(ServiceController.Mode.ACTIVE) .addDependency(jcaConfigServiceName, JcaSubsystemConfiguration.class, service.getJcaConfigInjector()) .install(); } }
@Override protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); final String name = context.getCurrentAddressValue(); context.getServiceTarget().addService(context.getCapabilityServiceName(Capabilities.JOB_REPOSITORY_CAPABILITY.getName(), name, JobRepository.class), new InMemoryJobRepositoryService()).install(); } }