public static ServiceController<JdrReportCollector> addService(final ServiceTarget target) { JdrReportService service = new JdrReportService(); return target.addService(SERVICE_NAME, service) .addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.serverEnvironmentValue) .addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.modelControllerValue) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); }
public static ServiceController<TransactionManager> addService(final ServiceTarget target) { final TransactionManagerService service = new TransactionManagerService(); ServiceBuilder<TransactionManager> serviceBuilder = target.addService(INTERNAL_SERVICE_NAME, service); // This is really a dependency on the global context. TODO: Break this later; no service is needed for TM really serviceBuilder.requires(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT); serviceBuilder.addDependency(UserTransactionRegistryService.SERVICE_NAME, UserTransactionRegistry.class, service.registryInjector); return serviceBuilder.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 Lifecycle apply(ServiceTarget target) { ServiceBuilder<?> builder = target.addService(this.name); for (Map.Entry<ServiceName[], DeferredInjector<?>> entry : this.injectors) { entry.getValue().setConsumer(builder.provides(entry.getKey())); } return new ServiceLifecycle(builder.setInstance(this.service).setInitialMode(ServiceController.Mode.NEVER).install()); } }
private void performObjectStoreBoottime(OperationContext context, ModelNode model) throws OperationFailedException { boolean useJournalStore = model.hasDefined(USE_JOURNAL_STORE) && model.get(USE_JOURNAL_STORE).asBoolean(); final boolean enableAsyncIO = TransactionSubsystemRootResourceDefinition.JOURNAL_STORE_ENABLE_ASYNC_IO.resolveModelAttribute(context, model).asBoolean(); final String objectStorePathRef = TransactionSubsystemRootResourceDefinition.OBJECT_STORE_RELATIVE_TO.resolveModelAttribute(context, model).isDefined() ? TransactionSubsystemRootResourceDefinition.OBJECT_STORE_RELATIVE_TO.resolveModelAttribute(context, model).asString(): null; final String objectStorePath = TransactionSubsystemRootResourceDefinition.OBJECT_STORE_PATH.resolveModelAttribute(context, model).asString(); final boolean useJdbcStore = model.hasDefined(USE_JDBC_STORE) && model.get(USE_JDBC_STORE).asBoolean(); builder.addDependency(PathManagerService.SERVICE_NAME, PathManager.class, objStoreEnvironmentService.getPathManagerInjector()); builder.requires(TxnServices.JBOSS_TXN_CORE_ENVIRONMENT); if (useJdbcStore) { builder.requires(bindInfo.getBinderServiceName()); builder.setInitialMode(ServiceController.Mode.ACTIVE).install(); .setInitialMode(ServiceController.Mode.ACTIVE).install(); TransactionSynchronizationRegistryService.addService(target);
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 { 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(); }
public static ServiceController<TransactionSynchronizationRegistry> addService(final CapabilityServiceTarget target) { TransactionSynchronizationRegistryService service = new TransactionSynchronizationRegistryService(); ServiceBuilder<TransactionSynchronizationRegistry> serviceBuilder = target.addCapability(TRANSACTION_SYNCHRONIZATION_REGISTRY_CAPABILITY, service); serviceBuilder.requires(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT); serviceBuilder.addDependency(ArjunaTransactionManagerService.SERVICE_NAME, com.arjuna.ats.jbossatx.jta.TransactionManagerService.class, service.injectedArjunaTM); serviceBuilder.addAliases(INTERNAL_SERVICE_NAME); return serviceBuilder.install(); }
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 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; }
@Override public ServiceBuilder<?> build(ServiceTarget target) { this.configurationConfigurator.build(target).install(); this.cacheConfigurator.build(target).install(); ServiceBuilder<?> builder = target.addService(this.getServiceName()); Consumer<SessionManagerFactory<L, TransactionBatch>> factory = new CompositeDependency(this.group, this.affinityFactory, this.dispatcherFactory).register(builder).provides(this.getServiceName()); this.cache = builder.requires(this.cacheConfigurator.getServiceName()); Service service = new FunctionalService<>(factory, Function.identity(), this, Consumers.close()); return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND); }
private void setupPolicyRegistration(final StartContext context) { ServiceTarget target = context.getChildTarget(); final BinderService binderService = new BinderService(POLICY_REGISTRATION); binderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory( Values.immediateValue(new JBossPolicyRegistration()))); target.addService(ContextNames.buildServiceName(ContextNames.JAVA_CONTEXT_SERVICE_NAME, POLICY_REGISTRATION), binderService) .addDependency(ContextNames.JAVA_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()) .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(); } }
@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); } }
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 ServiceBuilder<?> build(ServiceTarget target) { this.configurationConfigurator.build(target).install(); this.cacheConfigurator.build(target).install(); ServiceBuilder<?> builder = target.addService(this.getServiceName()); Consumer<SSOManagerFactory<A, D, S, TransactionBatch>> factory = this.affinityFactory.register(builder).provides(this.getServiceName()); this.cache = builder.requires(this.cacheConfigurator.getServiceName()); Service service = Service.newInstance(factory, new InfinispanSSOManagerFactory<>(this)); return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND); }
private void bindValueToJndi(final StartContext context) { final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(jndiName); final BinderService binderService = new BinderService(bindInfo.getBindName()); binderService.getManagedObjectInjector().inject(new ImmediateManagedReferenceFactory(getValue())); context.getChildTarget().addService(bindInfo.getBinderServiceName(),binderService) .addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()) .install(); }
static void install(OperationContext context, String name, ConfigSource configSource) { context.getServiceTarget() .addService(ServiceNames.CONFIG_SOURCE.append(name)) .setInstance(new ConfigSourceService(name, configSource)) .install(); }
public static void install(final DeploymentUnit deploymentUnit, final ServiceTarget serviceTarget) { final ServiceName sn = serviceName(deploymentUnit); final ServiceBuilder<?> sb = serviceTarget.addService(sn); final Consumer<EEClassIntrospector> eeClassIntrospectorConsumer = sb.provides(sn); final Supplier<BeanManager> beanManagerSupplier = sb.requires(BeanManagerService.serviceName(deploymentUnit)); sb.requires(Utils.getRootDeploymentUnit(deploymentUnit).getServiceName().append(WeldStartService.SERVICE_NAME)); sb.setInstance(new WeldClassIntrospector(eeClassIntrospectorConsumer, beanManagerSupplier)); sb.install(); }
protected void describeBean(final Module module, final ServiceTarget serviceTarget, DeploymentReflectionIndex deploymentIndex, BeanMetaDataConfig beanConfig) { final BeanState state = BeanState.NOT_INSTALLED; final ServiceName describedServiceName = BeanMetaDataConfig.toBeanName(beanConfig.getName(), state.next()); final DescribedPojoPhase describedService = new DescribedPojoPhase(deploymentIndex, beanConfig); final ServiceBuilder describedServiceBuilder = serviceTarget.addService(describedServiceName, describedService); describedService.registerAliases(describedServiceBuilder); final ConfigVisitor visitor = new DefaultConfigVisitor(describedServiceBuilder, state, module, deploymentIndex); beanConfig.visit(visitor); describedServiceBuilder.setInitialMode(beanConfig.getMode().getMode()); describedServiceBuilder.install(); } }