Search in sources :

Example 1 with DeploymentProcessorTarget

use of org.jboss.as.server.DeploymentProcessorTarget 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)

Example 2 with DeploymentProcessorTarget

use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly-camel by wildfly-extras.

the class CamelSubsystemAdd method performBoottime.

@Override
protected void performBoottime(final OperationContext context, final ModelNode operation, final ModelNode model) {
    final GraviaSubsystemBootstrap gravia = new GraviaSubsystemBootstrap();
    gravia.getSubsystemServices(context);
    CamelBootstrapService.addService(context.getServiceTarget());
    CamelContextFactoryService.addService(context.getServiceTarget());
    CamelContextRegistryService.addService(context.getServiceTarget(), subsystemState);
    ContextCreateHandlerRegistryService.addService(context.getServiceTarget(), subsystemState);
    subsystemState.processExtensions(new Consumer<CamelSubsytemExtension>() {

        @Override
        public void accept(CamelSubsytemExtension plugin) {
            plugin.addExtensionServices(context.getServiceTarget(), subsystemState);
        }
    });
    // Register deployment unit processors
    context.addStep(new AbstractDeploymentChainStep() {

        @Override
        public void execute(final DeploymentProcessorTarget processorTarget) {
            gravia.addDeploymentUnitProcessors(processorTarget);
            processorTarget.addDeploymentProcessor(CamelExtension.SUBSYSTEM_NAME, Phase.PARSE, PARSE_DEPLOYMENT_SETTINGS, new CamelDeploymentSettingsProcessor());
            processorTarget.addDeploymentProcessor(CamelExtension.SUBSYSTEM_NAME, Phase.PARSE, PARSE_CAMEL_CONTEXT_DESCRIPTORS, new CamelContextDescriptorsProcessor());
            processorTarget.addDeploymentProcessor(CamelExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, DEPENDENCIES_CAMEL_INTEGRATION, new CamelIntegrationProcessor());
            processorTarget.addDeploymentProcessor(CamelExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, DEPENDENCIES_CAMEL_WIRINGS, new CamelDependenciesProcessor());
            processorTarget.addDeploymentProcessor(CamelExtension.SUBSYSTEM_NAME, Phase.INSTALL, INSTALL_PACKAGE_SCAN_RESOLVER, new PackageScanResolverProcessor());
            processorTarget.addDeploymentProcessor(CamelExtension.SUBSYSTEM_NAME, Phase.INSTALL, INSTALL_CAMEL_CONTEXT_CREATE, new CamelContextBootstrapProcessor());
            processorTarget.addDeploymentProcessor(CamelExtension.SUBSYSTEM_NAME, Phase.INSTALL, INSTALL_CONTEXT_ACTIVATION, new CamelContextActivationProcessor());
            subsystemState.processExtensions(new Consumer<CamelSubsytemExtension>() {

                @Override
                public void accept(CamelSubsytemExtension plugin) {
                    plugin.addDeploymentProcessor(processorTarget, subsystemState);
                }
            });
        }
    }, OperationContext.Stage.RUNTIME);
}
Also used : CamelDeploymentSettingsProcessor(org.wildfly.extension.camel.deployment.CamelDeploymentSettingsProcessor) CamelIntegrationProcessor(org.wildfly.extension.camel.deployment.CamelIntegrationProcessor) GraviaSubsystemBootstrap(org.wildfly.extension.gravia.parser.GraviaSubsystemBootstrap) CamelSubsytemExtension(org.wildfly.extension.camel.CamelSubsytemExtension) PackageScanResolverProcessor(org.wildfly.extension.camel.deployment.PackageScanResolverProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) Consumer(java.util.function.Consumer) CamelContextActivationProcessor(org.wildfly.extension.camel.deployment.CamelContextActivationProcessor) CamelContextBootstrapProcessor(org.wildfly.extension.camel.deployment.CamelContextBootstrapProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) CamelContextDescriptorsProcessor(org.wildfly.extension.camel.deployment.CamelContextDescriptorsProcessor) CamelDependenciesProcessor(org.wildfly.extension.camel.deployment.CamelDependenciesProcessor)

Example 3 with DeploymentProcessorTarget

use of org.jboss.as.server.DeploymentProcessorTarget in project camunda-bpm-platform by camunda.

the class BpmPlatformSubsystemAdd method performBoottime.

/**
 * {@inheritDoc}
 */
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
    // add deployment processors
    context.addStep(new AbstractDeploymentChainStep() {

        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.PARSE, ProcessApplicationProcessor.PRIORITY, new ProcessApplicationProcessor());
            processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.DEPENDENCIES, ModuleDependencyProcessor.PRIORITY, new ModuleDependencyProcessor());
            processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.POST_MODULE, ProcessesXmlProcessor.PRIORITY, new ProcessesXmlProcessor());
            processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.INSTALL, ProcessEngineStartProcessor.PRIORITY, new ProcessEngineStartProcessor());
            processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.INSTALL, ProcessApplicationDeploymentProcessor.PRIORITY, new ProcessApplicationDeploymentProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
    // create and register the MSC container delegate.
    final MscRuntimeContainerDelegate processEngineService = new MscRuntimeContainerDelegate();
    final ServiceController<MscRuntimeContainerDelegate> controller = context.getServiceTarget().addService(ServiceNames.forMscRuntimeContainerDelegate(), processEngineService).addListener(verificationHandler).setInitialMode(Mode.ACTIVE).install();
    newControllers.add(controller);
    // discover and register bpm platform plugins
    BpmPlatformPlugins plugins = BpmPlatformPlugins.load(getClass().getClassLoader());
    MscBpmPlatformPlugins managedPlugins = new MscBpmPlatformPlugins(plugins);
    ServiceController<BpmPlatformPlugins> serviceController = context.getServiceTarget().addService(ServiceNames.forBpmPlatformPlugins(), managedPlugins).addListener(verificationHandler).setInitialMode(Mode.ACTIVE).install();
    newControllers.add(serviceController);
}
Also used : MscBpmPlatformPlugins(org.camunda.bpm.container.impl.jboss.service.MscBpmPlatformPlugins) BpmPlatformPlugins(org.camunda.bpm.container.impl.plugin.BpmPlatformPlugins) MscBpmPlatformPlugins(org.camunda.bpm.container.impl.jboss.service.MscBpmPlatformPlugins) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) MscRuntimeContainerDelegate(org.camunda.bpm.container.impl.jboss.service.MscRuntimeContainerDelegate)

Example 4 with DeploymentProcessorTarget

use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.

the class MessagingSubsystemAdd method performBoottime.

@Override
protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) throws OperationFailedException {
    // Cache support for capability service name lookups by our services
    MessagingServices.capabilityServiceSupport = context.getCapabilityServiceSupport();
    context.addStep(new AbstractDeploymentChainStep() {

        @Override
        protected void execute(DeploymentProcessorTarget processorTarget) {
            // keep the statements ordered by phase + priority
            processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_JMS_CONNECTION_FACTORY_RESOURCE_INJECTION, new DefaultJMSConnectionFactoryResourceReferenceProcessor());
            processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_RESOURCE_DEF_ANNOTATION_JMS_DESTINATION, new JMSDestinationDefinitionAnnotationProcessor());
            processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_RESOURCE_DEF_ANNOTATION_JMS_CONNECTION_FACTORY, new JMSConnectionFactoryDefinitionAnnotationProcessor(MessagingServices.capabilityServiceSupport.hasCapability("org.wildfly.legacy-security")));
            processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_MESSAGING_XML_RESOURCES, new MessagingXmlParsingDeploymentUnitProcessor());
            processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_JMS, new MessagingDependencyProcessor());
            if (MessagingServices.capabilityServiceSupport.hasCapability(WELD_CAPABILITY_NAME)) {
                processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_JMS_CDI_EXTENSIONS, new CDIDeploymentProcessor());
            }
            processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_RESOURCE_DEF_XML_JMS_CONNECTION_FACTORY, new JMSConnectionFactoryDefinitionDescriptorProcessor());
            processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_RESOURCE_DEF_XML_JMS_DESTINATION, new JMSDestinationDefinitionDescriptorProcessor());
            processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_DEFAULT_BINDINGS_JMS_CONNECTION_FACTORY, new DefaultJMSConnectionFactoryBindingProcessor());
            processorTarget.addDeploymentProcessor(MessagingExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_MESSAGING_XML_RESOURCES, new MessagingXmlInstallDeploymentUnitProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
    ModelNode threadPoolMaxSize = operation.get(GLOBAL_CLIENT_THREAD_POOL_MAX_SIZE.getName());
    ModelNode scheduledThreadPoolMaxSize = operation.get(GLOBAL_CLIENT_SCHEDULED_THREAD_POOL_MAX_SIZE.getName());
    Integer threadPoolMaxSizeValue;
    Integer scheduledThreadPoolMaxSizeValue;
    // if the attributes are defined, their value is used (and the system properties are ignored)
    Properties sysprops = System.getProperties();
    if (threadPoolMaxSize.isDefined()) {
        threadPoolMaxSizeValue = GLOBAL_CLIENT_THREAD_POOL_MAX_SIZE.resolveModelAttribute(context, operation).asInt();
    } else if (sysprops.containsKey(THREAD_POOL_MAX_SIZE_PROPERTY_KEY)) {
        threadPoolMaxSizeValue = Integer.parseInt(sysprops.getProperty(THREAD_POOL_MAX_SIZE_PROPERTY_KEY));
    } else {
        // property is not configured using sysprop or explicit attribute
        threadPoolMaxSizeValue = null;
    }
    if (scheduledThreadPoolMaxSize.isDefined()) {
        scheduledThreadPoolMaxSizeValue = GLOBAL_CLIENT_SCHEDULED_THREAD_POOL_MAX_SIZE.resolveModelAttribute(context, operation).asInt();
    } else if (sysprops.containsKey(SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY)) {
        scheduledThreadPoolMaxSizeValue = Integer.parseInt(sysprops.getProperty(SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY));
    } else {
        // property is not configured using sysprop or explicit attribute
        scheduledThreadPoolMaxSizeValue = null;
    }
    if (threadPoolMaxSizeValue != null || scheduledThreadPoolMaxSizeValue != null) {
        ActiveMQClient.initializeGlobalThreadPoolProperties();
        if (threadPoolMaxSizeValue == null) {
            threadPoolMaxSizeValue = ActiveMQClient.getGlobalThreadPoolSize();
        }
        if (scheduledThreadPoolMaxSizeValue == null) {
            scheduledThreadPoolMaxSizeValue = ActiveMQClient.getGlobalScheduledThreadPoolSize();
        }
        MessagingLogger.ROOT_LOGGER.debugf("Setting global client thread pool size to: regular=%s, scheduled=%s", threadPoolMaxSizeValue, scheduledThreadPoolMaxSizeValue);
        ActiveMQClient.setGlobalThreadPoolProperties(threadPoolMaxSizeValue, scheduledThreadPoolMaxSizeValue);
    }
    context.getServiceTarget().addService(MessagingServices.ACTIVEMQ_CLIENT_THREAD_POOL).setInstance(new ThreadPoolService()).install();
    context.addStep(new OperationStepHandler() {

        @Override
        public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
            final ServiceTarget serviceTarget = context.getServiceTarget();
            final ServiceBuilder serviceBuilder = serviceTarget.addService(CONFIGURATION_CAPABILITY.getCapabilityServiceName());
            // Transform the configuration based on the recursive model
            final ModelNode model = Resource.Tools.readModel(context.readResource(PathAddress.EMPTY_ADDRESS));
            // Process connectors
            final Set<String> connectorsSocketBindings = new HashSet<String>();
            final Map<String, TransportConfiguration> connectors = TransportConfigOperationHandlers.processConnectors(context, "localhost", model, connectorsSocketBindings);
            Map<String, ServiceName> outboundSocketBindings = new HashMap<>();
            Map<String, Boolean> outbounds = TransportConfigOperationHandlers.listOutBoundSocketBinding(context, connectorsSocketBindings);
            Map<String, ServiceName> socketBindings = new HashMap<>();
            for (final String connectorSocketBinding : connectorsSocketBindings) {
                // find whether the connectorSocketBinding references a SocketBinding or an OutboundSocketBinding
                if (outbounds.get(connectorSocketBinding)) {
                    final ServiceName outboundSocketName = OUTBOUND_SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(connectorSocketBinding);
                    outboundSocketBindings.put(connectorSocketBinding, outboundSocketName);
                } else {
                    // check if the socket binding has not already been added by the acceptors
                    if (!socketBindings.containsKey(connectorSocketBinding)) {
                        socketBindings.put(connectorSocketBinding, SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(connectorSocketBinding));
                    }
                }
            }
            final List<BroadcastGroupConfiguration> broadcastGroupConfigurations = new ArrayList<>();
            // this requires connectors
            BroadcastGroupAdd.addBroadcastGroupConfigs(context, broadcastGroupConfigurations, connectors.keySet(), model);
            final Map<String, DiscoveryGroupConfiguration> discoveryGroupConfigurations = ConfigurationHelper.addDiscoveryGroupConfigurations(context, model);
            final Map<String, String> clusterNames = new HashMap<>();
            final Map<String, ServiceName> commandDispatcherFactories = new HashMap<>();
            final Map<String, ServiceName> groupBindings = new HashMap<>();
            final Set<ServiceName> groupBindingServices = new HashSet<>();
            for (final BroadcastGroupConfiguration config : broadcastGroupConfigurations) {
                final String name = config.getName();
                final String key = "broadcast" + name;
                if (model.hasDefined(JGROUPS_BROADCAST_GROUP, name)) {
                    ModelNode broadcastGroupModel = model.get(JGROUPS_BROADCAST_GROUP, name);
                    String channelName = JGroupsBroadcastGroupDefinition.JGROUPS_CHANNEL.resolveModelAttribute(context, broadcastGroupModel).asStringOrNull();
                    MessagingSubsystemAdd.this.broadcastCommandDispatcherFactoryInstaller.accept(context, channelName);
                    commandDispatcherFactories.put(key, MessagingServices.getBroadcastCommandDispatcherFactoryServiceName(channelName));
                    String clusterName = JGROUPS_CLUSTER.resolveModelAttribute(context, broadcastGroupModel).asString();
                    clusterNames.put(key, clusterName);
                } else {
                    final ServiceName groupBindingServiceName = GroupBindingService.getBroadcastBaseServiceName(JBOSS_MESSAGING_ACTIVEMQ).append(name);
                    if (!groupBindingServices.contains(groupBindingServiceName)) {
                        groupBindingServices.add(groupBindingServiceName);
                    }
                    groupBindings.put(key, groupBindingServiceName);
                }
            }
            for (final DiscoveryGroupConfiguration config : discoveryGroupConfigurations.values()) {
                final String name = config.getName();
                final String key = "discovery" + name;
                if (model.hasDefined(JGROUPS_DISCOVERY_GROUP, name)) {
                    ModelNode discoveryGroupModel = model.get(JGROUPS_DISCOVERY_GROUP, name);
                    String channelName = JGroupsDiscoveryGroupDefinition.JGROUPS_CHANNEL.resolveModelAttribute(context, discoveryGroupModel).asStringOrNull();
                    MessagingSubsystemAdd.this.broadcastCommandDispatcherFactoryInstaller.accept(context, channelName);
                    commandDispatcherFactories.put(key, MessagingServices.getBroadcastCommandDispatcherFactoryServiceName(channelName));
                    String clusterName = JGROUPS_CLUSTER.resolveModelAttribute(context, discoveryGroupModel).asString();
                    clusterNames.put(key, clusterName);
                } else {
                    final ServiceName groupBindingServiceName = GroupBindingService.getDiscoveryBaseServiceName(JBOSS_MESSAGING_ACTIVEMQ).append(name);
                    if (!groupBindingServices.contains(groupBindingServiceName)) {
                        groupBindingServices.add(groupBindingServiceName);
                    }
                    groupBindings.put(key, groupBindingServiceName);
                }
            }
            serviceBuilder.setInstance(new ExternalBrokerConfigurationService(connectors, discoveryGroupConfigurations, socketBindings, outboundSocketBindings, groupBindings, commandDispatcherFactories, clusterNames)).install();
        }
    }, OperationContext.Stage.RUNTIME);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) Properties(java.util.Properties) JMSConnectionFactoryDefinitionDescriptorProcessor(org.wildfly.extension.messaging.activemq.deployment.JMSConnectionFactoryDefinitionDescriptorProcessor) DefaultJMSConnectionFactoryResourceReferenceProcessor(org.wildfly.extension.messaging.activemq.deployment.DefaultJMSConnectionFactoryResourceReferenceProcessor) ServiceBuilder(org.jboss.msc.service.ServiceBuilder) JMSConnectionFactoryDefinitionAnnotationProcessor(org.wildfly.extension.messaging.activemq.deployment.JMSConnectionFactoryDefinitionAnnotationProcessor) List(java.util.List) ArrayList(java.util.ArrayList) DefaultJMSConnectionFactoryBindingProcessor(org.wildfly.extension.messaging.activemq.deployment.DefaultJMSConnectionFactoryBindingProcessor) MessagingXmlParsingDeploymentUnitProcessor(org.wildfly.extension.messaging.activemq.deployment.MessagingXmlParsingDeploymentUnitProcessor) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) OperationContext(org.jboss.as.controller.OperationContext) MessagingDependencyProcessor(org.wildfly.extension.messaging.activemq.deployment.MessagingDependencyProcessor) CDIDeploymentProcessor(org.wildfly.extension.messaging.activemq.deployment.injection.CDIDeploymentProcessor) JMSDestinationDefinitionDescriptorProcessor(org.wildfly.extension.messaging.activemq.deployment.JMSDestinationDefinitionDescriptorProcessor) MessagingXmlInstallDeploymentUnitProcessor(org.wildfly.extension.messaging.activemq.deployment.MessagingXmlInstallDeploymentUnitProcessor) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) ServiceTarget(org.jboss.msc.service.ServiceTarget) OperationFailedException(org.jboss.as.controller.OperationFailedException) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ServiceName(org.jboss.msc.service.ServiceName) JMSDestinationDefinitionAnnotationProcessor(org.wildfly.extension.messaging.activemq.deployment.JMSDestinationDefinitionAnnotationProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ModelNode(org.jboss.dmr.ModelNode) Map(java.util.Map) HashMap(java.util.HashMap)

Example 5 with DeploymentProcessorTarget

use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.

the class CachedConnectionManagerAdd method performBoottime.

@Override
protected void performBoottime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
    final boolean debug = JcaCachedConnectionManagerDefinition.CcmParameters.DEBUG.getAttribute().resolveModelAttribute(context, model).asBoolean();
    final boolean error = JcaCachedConnectionManagerDefinition.CcmParameters.ERROR.getAttribute().resolveModelAttribute(context, model).asBoolean();
    final boolean ignoreUnknownConnections = JcaCachedConnectionManagerDefinition.CcmParameters.IGNORE_UNKNOWN_CONNECTIONS.getAttribute().resolveModelAttribute(context, model).asBoolean();
    final boolean install = JcaCachedConnectionManagerDefinition.CcmParameters.INSTALL.getAttribute().resolveModelAttribute(context, model).asBoolean();
    final ServiceTarget serviceTarget = context.getServiceTarget();
    if (install) {
        ROOT_LOGGER.debug("Enabling the Cache Connection Manager valve and interceptor...");
        context.addStep(new AbstractDeploymentChainStep() {

            protected void execute(DeploymentProcessorTarget processorTarget) {
                processorTarget.addDeploymentProcessor(JcaExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_CACHED_CONNECTION_MANAGER, new CachedConnectionManagerSetupProcessor());
            }
        }, OperationContext.Stage.RUNTIME);
    } else {
        ROOT_LOGGER.debug("Disabling the Cache Connection Manager valve and interceptor...");
    }
    CachedConnectionManagerService ccmService = new CachedConnectionManagerService(debug, error, ignoreUnknownConnections);
    serviceTarget.addService(ConnectorServices.CCM_SERVICE, ccmService).addDependency(context.getCapabilityServiceSupport().getCapabilityServiceName(ConnectorServices.TRANSACTION_INTEGRATION_CAPABILITY_NAME), TransactionIntegration.class, ccmService.getTransactionIntegrationInjector()).install();
    NonTxCachedConnectionManagerService noTxCcm = new NonTxCachedConnectionManagerService(debug, error, ignoreUnknownConnections);
    serviceTarget.addService(ConnectorServices.NON_TX_CCM_SERVICE, noTxCcm).install();
}
Also used : CachedConnectionManagerSetupProcessor(org.jboss.as.connector.deployers.ra.processors.CachedConnectionManagerSetupProcessor) TransactionIntegration(org.jboss.jca.core.spi.transaction.TransactionIntegration) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ServiceTarget(org.jboss.msc.service.ServiceTarget) CachedConnectionManagerService(org.jboss.as.connector.services.jca.CachedConnectionManagerService) NonTxCachedConnectionManagerService(org.jboss.as.connector.services.jca.NonTxCachedConnectionManagerService) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) NonTxCachedConnectionManagerService(org.jboss.as.connector.services.jca.NonTxCachedConnectionManagerService)

Aggregations

AbstractDeploymentChainStep (org.jboss.as.server.AbstractDeploymentChainStep)38 DeploymentProcessorTarget (org.jboss.as.server.DeploymentProcessorTarget)38 ServiceTarget (org.jboss.msc.service.ServiceTarget)12 ModelNode (org.jboss.dmr.ModelNode)11 ServiceName (org.jboss.msc.service.ServiceName)10 JBossAllXmlParserRegisteringProcessor (org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor)7 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)6 OperationContext (org.jboss.as.controller.OperationContext)5 OperationFailedException (org.jboss.as.controller.OperationFailedException)4 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)4 PathHandler (io.undertow.server.handlers.PathHandler)3 Resource (org.jboss.as.controller.registry.Resource)3 AssociationService (org.jboss.as.ejb3.remote.AssociationService)3 BinderService (org.jboss.as.naming.service.BinderService)3 UserTransactionAccessControlService (org.jboss.as.txn.service.UserTransactionAccessControlService)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Properties (java.util.Properties)2 TransactionManager (javax.transaction.TransactionManager)2 TransactionSynchronizationRegistry (javax.transaction.TransactionSynchronizationRegistry)2