Search in sources :

Example 11 with DeploymentProcessorTarget

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

the class MicroProfileMetricsSubsystemAdd method performBoottime.

@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    super.performBoottime(context, operation, model);
    final List<String> exposedSubsystems = MicroProfileMetricsSubsystemDefinition.EXPOSED_SUBSYSTEMS.unwrap(context, model);
    final boolean exposeAnySubsystem = exposedSubsystems.remove("*");
    final String prefix = MicroProfileMetricsSubsystemDefinition.PREFIX.resolveModelAttribute(context, model).asStringOrNull();
    final boolean securityEnabled = MicroProfileMetricsSubsystemDefinition.SECURITY_ENABLED.resolveModelAttribute(context, model).asBoolean();
    context.addStep(new AbstractDeploymentChainStep() {

        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(SUBSYSTEM_NAME, DEPENDENCIES, DEPENDENCIES_MICROPROFILE_METRICS, new DependencyProcessor());
            processorTarget.addDeploymentProcessor(SUBSYSTEM_NAME, INSTALL, POST_MODULE_MICROPROFILE_METRICS, new DeploymentMetricProcessor(exposeAnySubsystem, exposedSubsystems, prefix));
        }
    }, RUNTIME);
    MetricsHTTTPSecurityService.install(context, securityEnabled);
    final MicroProfileVendorMetricRegistry vendorMetricRegistry = new MicroProfileVendorMetricRegistry();
    MicroProfileMetricsContextService.install(context, vendorMetricRegistry);
    // delay the registration of the metrics in the VERIFY stage so that all resources
    // created during the RUNTIME phase will have been registered in the MRR.
    context.addStep(new OperationStepHandler() {

        @Override
        public void execute(OperationContext operationContext, ModelNode modelNode) {
            ServiceController<?> serviceController = context.getServiceRegistry(false).getService(WILDFLY_COLLECTOR);
            MetricCollector metricCollector = MetricCollector.class.cast(serviceController.getValue());
            ImmutableManagementResourceRegistration rootResourceRegistration = context.getRootResourceRegistration();
            Resource rootResource = context.readResourceFromRoot(EMPTY_ADDRESS);
            MetricRegistration registration = new MetricRegistration(vendorMetricRegistry);
            metricCollector.collectResourceMetrics(rootResource, rootResourceRegistration, Function.identity(), exposeAnySubsystem, exposedSubsystems, prefix, registration);
            JmxRegistrar jmxRegistrar = new JmxRegistrar();
            try {
                jmxRegistrar.init();
            } catch (IOException e) {
                throw LOGGER.failedInitializeJMXRegistrar(e);
            }
        }
    }, VERIFY);
    MicroProfileMetricsLogger.LOGGER.activatingSubsystem();
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) Resource(org.jboss.as.controller.registry.Resource) IOException(java.io.IOException) MetricRegistration(org.wildfly.extension.metrics.MetricRegistration) DependencyProcessor(org.wildfly.extension.microprofile.metrics.deployment.DependencyProcessor) DeploymentMetricProcessor(org.wildfly.extension.microprofile.metrics.deployment.DeploymentMetricProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) MetricCollector(org.wildfly.extension.metrics.MetricCollector) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ServiceController(org.jboss.msc.service.ServiceController) ImmutableManagementResourceRegistration(org.jboss.as.controller.registry.ImmutableManagementResourceRegistration) JmxRegistrar(io.smallrye.metrics.setup.JmxRegistrar) ModelNode(org.jboss.dmr.ModelNode)

Example 12 with DeploymentProcessorTarget

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

the class MicroProfileHealthSubsystemAdd method performBoottime.

@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    super.performBoottime(context, operation, model);
    context.addStep(new AbstractDeploymentChainStep() {

        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(MicroProfileHealthExtension.SUBSYSTEM_NAME, DEPENDENCIES, DEPENDENCIES_MICROPROFILE_HEALTH, new DependencyProcessor());
            processorTarget.addDeploymentProcessor(MicroProfileHealthExtension.SUBSYSTEM_NAME, POST_MODULE, POST_MODULE_MICROPROFILE_HEALTH, new DeploymentProcessor());
        }
    }, RUNTIME);
    final boolean securityEnabled = MicroProfileHealthSubsystemDefinition.SECURITY_ENABLED.resolveModelAttribute(context, model).asBoolean();
    final String emptyLivenessChecksStatus = MicroProfileHealthSubsystemDefinition.EMPTY_LIVENESS_CHECKS_STATUS.resolveModelAttribute(context, model).asString();
    final String emptyReadinessChecksStatus = MicroProfileHealthSubsystemDefinition.EMPTY_READINESS_CHECKS_STATUS.resolveModelAttribute(context, model).asString();
    final String emptyStartupChecksStatus = MicroProfileHealthSubsystemDefinition.EMPTY_STARTUP_CHECKS_STATUS.resolveModelAttribute(context, model).asString();
    HealthHTTPSecurityService.install(context, securityEnabled);
    MicroProfileHealthReporterService.install(context, emptyLivenessChecksStatus, emptyReadinessChecksStatus, emptyStartupChecksStatus);
    MicroProfileHealthContextService.install(context);
    MicroProfileHealthLogger.LOGGER.activatingSubsystem();
}
Also used : DependencyProcessor(org.wildfly.extension.microprofile.health.deployment.DependencyProcessor) DeploymentProcessor(org.wildfly.extension.microprofile.health.deployment.DeploymentProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep)

Example 13 with DeploymentProcessorTarget

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

the class IIOPSubsystemAdd method launchServices.

protected void launchServices(final OperationContext context, final ModelNode model) throws OperationFailedException {
    IIOPLogger.ROOT_LOGGER.activatingSubsystem();
    // set the ORBUseDynamicStub system property.
    WildFlySecurityManager.setPropertyPrivileged("org.jboss.com.sun.CORBA.ORBUseDynamicStub", "true");
    // we set the same stub factory to both the static and dynamic stub factory. As there is no way to dynamically change
    // the userDynamicStubs's property at runtime it is possible for the ORB class's <clinit> method to be
    // called before this property is set.
    // TODO: investigate a better way to handle this
    com.sun.corba.se.spi.orb.ORB.getPresentationManager().setStubFactoryFactory(true, new DelegatingStubFactoryFactory());
    com.sun.corba.se.spi.orb.ORB.getPresentationManager().setStubFactoryFactory(false, new DelegatingStubFactoryFactory());
    // setup naming.
    InitialContext.addUrlContextFactory("corbaloc", JBossCNCtxFactory.INSTANCE);
    InitialContext.addUrlContextFactory("corbaname", JBossCNCtxFactory.INSTANCE);
    InitialContext.addUrlContextFactory("IOR", JBossCNCtxFactory.INSTANCE);
    InitialContext.addUrlContextFactory("iiopname", JBossCNCtxFactory.INSTANCE);
    InitialContext.addUrlContextFactory("iiop", JBossCNCtxFactory.INSTANCE);
    context.addStep(new AbstractDeploymentChainStep() {

        @Override
        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(IIOPExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_IIOP_OPENJDK, new IIOPDependencyProcessor());
            processorTarget.addDeploymentProcessor(IIOPExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_IIOP_OPENJDK, new IIOPMarkerProcessor());
            processorTarget.addDeploymentProcessor(IIOPExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_IIOP_CLEAR_CACHES, new IIOPClearCachesProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
    // get the configured ORB properties.
    Properties props = this.getConfigurationProperties(context, model);
    // setup the ORB initializers using the configured properties.
    this.setupInitializers(props);
    // setup the SSL socket factories, if necessary.
    final boolean sslConfigured = this.setupSSLFactories(props);
    // create the service that initializes and starts the CORBA ORB.
    CorbaORBService orbService = new CorbaORBService(props);
    final ServiceBuilder<ORB> builder = context.getServiceTarget().addService(CorbaORBService.SERVICE_NAME, orbService);
    org.jboss.as.server.Services.addServerExecutorDependency(builder, orbService.getExecutorInjector());
    // if a security domain has been specified, add a dependency to the domain service.
    String securityDomain = props.getProperty(Constants.SECURITY_SECURITY_DOMAIN);
    if (securityDomain != null) {
        builder.requires(context.getCapabilityServiceName(Capabilities.LEGACY_SECURITY_DOMAIN_CAPABILITY, securityDomain, null));
        builder.requires(DefaultNamespaceContextSelectorService.SERVICE_NAME);
    }
    // add dependencies to the ssl context services if needed.
    final String serverSSLContextName = props.getProperty(Constants.SERVER_SSL_CONTEXT);
    if (serverSSLContextName != null) {
        ServiceName serverContextServiceName = context.getCapabilityServiceName(Capabilities.SSL_CONTEXT_CAPABILITY, serverSSLContextName, SSLContext.class);
        builder.requires(serverContextServiceName);
    }
    final String clientSSLContextName = props.getProperty(Constants.CLIENT_SSL_CONTEXT);
    if (clientSSLContextName != null) {
        ServiceName clientContextServiceName = context.getCapabilityServiceName(Capabilities.SSL_CONTEXT_CAPABILITY, clientSSLContextName, SSLContext.class);
        builder.requires(clientContextServiceName);
    }
    // if an authentication context has ben specified, add a dependency to its service.
    final String authContext = props.getProperty(Constants.ORB_INIT_AUTH_CONTEXT);
    if (authContext != null) {
        ServiceName authContextServiceName = context.getCapabilityServiceName(Capabilities.AUTH_CONTEXT_CAPABILITY, authContext, AuthenticationContext.class);
        builder.requires(authContextServiceName);
    }
    final boolean serverRequiresSsl = IIOPRootDefinition.SERVER_REQUIRES_SSL.resolveModelAttribute(context, model).asBoolean();
    // inject the socket bindings that specify IIOP and IIOP/SSL ports.
    String socketBinding = props.getProperty(Constants.ORB_SOCKET_BINDING);
    if (socketBinding != null) {
        if (!serverRequiresSsl) {
            builder.addDependency(SocketBinding.JBOSS_BINDING_NAME.append(socketBinding), SocketBinding.class, orbService.getIIOPSocketBindingInjector());
        } else {
            IIOPLogger.ROOT_LOGGER.wontUseCleartextSocket();
        }
    }
    String sslSocketBinding = props.getProperty(Constants.ORB_SSL_SOCKET_BINDING);
    if (sslSocketBinding != null) {
        builder.addDependency(SocketBinding.JBOSS_BINDING_NAME.append(sslSocketBinding), SocketBinding.class, orbService.getIIOPSSLSocketBindingInjector());
    }
    // create the IOR security config metadata service.
    final IORSecurityConfigMetaData securityConfigMetaData = this.createIORSecurityConfigMetaData(context, model, sslConfigured, serverRequiresSsl);
    final IORSecConfigMetaDataService securityConfigMetaDataService = new IORSecConfigMetaDataService(securityConfigMetaData);
    context.getServiceTarget().addService(IORSecConfigMetaDataService.SERVICE_NAME, securityConfigMetaDataService).setInitialMode(ServiceController.Mode.ACTIVE).install();
    builder.requires(IORSecConfigMetaDataService.SERVICE_NAME);
    // set the initial mode and install the service.
    builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    // create the service the initializes the Root POA.
    CorbaPOAService rootPOAService = new CorbaPOAService("RootPOA", "poa", serverRequiresSsl);
    context.getServiceTarget().addService(CorbaPOAService.ROOT_SERVICE_NAME, rootPOAService).addDependency(CorbaORBService.SERVICE_NAME, ORB.class, rootPOAService.getORBInjector()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    // create the service the initializes the interface repository POA.
    final CorbaPOAService irPOAService = new CorbaPOAService("IRPOA", "irpoa", serverRequiresSsl, IdAssignmentPolicyValue.USER_ID, null, null, LifespanPolicyValue.PERSISTENT, null, null, null);
    context.getServiceTarget().addService(CorbaPOAService.INTERFACE_REPOSITORY_SERVICE_NAME, irPOAService).addDependency(CorbaPOAService.ROOT_SERVICE_NAME, POA.class, irPOAService.getParentPOAInjector()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    // create the service that initializes the naming service POA.
    final CorbaPOAService namingPOAService = new CorbaPOAService("Naming", null, serverRequiresSsl, IdAssignmentPolicyValue.USER_ID, null, null, LifespanPolicyValue.PERSISTENT, null, null, null);
    context.getServiceTarget().addService(CorbaPOAService.SERVICE_NAME.append("namingpoa"), namingPOAService).addDependency(CorbaPOAService.ROOT_SERVICE_NAME, POA.class, namingPOAService.getParentPOAInjector()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    // create the CORBA naming service.
    final CorbaNamingService namingService = new CorbaNamingService(props);
    context.getServiceTarget().addService(CorbaNamingService.SERVICE_NAME, namingService).addDependency(CorbaORBService.SERVICE_NAME, ORB.class, namingService.getORBInjector()).addDependency(CorbaPOAService.ROOT_SERVICE_NAME, POA.class, namingService.getRootPOAInjector()).addDependency(CorbaPOAService.SERVICE_NAME.append("namingpoa"), POA.class, namingService.getNamingPOAInjector()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    configureClientSecurity(props);
}
Also used : CorbaNamingService(org.wildfly.iiop.openjdk.service.CorbaNamingService) IIOPDependencyProcessor(org.wildfly.iiop.openjdk.deployment.IIOPDependencyProcessor) CorbaORBService(org.wildfly.iiop.openjdk.service.CorbaORBService) POA(org.omg.PortableServer.POA) IIOPMarkerProcessor(org.wildfly.iiop.openjdk.deployment.IIOPMarkerProcessor) CorbaPOAService(org.wildfly.iiop.openjdk.service.CorbaPOAService) Properties(java.util.Properties) IIOPClearCachesProcessor(org.wildfly.iiop.openjdk.deployment.IIOPClearCachesProcessor) IORSecurityConfigMetaData(org.jboss.metadata.ejb.jboss.IORSecurityConfigMetaData) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ServiceName(org.jboss.msc.service.ServiceName) IORSecConfigMetaDataService(org.wildfly.iiop.openjdk.service.IORSecConfigMetaDataService) DelegatingStubFactoryFactory(org.wildfly.iiop.openjdk.rmi.DelegatingStubFactoryFactory) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ORB(org.omg.CORBA.ORB)

Example 14 with DeploymentProcessorTarget

use of org.jboss.as.server.DeploymentProcessorTarget 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;
    final boolean obfuscateSessionRoute = UndertowRootDefinition.OBFUSCATE_SESSION_ROUTE.resolveModelAttribute(context, model).asBoolean();
    // we clear provider on system boot, as on reload it could cause issues.
    DefaultDeploymentMappingProvider.instance().clear();
    final CapabilityServiceBuilder<?> csb = context.getCapabilityServiceTarget().addCapability(UndertowRootDefinition.UNDERTOW_CAPABILITY);
    final Consumer<UndertowService> usConsumer = csb.provides(UndertowRootDefinition.UNDERTOW_CAPABILITY, UndertowService.UNDERTOW);
    csb.setInstance(new UndertowService(usConsumer, defaultContainer, defaultServer, defaultVirtualHost, instanceId, obfuscateSessionRoute, stats));
    csb.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());
            JBossAllXmlParserRegisteringProcessor.Builder builder = JBossAllXmlParserRegisteringProcessor.builder();
            for (SharedSessionConfigSchema schema : EnumSet.allOf(SharedSessionConfigSchema.class)) {
                builder.addParser(schema.getRoot(), SharedSessionManagerConfig.ATTACHMENT_KEY, new SharedSessionConfigParser(schema));
            }
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_UNDERTOW_SHARED_SESSION, builder.build());
            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());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_TLD_DEPLOYMENT, new TldParsingDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WEB_COMPONENTS, new org.wildfly.extension.undertow.deployment.WebComponentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_UNDERTOW_DEFAULT_SECURITY_DOMAIN, new DefaultSecurityDomainProcessor(defaultSecurityDomain));
            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());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EXTERNAL_TAGLIB, new ExternalTldParsingDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_UNDERTOW_SERVLET_CONTAINER_DEPENDENCY, new UndertowServletContainerDependencyProcessor(defaultContainer));
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_SHARED_SESSION_MANAGER, new SharedSessionManagerDeploymentProcessor(defaultServer));
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_SERVLET_INIT_DEPLOYMENT, new ServletContainerInitializerDeploymentProcessor());
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_WEB_RESOLVE_SECURITY_DOMAIN, new SecurityDomainResolvingProcessor(defaultSecurityDomain, knownSecurityDomain));
            processorTarget.addDeploymentProcessor(UndertowExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT, new UndertowDeploymentProcessor(defaultVirtualHost, defaultContainer, defaultServer, knownSecurityDomain));
        }
    }, OperationContext.Stage.RUNTIME);
    context.getCapabilityServiceTarget().addCapability(HTTP_INVOKER_RUNTIME_CAPABILITY).setInstance(new RemoteHttpInvokerService()).install();
}
Also used : UndertowHandlersDeploymentProcessor(org.wildfly.extension.undertow.deployment.UndertowHandlersDeploymentProcessor) SecurityDomainResolvingProcessor(org.wildfly.extension.undertow.deployment.SecurityDomainResolvingProcessor) SharedTldsMetaDataBuilder(org.jboss.as.web.common.SharedTldsMetaDataBuilder) CapabilityServiceBuilder(org.jboss.as.controller.CapabilityServiceBuilder) WebJBossAllParser(org.wildfly.extension.undertow.deployment.WebJBossAllParser) UndertowDeploymentProcessor(org.wildfly.extension.undertow.deployment.UndertowDeploymentProcessor) UndertowServletContainerDependencyProcessor(org.wildfly.extension.undertow.deployment.UndertowServletContainerDependencyProcessor) ServletContainerInitializerDeploymentProcessor(org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor) DefaultSecurityDomainProcessor(org.wildfly.extension.undertow.deployment.DefaultSecurityDomainProcessor) 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) SharedSessionConfigParser(org.wildfly.extension.undertow.session.SharedSessionConfigParser) WarStructureDeploymentProcessor(org.wildfly.extension.undertow.deployment.WarStructureDeploymentProcessor) JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) EarContextRootProcessor(org.wildfly.extension.undertow.deployment.EarContextRootProcessor) 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) SharedSessionConfigSchema(org.wildfly.extension.undertow.session.SharedSessionConfigSchema)

Example 15 with DeploymentProcessorTarget

use of org.jboss.as.server.DeploymentProcessorTarget 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;
    // formatting possible IPv6 address to contain square brackets
    if (coordinatorURL != null) {
        // [1] http://, [2] ::1, [3] 8080, [4] /ws-c11/ActivationService
        Pattern urlPattern = Pattern.compile("^([a-zA-Z]+://)(.*):([^/]*)(/.*)$");
        Matcher urlMatcher = urlPattern.matcher(coordinatorURL);
        if (urlMatcher.matches()) {
            String address = NetworkUtils.formatPossibleIpv6Address(urlMatcher.group(2));
            coordinatorURL = String.format("%s%s:%s%s", urlMatcher.group(1), address, urlMatcher.group(3), urlMatcher.group(4));
        }
    }
    if (coordinatorURL != null) {
        XtsAsLogger.ROOT_LOGGER.debugf("nodeIdentifier=%s%n", coordinatorURL);
    }
    // TODO WFLY-14350 make the 'false' the default value of DEFAULT_CONTEXT_PROPAGATION
    final boolean isDefaultContextPropagation = DEFAULT_CONTEXT_PROPAGATION.resolveModelAttribute(context, model).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());
            processorTarget.addDeploymentProcessor(XTSExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_TRANSACTIONS, new CompensationsDependenciesDeploymentProcessor());
        }
    }, 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 : getContextDefinitions(context, model)) {
        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, context.getCapabilityServiceSupport());
        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.requires(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.requires(WSServices.XTS_CLIENT_INTEGRATION_SERVICE);
    // the service also needs to depend on the endpoint services
    for (ServiceController<Context> controller : controllers) {
        xtsServiceBuilder.requires(controller.getName());
    }
    xtsServiceBuilder.setInitialMode(Mode.ACTIVE).install();
    // WS-AT / Jakarta Transactions Transaction bridge services:
    final TxBridgeInboundRecoveryService txBridgeInboundRecoveryService = new TxBridgeInboundRecoveryService();
    ServiceBuilder<?> txBridgeInboundRecoveryServiceBuilder = target.addService(XTSServices.JBOSS_XTS_TXBRIDGE_INBOUND_RECOVERY, txBridgeInboundRecoveryService);
    txBridgeInboundRecoveryServiceBuilder.requires(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.requires(XTSServices.JBOSS_XTS_MAIN);
    txBridgeOutboundRecoveryServiceBuilder.setInitialMode(Mode.ACTIVE).install();
}
Also used : Matcher(java.util.regex.Matcher) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ServiceController(org.jboss.msc.service.ServiceController) CompensationsDependenciesDeploymentProcessor(org.jboss.as.compensations.CompensationsDependenciesDeploymentProcessor) Context(org.jboss.wsf.spi.publish.Context) OperationContext(org.jboss.as.controller.OperationContext) Pattern(java.util.regex.Pattern) ServiceTarget(org.jboss.msc.service.ServiceTarget) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ModelNode(org.jboss.dmr.ModelNode)

Aggregations

AbstractDeploymentChainStep (org.jboss.as.server.AbstractDeploymentChainStep)39 DeploymentProcessorTarget (org.jboss.as.server.DeploymentProcessorTarget)39 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