Search in sources :

Example 1 with SharedSessionConfigSchema

use of org.wildfly.extension.undertow.session.SharedSessionConfigSchema 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)

Aggregations

CapabilityServiceBuilder (org.jboss.as.controller.CapabilityServiceBuilder)1 AbstractDeploymentChainStep (org.jboss.as.server.AbstractDeploymentChainStep)1 DeploymentProcessorTarget (org.jboss.as.server.DeploymentProcessorTarget)1 JBossAllXmlParserRegisteringProcessor (org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor)1 SharedTldsMetaDataBuilder (org.jboss.as.web.common.SharedTldsMetaDataBuilder)1 ModelNode (org.jboss.dmr.ModelNode)1 DefaultSecurityDomainProcessor (org.wildfly.extension.undertow.deployment.DefaultSecurityDomainProcessor)1 DeploymentRootExplodedMountProcessor (org.wildfly.extension.undertow.deployment.DeploymentRootExplodedMountProcessor)1 EarContextRootProcessor (org.wildfly.extension.undertow.deployment.EarContextRootProcessor)1 ExternalTldParsingDeploymentProcessor (org.wildfly.extension.undertow.deployment.ExternalTldParsingDeploymentProcessor)1 JBossWebParsingDeploymentProcessor (org.wildfly.extension.undertow.deployment.JBossWebParsingDeploymentProcessor)1 SecurityDomainResolvingProcessor (org.wildfly.extension.undertow.deployment.SecurityDomainResolvingProcessor)1 ServletContainerInitializerDeploymentProcessor (org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor)1 SharedSessionManagerDeploymentProcessor (org.wildfly.extension.undertow.deployment.SharedSessionManagerDeploymentProcessor)1 TldParsingDeploymentProcessor (org.wildfly.extension.undertow.deployment.TldParsingDeploymentProcessor)1 UndertowDependencyProcessor (org.wildfly.extension.undertow.deployment.UndertowDependencyProcessor)1 UndertowDeploymentProcessor (org.wildfly.extension.undertow.deployment.UndertowDeploymentProcessor)1 UndertowHandlersDeploymentProcessor (org.wildfly.extension.undertow.deployment.UndertowHandlersDeploymentProcessor)1 UndertowJSRWebSocketDeploymentProcessor (org.wildfly.extension.undertow.deployment.UndertowJSRWebSocketDeploymentProcessor)1 UndertowServletContainerDependencyProcessor (org.wildfly.extension.undertow.deployment.UndertowServletContainerDependencyProcessor)1