Search in sources :

Example 1 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class InfinispanBeanManagerFactoryBuilder method build.

@Override
public ServiceBuilder<BeanManagerFactory<I, T, TransactionBatch>> build(ServiceTarget target) {
    String containerName = this.configuration.getContainerName();
    ServiceName deploymentUnitServiceName = this.context.getDeploymentUnitServiceName();
    return target.addService(this.getServiceName(), new ValueService<>(this)).addDependency(InfinispanCacheRequirement.CACHE.getServiceName(this.support, containerName, InfinispanBeanManagerFactoryBuilderFactory.getCacheName(deploymentUnitServiceName)), Cache.class, this.cache).addDependency(InfinispanRequirement.KEY_AFFINITY_FACTORY.getServiceName(this.support, containerName), KeyAffinityServiceFactory.class, this.affinityFactory).addDependency(deploymentUnitServiceName.append("marshalling"), MarshallingConfigurationRepository.class, this.repository).addDependency(deploymentUnitServiceName.append(this.name, "expiration"), ScheduledExecutorService.class, this.scheduler).addDependency(deploymentUnitServiceName.append(this.name, "eviction"), Executor.class, this.executor).addDependency(ClusteringRequirement.COMMAND_DISPATCHER_FACTORY.getServiceName(this.support, containerName), CommandDispatcherFactory.class, this.dispatcherFactory).addDependency(ClusteringCacheRequirement.REGISTRY.getServiceName(this.support, containerName, BeanManagerFactoryBuilderConfiguration.CLIENT_MAPPINGS_CACHE_NAME), Registry.class, this.registry).addDependency(ClusteringCacheRequirement.NODE_FACTORY.getServiceName(this.support, containerName, BeanManagerFactoryBuilderConfiguration.CLIENT_MAPPINGS_CACHE_NAME), NodeFactory.class, this.nodeFactory).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) NodeFactory(org.wildfly.clustering.group.NodeFactory) ServiceName(org.jboss.msc.service.ServiceName) CommandDispatcherFactory(org.wildfly.clustering.dispatcher.CommandDispatcherFactory) ValueService(org.jboss.msc.service.ValueService) KeyAffinityServiceFactory(org.wildfly.clustering.infinispan.spi.affinity.KeyAffinityServiceFactory)

Example 2 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class RaServicesFactory method createDeploymentService.

public static void createDeploymentService(final ManagementResourceRegistration registration, ConnectorXmlDescriptor connectorXmlDescriptor, Module module, ServiceTarget serviceTarget, final String deploymentUnitName, ServiceName deploymentUnitServiceName, String deployment, Activation raxml, final Resource deploymentResource, final ServiceRegistry serviceRegistry) {
    // Create the service
    ServiceName serviceName = ConnectorServices.getDeploymentServiceName(deploymentUnitName, raxml);
    ResourceAdapterXmlDeploymentService service = new ResourceAdapterXmlDeploymentService(connectorXmlDescriptor, raxml, module, deployment, serviceName, deploymentUnitServiceName);
    String bootStrapCtxName = DEFAULT_NAME;
    if (raxml.getBootstrapContext() != null && !raxml.getBootstrapContext().equals("undefined")) {
        bootStrapCtxName = raxml.getBootstrapContext();
    }
    ServiceBuilder<ResourceAdapterDeployment> builder = Services.addServerExecutorDependency(serviceTarget.addService(serviceName, service), service.getExecutorServiceInjector(), false).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, service.getMdrInjector()).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, service.getRaRepositoryInjector()).addDependency(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, ManagementRepository.class, service.getManagementRepositoryInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, ResourceAdapterDeploymentRegistry.class, service.getRegistryInjector()).addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class, service.getTxIntegrationInjector()).addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE, JcaSubsystemConfiguration.class, service.getConfigInjector()).addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, service.getCcmInjector()).addDependency(ConnectorServices.IDLE_REMOVER_SERVICE).addDependency(ConnectorServices.CONNECTION_VALIDATOR_SERVICE).addDependency(NamingService.SERVICE_NAME).addDependency(ConnectorServices.BOOTSTRAP_CONTEXT_SERVICE.append(bootStrapCtxName)).addDependency(ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(connectorXmlDescriptor.getDeploymentName()));
    if (ActivationSecurityUtil.isLegacySecurityRequired(raxml)) {
        builder.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class, service.getSubjectFactoryInjector()).addDependency(SimpleSecurityManagerService.SERVICE_NAME, ServerSecurityManager.class, service.getServerSecurityManager());
    }
    String raName = deployment;
    if (raxml.getId() != null) {
        raName = raxml.getId();
    }
    ServiceName parentName = ServiceName.of(ConnectorServices.RA_SERVICE, raName);
    for (ServiceName subServiceName : serviceRegistry.getServiceNames()) {
        if (parentName.isParentOf(subServiceName) && !subServiceName.getSimpleName().equals(ConnectorServices.STATISTICS_SUFFIX)) {
            builder.addDependency(subServiceName);
        }
    }
    if (registration != null && deploymentResource != null) {
        if (registration.isAllowsOverride() && registration.getOverrideModel(deploymentUnitName) == null) {
            registration.registerOverrideModel(deploymentUnitName, new OverrideDescriptionProvider() {

                @Override
                public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
                    return Collections.emptyMap();
                }

                @Override
                public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
                    return Collections.emptyMap();
                }
            });
        }
    }
    builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
}
Also used : ResourceAdapterDeployment(org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment) Locale(java.util.Locale) TransactionIntegration(org.jboss.jca.core.spi.transaction.TransactionIntegration) SubjectFactory(org.jboss.security.SubjectFactory) ResourceAdapterXmlDeploymentService(org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService) OverrideDescriptionProvider(org.jboss.as.controller.descriptions.OverrideDescriptionProvider) AS7MetadataRepository(org.jboss.as.connector.services.mdr.AS7MetadataRepository) CachedConnectionManager(org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager) ManagementRepository(org.jboss.jca.core.api.management.ManagementRepository) ServiceName(org.jboss.msc.service.ServiceName) Map(java.util.Map)

Example 3 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class PassivationStoreWriteHandler method applyModelToRuntime.

private void applyModelToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode model) throws OperationFailedException {
    String name = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
    ServiceName serviceName = DistributableCacheFactoryBuilderService.getServiceName(name);
    ServiceRegistry registry = context.getServiceRegistry(true);
    ServiceController<?> service = registry.getService(serviceName);
    if (service != null) {
        DistributableCacheFactoryBuilder<?, ?> builder = (DistributableCacheFactoryBuilder<?, ?>) service.getValue();
        if (builder != null) {
            if (this.maxSizeAttribute.getName().equals(attributeName)) {
                int maxSize = this.maxSizeAttribute.resolveModelAttribute(context, model).asInt();
                builder.getConfiguration().setMaxSize(maxSize);
            }
        }
    }
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) DistributableCacheFactoryBuilder(org.jboss.as.ejb3.cache.distributable.DistributableCacheFactoryBuilder)

Example 4 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class StrictMaxPoolAdd method installRuntimeService.

ServiceController<PoolConfig> installRuntimeService(OperationContext context, ModelNode operation, ModelNode strictMaxPoolModel, ServiceVerificationHandler verificationHandler) 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<PoolConfig> svcBuilder = context.getServiceTarget().addService(serviceName, poolConfigService);
    if (verificationHandler != null) {
        svcBuilder.addListener(verificationHandler);
    }
    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());
    }
    return svcBuilder.install();
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) Derive(org.jboss.as.ejb3.component.pool.StrictMaxPoolConfigService.Derive) PoolConfig(org.jboss.as.ejb3.component.pool.PoolConfig) StrictMaxPoolConfigService(org.jboss.as.ejb3.component.pool.StrictMaxPoolConfigService)

Example 5 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class TimerServiceAdd method performBoottime.

protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) 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);
    newControllers.add(context.getServiceTarget().addService(TimerServiceDeploymentProcessor.TIMER_SERVICE_NAME, new TimerValueService()).install());
}
Also used : DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) TimerMethodMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.TimerMethodMergingProcessor) ServiceName(org.jboss.msc.service.ServiceName) AroundTimeoutAnnotationParsingProcessor(org.jboss.as.ejb3.deployment.processors.AroundTimeoutAnnotationParsingProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) TimerServiceDeploymentProcessor(org.jboss.as.ejb3.deployment.processors.TimerServiceDeploymentProcessor) TimerServiceAnnotationProcessor(org.jboss.as.ejb3.deployment.processors.annotation.TimerServiceAnnotationProcessor)

Aggregations

ServiceName (org.jboss.msc.service.ServiceName)446 ServiceTarget (org.jboss.msc.service.ServiceTarget)79 ModelNode (org.jboss.dmr.ModelNode)65 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)62 PathAddress (org.jboss.as.controller.PathAddress)52 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)51 OperationFailedException (org.jboss.as.controller.OperationFailedException)38 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)38 ServiceBuilder (org.jboss.msc.service.ServiceBuilder)33 HashSet (java.util.HashSet)27 ContextNames (org.jboss.as.naming.deployment.ContextNames)27 Module (org.jboss.modules.Module)27 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)25 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)24 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)24 Service (org.jboss.msc.Service)24 ArrayList (java.util.ArrayList)23 HashMap (java.util.HashMap)23 BinderService (org.jboss.as.naming.service.BinderService)23 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)22