Search in sources :

Example 1 with AbstractDeploymentChainStep

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

the class JPASubSystemAdd method performBoottime.

protected void performBoottime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
    runtimeValidator.validate(operation.resolve());
    context.addStep(new AbstractDeploymentChainStep() {

        protected void execute(DeploymentProcessorTarget processorTarget) {
            // set Hibernate persistence provider as the default provider
            javax.persistence.spi.PersistenceProviderResolverHolder.setPersistenceProviderResolver(PersistenceProviderResolverImpl.getInstance());
            final boolean appclient = context.getProcessType() == ProcessType.APPLICATION_CLIENT;
            PlatformImpl platform;
            if (appclient) {
                // we do not yet support a second level cache in the client container
                platform = new PlatformImpl(Classification.NONE);
            } else {
                // Infinispan can be used in server container
                platform = new PlatformImpl(Classification.INFINISPAN, Classification.INFINISPAN);
            }
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_JPA, new JBossAllXmlParserRegisteringProcessor<>(JPAJarJBossAllParser.ROOT_ELEMENT, JpaAttachments.DEPLOYMENT_SETTINGS_KEY, new JPAJarJBossAllParser()));
            // handles parsing of persistence.xml
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_PERSISTENCE_UNIT, new PersistenceUnitParseProcessor(appclient));
            // handles persistence unit / context annotations in components
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_PERSISTENCE_ANNOTATION, new JPAAnnotationProcessor());
            // injects JPA dependencies into an application
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_JPA, new JPADependencyProcessor());
            // Inject Hibernate Search dependencies into an application
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_HIBERNATE_SEARCH, new HibernateSearchProcessor());
            // handle ClassFileTransformer
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.FIRST_MODULE_USE, Phase.FIRST_MODULE_USE_PERSISTENCE_CLASS_FILE_TRANSFORMER, new JPAClassFileTransformerProcessor());
            // registers listeners/interceptors on session beans
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.FIRST_MODULE_USE, Phase.FIRST_MODULE_USE_INTERCEPTORS, new JPAInterceptorProcessor());
            // begin pu service install and deploying a persistence provider
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.FIRST_MODULE_USE, Phase.FIRST_MODULE_USE_PERSISTENCE_PREPARE, new PersistenceBeginInstallProcessor(platform));
            // handles persistence unit / context references from deployment descriptors
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_PERSISTENCE_REF, new PersistenceRefProcessor());
            // handles pu deployment (completes pu service installation)
            processorTarget.addDeploymentProcessor(JPAExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_PERSISTENTUNIT, new PersistenceCompleteInstallProcessor(platform));
        }
    }, OperationContext.Stage.RUNTIME);
    final ModelNode defaultDSNode = operation.require(CommonAttributes.DEFAULT_DATASOURCE);
    final String dataSourceName = defaultDSNode.resolve().asString();
    ExtendedPersistenceInheritance defaultExtendedPersistenceInheritance = ExtendedPersistenceInheritance.DEEP;
    if (operation.hasDefined(CommonAttributes.DEFAULT_EXTENDEDPERSISTENCE_INHERITANCE)) {
        final ModelNode defaultExtendedPersistenceInheritanceNode = operation.get(CommonAttributes.DEFAULT_EXTENDEDPERSISTENCE_INHERITANCE);
        defaultExtendedPersistenceInheritance = ExtendedPersistenceInheritance.valueOf(defaultExtendedPersistenceInheritanceNode.resolve().asString());
    }
    final ServiceTarget target = context.getServiceTarget();
    JPAService.addService(target, dataSourceName, defaultExtendedPersistenceInheritance);
    JPAUserTransactionListenerService.addService(target);
}
Also used : JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) ServiceTarget(org.jboss.msc.service.ServiceTarget) PersistenceRefProcessor(org.jboss.as.jpa.processor.PersistenceRefProcessor) JPAInterceptorProcessor(org.jboss.as.jpa.processor.JPAInterceptorProcessor) PersistenceCompleteInstallProcessor(org.jboss.as.jpa.processor.PersistenceCompleteInstallProcessor) JPADependencyProcessor(org.jboss.as.jpa.processor.JPADependencyProcessor) ExtendedPersistenceInheritance(org.jboss.as.jpa.config.ExtendedPersistenceInheritance) JPAJarJBossAllParser(org.jboss.as.jpa.processor.JPAJarJBossAllParser) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) PersistenceUnitParseProcessor(org.jboss.as.jpa.processor.PersistenceUnitParseProcessor) JPAClassFileTransformerProcessor(org.jboss.as.jpa.processor.JPAClassFileTransformerProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) HibernateSearchProcessor(org.jboss.as.jpa.processor.HibernateSearchProcessor) ModelNode(org.jboss.dmr.ModelNode) JPAAnnotationProcessor(org.jboss.as.jpa.processor.JPAAnnotationProcessor) PersistenceBeginInstallProcessor(org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor) PlatformImpl(org.jboss.as.jpa.platform.PlatformImpl)

Example 2 with AbstractDeploymentChainStep

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

the class MessagingSubsystemAdd method performBoottime.

@Override
protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) throws OperationFailedException {
    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());
            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());
            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());
    final int threadPoolMaxSizeValue;
    final int scheduledThreadPoolMaxSizeValue;
    // if Artemis System properties are defined, they have precedence over the default values of undefined
    // attributes from the management mode (for backwards compatibility).
    // if the attributes are defined, their value is used (and the system properties are ignored)
    Properties sysprops = System.getProperties();
    if (!threadPoolMaxSize.isDefined() && sysprops.containsKey(THREAD_POOL_MAX_SIZE_PROPERTY_KEY)) {
        threadPoolMaxSizeValue = Integer.parseInt(sysprops.getProperty(THREAD_POOL_MAX_SIZE_PROPERTY_KEY));
    } else {
        threadPoolMaxSizeValue = GLOBAL_CLIENT_THREAD_POOL_MAX_SIZE.resolveModelAttribute(context, operation).asInt();
    }
    if (!scheduledThreadPoolMaxSize.isDefined() && sysprops.containsKey(SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY)) {
        scheduledThreadPoolMaxSizeValue = Integer.parseInt(sysprops.getProperty(SCHEDULED_THREAD_POOL_SIZE_PROPERTY_KEY));
    } else {
        scheduledThreadPoolMaxSizeValue = GLOBAL_CLIENT_SCHEDULED_THREAD_POOL_MAX_SIZE.resolveModelAttribute(context, operation).asInt();
    }
    MessagingLogger.ROOT_LOGGER.debugf("Setting global client thread pool size to: regular=%s, scheduled=%s", threadPoolMaxSizeValue, scheduledThreadPoolMaxSizeValue);
    ActiveMQClient.setGlobalThreadPoolProperties(threadPoolMaxSizeValue, scheduledThreadPoolMaxSizeValue);
}
Also used : 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) Properties(java.util.Properties) JMSConnectionFactoryDefinitionDescriptorProcessor(org.wildfly.extension.messaging.activemq.deployment.JMSConnectionFactoryDefinitionDescriptorProcessor) DefaultJMSConnectionFactoryResourceReferenceProcessor(org.wildfly.extension.messaging.activemq.deployment.DefaultJMSConnectionFactoryResourceReferenceProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) JMSDestinationDefinitionAnnotationProcessor(org.wildfly.extension.messaging.activemq.deployment.JMSDestinationDefinitionAnnotationProcessor) JMSConnectionFactoryDefinitionAnnotationProcessor(org.wildfly.extension.messaging.activemq.deployment.JMSConnectionFactoryDefinitionAnnotationProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) DefaultJMSConnectionFactoryBindingProcessor(org.wildfly.extension.messaging.activemq.deployment.DefaultJMSConnectionFactoryBindingProcessor) MessagingXmlParsingDeploymentUnitProcessor(org.wildfly.extension.messaging.activemq.deployment.MessagingXmlParsingDeploymentUnitProcessor) ModelNode(org.jboss.dmr.ModelNode)

Example 3 with AbstractDeploymentChainStep

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

the class UndertowSubsystemAdd method performBoottime.

/**
     * {@inheritDoc}
     */
@Override
protected void performBoottime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
    try {
        Class.forName("org.apache.jasper.compiler.JspRuntimeContext", true, this.getClass().getClassLoader());
    } catch (ClassNotFoundException e) {
        UndertowLogger.ROOT_LOGGER.couldNotInitJsp(e);
    }
    final ModelNode model = resource.getModel();
    final String defaultVirtualHost = UndertowRootDefinition.DEFAULT_VIRTUAL_HOST.resolveModelAttribute(context, model).asString();
    final String defaultContainer = UndertowRootDefinition.DEFAULT_SERVLET_CONTAINER.resolveModelAttribute(context, model).asString();
    final String defaultServer = UndertowRootDefinition.DEFAULT_SERVER.resolveModelAttribute(context, model).asString();
    final boolean stats = UndertowRootDefinition.STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean();
    final String defaultSecurityDomain = UndertowRootDefinition.DEFAULT_SECURITY_DOMAIN.resolveModelAttribute(context, model).asString();
    final ModelNode instanceIdModel = UndertowRootDefinition.INSTANCE_ID.resolveModelAttribute(context, model);
    final String instanceId = instanceIdModel.isDefined() ? instanceIdModel.asString() : null;
    ServiceTarget target = context.getServiceTarget();
    //we clear provider on system boot, as on reload it could cause issues.
    DefaultDeploymentMappingProvider.instance().clear();
    target.addService(UndertowService.UNDERTOW, new UndertowService(defaultContainer, defaultServer, defaultVirtualHost, instanceId, stats)).setInitialMode(ServiceController.Mode.ACTIVE).install();
    context.addStep(new AbstractDeploymentChainStep() {

        @Override
        protected void execute(DeploymentProcessorTarget processorTarget) {
            final SharedTldsMetaDataBuilder sharedTldsBuilder = new SharedTldsMetaDataBuilder(model.clone());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_EXPLODED_MOUNT, new DeploymentRootExplodedMountProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_UNDERTOW_SHARED_SESSION, new JBossAllXmlParserRegisteringProcessor<>(SharedSessionConfigParser_1_0.ROOT_ELEMENT, UndertowAttachments.SHARED_SESSION_MANAGER_CONFIG, SharedSessionConfigParser_1_0.INSTANCE));
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_WEB, new JBossAllXmlParserRegisteringProcessor<>(WebJBossAllParser.ROOT_ELEMENT, WebJBossAllParser.ATTACHMENT_KEY, new WebJBossAllParser()));
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT, new WarDeploymentInitializingProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_WAR, new WarStructureDeploymentProcessor(sharedTldsBuilder));
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT, new WebParsingDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT_FRAGMENT, new WebFragmentParsingDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_JBOSS_WEB_DEPLOYMENT, new JBossWebParsingDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_ANNOTATION_WAR, new WarAnnotationDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EAR_CONTEXT_ROOT, new EarContextRootProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WEB_MERGE_METADATA, new WarMetaDataProcessor());
            //todo: fix priority
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WEB_MERGE_METADATA + 1, new TldParsingDeploymentProcessor());
            //todo: fix priority
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WEB_MERGE_METADATA + 2, new org.wildfly.extension.undertow.deployment.WebComponentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE, new UndertowDependencyProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_UNDERTOW_WEBSOCKETS, new UndertowJSRWebSocketDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_UNDERTOW_HANDLERS, new UndertowHandlersDeploymentProcessor());
            //todo: fix priority
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_UNDERTOW_HANDLERS + 1, new ExternalTldParsingDeploymentProcessor());
            //todo: fix priority
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_UNDERTOW_HANDLERS + 2, new UndertowServletContainerDependencyProcessor(defaultContainer));
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_SHARED_SESSION_MANAGER, new SharedSessionManagerDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_SERVLET_INIT_DEPLOYMENT, new ServletContainerInitializerDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT, new UndertowDeploymentProcessor(defaultVirtualHost, defaultContainer, defaultServer, defaultSecurityDomain, knownSecurityDomain));
        }
    }, OperationContext.Stage.RUNTIME);
    DistributableSessionIdentifierCodecBuilder builder = new DistributableSessionIdentifierCodecBuilderValue().getValue();
    if (builder != null) {
        builder.buildServerDependency(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
    }
    RouteValueService.build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
    target.addService(UndertowRootDefinition.HTTP_INVOKER_RUNTIME_CAPABILITY.getCapabilityServiceName(), new RemoteHttpInvokerService()).install();
}
Also used : UndertowHandlersDeploymentProcessor(org.wildfly.extension.undertow.deployment.UndertowHandlersDeploymentProcessor) DistributableSessionIdentifierCodecBuilderValue(org.wildfly.extension.undertow.session.DistributableSessionIdentifierCodecBuilderValue) WebJBossAllParser(org.wildfly.extension.undertow.deployment.WebJBossAllParser) UndertowDeploymentProcessor(org.wildfly.extension.undertow.deployment.UndertowDeploymentProcessor) UndertowServletContainerDependencyProcessor(org.wildfly.extension.undertow.deployment.UndertowServletContainerDependencyProcessor) DistributableSessionIdentifierCodecBuilder(org.wildfly.extension.undertow.session.DistributableSessionIdentifierCodecBuilder) ServletContainerInitializerDeploymentProcessor(org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor) UndertowJSRWebSocketDeploymentProcessor(org.wildfly.extension.undertow.deployment.UndertowJSRWebSocketDeploymentProcessor) WebParsingDeploymentProcessor(org.wildfly.extension.undertow.deployment.WebParsingDeploymentProcessor) JBossWebParsingDeploymentProcessor(org.wildfly.extension.undertow.deployment.JBossWebParsingDeploymentProcessor) ExternalTldParsingDeploymentProcessor(org.wildfly.extension.undertow.deployment.ExternalTldParsingDeploymentProcessor) TldParsingDeploymentProcessor(org.wildfly.extension.undertow.deployment.TldParsingDeploymentProcessor) SharedTldsMetaDataBuilder(org.jboss.as.web.common.SharedTldsMetaDataBuilder) WarDeploymentInitializingProcessor(org.wildfly.extension.undertow.deployment.WarDeploymentInitializingProcessor) WebFragmentParsingDeploymentProcessor(org.wildfly.extension.undertow.deployment.WebFragmentParsingDeploymentProcessor) WarStructureDeploymentProcessor(org.wildfly.extension.undertow.deployment.WarStructureDeploymentProcessor) JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) EarContextRootProcessor(org.wildfly.extension.undertow.deployment.EarContextRootProcessor) ServiceTarget(org.jboss.msc.service.ServiceTarget) WarAnnotationDeploymentProcessor(org.wildfly.extension.undertow.deployment.WarAnnotationDeploymentProcessor) SharedSessionManagerDeploymentProcessor(org.wildfly.extension.undertow.deployment.SharedSessionManagerDeploymentProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ExternalTldParsingDeploymentProcessor(org.wildfly.extension.undertow.deployment.ExternalTldParsingDeploymentProcessor) DeploymentRootExplodedMountProcessor(org.wildfly.extension.undertow.deployment.DeploymentRootExplodedMountProcessor) WarMetaDataProcessor(org.wildfly.extension.undertow.deployment.WarMetaDataProcessor) UndertowDependencyProcessor(org.wildfly.extension.undertow.deployment.UndertowDependencyProcessor) JBossWebParsingDeploymentProcessor(org.wildfly.extension.undertow.deployment.JBossWebParsingDeploymentProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ModelNode(org.jboss.dmr.ModelNode)

Example 4 with AbstractDeploymentChainStep

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

the class XTSSubsystemAdd method performBoottime.

@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    final String hostName = HOST_NAME.resolveModelAttribute(context, model).asString();
    final ModelNode coordinatorURLAttribute = ENVIRONMENT_URL.resolveModelAttribute(context, model);
    String coordinatorURL = coordinatorURLAttribute.isDefined() ? coordinatorURLAttribute.asString() : null;
    if (coordinatorURL != null) {
        String[] attrs = coordinatorURL.split("/");
        boolean isIPv6Address = false;
        for (int i = 0; i < attrs.length; i++) {
            if (attrs[i].startsWith("::1")) {
                attrs[i] = "[" + attrs[i].substring(0, 3) + "]" + attrs[i].substring(3);
                isIPv6Address = true;
                break;
            }
        }
        if (isIPv6Address) {
            StringBuffer sb = new StringBuffer(attrs[0]);
            for (int i = 1; i < attrs.length; i++) {
                sb.append('/').append(attrs[i]);
            }
            coordinatorURL = sb.toString();
        }
    }
    if (coordinatorURL != null) {
        XtsAsLogger.ROOT_LOGGER.debugf("nodeIdentifier=%s%n", coordinatorURL);
    }
    final boolean isDefaultContextPropagation = model.hasDefined(CommonAttributes.DEFAULT_CONTEXT_PROPAGATION) ? model.get(CommonAttributes.DEFAULT_CONTEXT_PROPAGATION).asBoolean() : false;
    context.addStep(new AbstractDeploymentChainStep() {

        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(XTSExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_XTS_COMPONENT_INTERCEPTORS, new XTSInterceptorDeploymentProcessor());
            processorTarget.addDeploymentProcessor(XTSExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_XTS_SOAP_HANDLERS, new XTSHandlerDeploymentProcessor());
            processorTarget.addDeploymentProcessor(XTSExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_XTS, new XTSDependenciesDeploymentProcessor());
            processorTarget.addDeploymentProcessor(XTSExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_XTS_PORTABLE_EXTENSIONS, new GracefulShutdownDeploymentProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
    final ServiceTarget target = context.getServiceTarget();
    // TODO eventually we should add a config service which manages the XTS configuration
    // this will allow us to include a switch enabling or disabling deployment of
    // endpoints specific to client, coordinator or participant and then deploy
    // and redeploy the relevant endpoints as needed/ the same switches can be used
    // byte the XTS service to decide whether to perfomr client, coordinator or
    // participant initialisation. we should also provide config switches which
    // decide whether to initialise classes and deploy services for AT, BA or both.
    // for now we will just deploy all the endpoints and always do client, coordinator
    // and participant init for both AT and BA.
    // add an endpoint publisher service for each of the required endpoint contexts
    // specifying all the relevant URL patterns and SEI classes
    final ClassLoader loader = XTSService.class.getClassLoader();
    ServiceBuilder<Context> endpointBuilder;
    ArrayList<ServiceController<Context>> controllers = new ArrayList<ServiceController<Context>>();
    Map<Class<?>, Object> attachments = new HashMap<>();
    attachments.put(RejectionRule.class, new GracefulShutdownRejectionRule());
    for (ContextInfo contextInfo : contextDefinitions) {
        String contextName = contextInfo.contextPath;
        Map<String, String> map = new HashMap<String, String>();
        for (EndpointInfo endpointInfo : contextInfo.endpointInfo) {
            map.put(endpointInfo.URLPattern, endpointInfo.SEIClassname);
        }
        endpointBuilder = EndpointPublishService.createServiceBuilder(target, contextName, loader, hostName, map, null, null, null, attachments);
        controllers.add(endpointBuilder.setInitialMode(Mode.ACTIVE).install());
    }
    XTSHandlersService.install(target, isDefaultContextPropagation);
    // add an XTS service which depends on all the WS endpoints
    final XTSManagerService xtsService = new XTSManagerService(coordinatorURL);
    // this service needs to depend on the transaction recovery service
    // because it can only initialise XTS recovery once the transaction recovery
    // service has initialised the orb layer
    ServiceBuilder<?> xtsServiceBuilder = target.addService(XTSServices.JBOSS_XTS_MAIN, xtsService);
    xtsServiceBuilder.addDependency(TxnServices.JBOSS_TXN_ARJUNA_TRANSACTION_MANAGER);
    // this service needs to depend on JBossWS Config Service to be notified of the JBoss WS config (bind address, port etc)
    xtsServiceBuilder.addDependency(WSServices.CONFIG_SERVICE, ServerConfig.class, xtsService.getWSServerConfig());
    xtsServiceBuilder.addDependency(WSServices.XTS_CLIENT_INTEGRATION_SERVICE);
    // the service also needs to depend on the endpoint services
    for (ServiceController<Context> controller : controllers) {
        xtsServiceBuilder.addDependency(controller.getName());
    }
    xtsServiceBuilder.setInitialMode(Mode.ACTIVE).install();
    // WS-AT / JTA Transaction bridge services:
    final TxBridgeInboundRecoveryService txBridgeInboundRecoveryService = new TxBridgeInboundRecoveryService();
    ServiceBuilder<?> txBridgeInboundRecoveryServiceBuilder = target.addService(XTSServices.JBOSS_XTS_TXBRIDGE_INBOUND_RECOVERY, txBridgeInboundRecoveryService);
    txBridgeInboundRecoveryServiceBuilder.addDependency(XTSServices.JBOSS_XTS_MAIN);
    txBridgeInboundRecoveryServiceBuilder.setInitialMode(Mode.ACTIVE).install();
    final TxBridgeOutboundRecoveryService txBridgeOutboundRecoveryService = new TxBridgeOutboundRecoveryService();
    ServiceBuilder<?> txBridgeOutboundRecoveryServiceBuilder = target.addService(XTSServices.JBOSS_XTS_TXBRIDGE_OUTBOUND_RECOVERY, txBridgeOutboundRecoveryService);
    txBridgeOutboundRecoveryServiceBuilder.addDependency(XTSServices.JBOSS_XTS_MAIN);
    txBridgeOutboundRecoveryServiceBuilder.setInitialMode(Mode.ACTIVE).install();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ServiceController(org.jboss.msc.service.ServiceController) Context(org.jboss.wsf.spi.publish.Context) OperationContext(org.jboss.as.controller.OperationContext) ServiceTarget(org.jboss.msc.service.ServiceTarget) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ModelNode(org.jboss.dmr.ModelNode)

Example 5 with AbstractDeploymentChainStep

use of org.jboss.as.server.AbstractDeploymentChainStep 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(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, 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)23 DeploymentProcessorTarget (org.jboss.as.server.DeploymentProcessorTarget)23 ServiceTarget (org.jboss.msc.service.ServiceTarget)10 ModelNode (org.jboss.dmr.ModelNode)9 JBossAllXmlParserRegisteringProcessor (org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor)6 ServiceName (org.jboss.msc.service.ServiceName)5 PathHandler (io.undertow.server.handlers.PathHandler)2 Properties (java.util.Properties)2 TransactionManager (javax.transaction.TransactionManager)2 TransactionSynchronizationRegistry (javax.transaction.TransactionSynchronizationRegistry)2 UserTransaction (javax.transaction.UserTransaction)2 ModelController (org.jboss.as.controller.ModelController)2 OperationContext (org.jboss.as.controller.OperationContext)2 OperationFailedException (org.jboss.as.controller.OperationFailedException)2 AssociationService (org.jboss.as.ejb3.remote.AssociationService)2 BinderService (org.jboss.as.naming.service.BinderService)2 UserTransactionAccessControlService (org.jboss.as.txn.service.UserTransactionAccessControlService)2 File (java.io.File)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1