Search in sources :

Example 36 with DeploymentProcessorTarget

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

the class AppClientSubsystemAdd method performBoottime.

protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) throws OperationFailedException {
    final String deployment = AppClientSubsystemResourceDefinition.DEPLOYMENT.resolveModelAttribute(context, model).asString();
    final File file = new File(AppClientSubsystemResourceDefinition.FILE.resolveModelAttribute(context, model).asString());
    if (!file.exists()) {
        context.setRollbackOnly();
        throw AppClientLogger.ROOT_LOGGER.cannotFindAppClientFile(file.getAbsoluteFile());
    }
    final String hostUrl = model.hasDefined(HOST_URL) ? AppClientSubsystemResourceDefinition.HOST_URL.resolveModelAttribute(context, model).asString() : null;
    final String connectionPropertiesUrl = model.hasDefined(CONNECTION_PROPERTIES_URL) ? AppClientSubsystemResourceDefinition.CONNECTION_PROPERTIES_URL.resolveModelAttribute(context, model).asString() : null;
    final List<String> parameters = AppClientSubsystemResourceDefinition.PARAMETERS.unwrap(context, model);
    context.addStep(new AbstractDeploymentChainStep() {

        protected void execute(DeploymentProcessorTarget processorTarget) {
            if (deployment != null && !deployment.isEmpty()) {
                processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_APP_CLIENT, new ApplicationClientStructureProcessor(deployment));
            }
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_APPCLIENT, new JBossAllXmlParserRegisteringProcessor<>(AppClientJBossAllParser.ROOT_ELEMENT, AppClientJBossAllParser.ATTACHMENT_KEY, new AppClientJBossAllParser()));
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_APP_CLIENT_XML, new ApplicationClientParsingDeploymentProcessor());
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_APPLICATION_CLIENT_MANIFEST, new ApplicationClientManifestProcessor());
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_APPLICATION_CLIENT_ACTIVE, new ActiveApplicationClientProcessor(deployment));
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_APPLICATION_CLIENT, new ApplicationClientDependencyProcessor());
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_APPLICATION_CLIENT, new ApplicationClientStartProcessor(parameters.toArray(EMPTY_STRING)));
        }
    }, OperationContext.Stage.RUNTIME);
    final ApplicationClientDeploymentService service = new ApplicationClientDeploymentService(file);
    context.getServiceTarget().addService(ApplicationClientDeploymentService.SERVICE_NAME, service).addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getControllerValue()).install();
    try {
        if (connectionPropertiesUrl != null) {
            context.getServiceTarget().addService(APP_CLIENT_URI_SERVICE_NAME, new ConstantService<>(null)).install();
            context.getServiceTarget().addService(APP_CLIENT_EJB_PROPERTIES_SERVICE_NAME, new ConstantService<>(connectionPropertiesUrl)).install();
        } else {
            URI uri;
            if (hostUrl == null) {
                uri = new URI("remote+http://localhost:8080");
            } else {
                uri = new URI(hostUrl);
            }
            context.getServiceTarget().addService(APP_CLIENT_URI_SERVICE_NAME, new ConstantService<>(uri)).install();
            context.getServiceTarget().addService(APP_CLIENT_EJB_PROPERTIES_SERVICE_NAME, new ConstantService<>(connectionPropertiesUrl)).install();
        }
    } catch (URISyntaxException e) {
        throw new OperationFailedException(e);
    }
}
Also used : JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) ApplicationClientDependencyProcessor(org.jboss.as.appclient.deployment.ApplicationClientDependencyProcessor) OperationFailedException(org.jboss.as.controller.OperationFailedException) ApplicationClientDeploymentService(org.jboss.as.appclient.service.ApplicationClientDeploymentService) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) ApplicationClientStartProcessor(org.jboss.as.appclient.deployment.ApplicationClientStartProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ActiveApplicationClientProcessor(org.jboss.as.appclient.deployment.ActiveApplicationClientProcessor) ApplicationClientStructureProcessor(org.jboss.as.appclient.deployment.ApplicationClientStructureProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ApplicationClientManifestProcessor(org.jboss.as.appclient.deployment.ApplicationClientManifestProcessor) ModelController(org.jboss.as.controller.ModelController) File(java.io.File) AppClientJBossAllParser(org.jboss.as.appclient.deployment.AppClientJBossAllParser) ApplicationClientParsingDeploymentProcessor(org.jboss.as.appclient.deployment.ApplicationClientParsingDeploymentProcessor)

Example 37 with DeploymentProcessorTarget

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

the class DataSourcesSubsystemAdd method performBoottime.

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

        protected void execute(DeploymentProcessorTarget processorTarget) {
            dsDeploymentActivator.activateProcessors(processorTarget);
            processorTarget.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_DATASOURCE_RESOURCE_INJECTION, new DefaultDataSourceResourceReferenceProcessor());
            processorTarget.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_DEFAULT_BINDINGS_DATASOURCE, new DefaultDataSourceBindingProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
}
Also used : DsDeploymentActivator(org.jboss.as.connector.deployers.ds.DsDeploymentActivator) DefaultDataSourceBindingProcessor(org.jboss.as.connector.deployers.datasource.DefaultDataSourceBindingProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) DefaultDataSourceResourceReferenceProcessor(org.jboss.as.connector.deployers.datasource.DefaultDataSourceResourceReferenceProcessor)

Example 38 with DeploymentProcessorTarget

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

the class NamingSubsystemAdd method performBoottime.

@SuppressWarnings("deprecation")
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) {
    ROOT_LOGGER.activatingSubsystem();
    NamingContext.initializeNamingManager();
    final ServiceTarget target = context.getServiceTarget();
    // Create the java: namespace
    target.addService(ContextNames.JAVA_CONTEXT_SERVICE_NAME, new NamingStoreService()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    // Create the Naming Service
    final NamingService namingService = new NamingService();
    target.addService(Capability.NAMING_STORE.getDefinition().getCapabilityServiceName(), namingService).addAliases(NamingService.SERVICE_NAME).addDependency(ContextNames.JAVA_CONTEXT_SERVICE_NAME, NamingStore.class, namingService.getNamingStore()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    // Create the java:global namespace
    target.addService(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME, new NamingStoreService()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    // Create the java:jboss vendor namespace
    target.addService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, new NamingStoreService()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    // Setup remote naming store
    // we always install the naming store, but we don't install the server unless it has been explicitly enabled
    target.addService(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, new NamingStoreService()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    // add the default namespace context selector service
    DefaultNamespaceContextSelectorService defaultNamespaceContextSelectorService = new DefaultNamespaceContextSelectorService();
    target.addService(DefaultNamespaceContextSelectorService.SERVICE_NAME, defaultNamespaceContextSelectorService).addDependency(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME, NamingStore.class, defaultNamespaceContextSelectorService.getGlobalNamingStore()).addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, NamingStore.class, defaultNamespaceContextSelectorService.getJbossNamingStore()).addDependency(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, NamingStore.class, defaultNamespaceContextSelectorService.getRemoteExposedNamingStore()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    target.addService(JndiViewExtensionRegistry.SERVICE_NAME, new JndiViewExtensionRegistry()).install();
    // create the subsystem's external context instance, and install related Service and DUP
    final ExternalContexts externalContexts = new ExternalContextsNavigableSet();
    target.addService(ExternalContextsService.SERVICE_NAME, new ExternalContextsService(externalContexts)).install();
    context.addStep(new AbstractDeploymentChainStep() {

        @Override
        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(NamingExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_NAMING_EXTERNAL_CONTEXTS, new ExternalContextsProcessor(externalContexts));
            processorTarget.addDeploymentProcessor(NamingExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_JNDI_DEPENDENCIES, new JndiNamingDependencyProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
    if (context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, NamingService.CAPABILITY_NAME, null)) {
        HttpRemoteNamingServerService httpRemoteNamingServerService = new HttpRemoteNamingServerService();
        context.getServiceTarget().addService(HttpRemoteNamingServerService.SERVICE_NAME, httpRemoteNamingServerService).addDependency(context.getCapabilityServiceName(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, PathHandler.class), PathHandler.class, httpRemoteNamingServerService.getPathHandlerInjectedValue()).addDependency(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, NamingStore.class, httpRemoteNamingServerService.getNamingStore()).install();
    }
}
Also used : NamingStore(org.jboss.as.naming.NamingStore) ExternalContextsProcessor(org.jboss.as.naming.deployment.ExternalContextsProcessor) HttpRemoteNamingServerService(org.jboss.as.naming.remote.HttpRemoteNamingServerService) ServiceTarget(org.jboss.msc.service.ServiceTarget) PathHandler(io.undertow.server.handlers.PathHandler) DefaultNamespaceContextSelectorService(org.jboss.as.naming.service.DefaultNamespaceContextSelectorService) ExternalContextsNavigableSet(org.jboss.as.naming.context.external.ExternalContextsNavigableSet) NamingStoreService(org.jboss.as.naming.service.NamingStoreService) JndiViewExtensionRegistry(org.jboss.as.naming.management.JndiViewExtensionRegistry) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) NamingService(org.jboss.as.naming.service.NamingService) ExternalContexts(org.jboss.as.naming.context.external.ExternalContexts) ExternalContextsService(org.jboss.as.naming.service.ExternalContextsService) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) JndiNamingDependencyProcessor(org.jboss.as.naming.deployment.JndiNamingDependencyProcessor)

Example 39 with DeploymentProcessorTarget

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

the class OpenTelemetrySubsystemAdd method performBoottime.

/**
 * {@inheritDoc}
 */
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    super.performBoottime(context, operation, model);
    final OpenTelemetryConfig config = OpenTelemetryConfigBuilder.config().withServiceName(OpenTelemetrySubsystemDefinition.SERVICE_NAME.resolveModelAttribute(context, model).asStringOrNull()).withExporter(OpenTelemetrySubsystemDefinition.EXPORTER.resolveModelAttribute(context, model).asString()).withEndpoint(OpenTelemetrySubsystemDefinition.ENDPOINT.resolveModelAttribute(context, model).asStringOrNull()).withSpanProcessor(OpenTelemetrySubsystemDefinition.SPAN_PROCESSOR_TYPE.resolveModelAttribute(context, model).asString()).withBatchDelay(OpenTelemetrySubsystemDefinition.BATCH_DELAY.resolveModelAttribute(context, model).asLong()).withMaxQueueSize(OpenTelemetrySubsystemDefinition.MAX_QUEUE_SIZE.resolveModelAttribute(context, model).asInt()).withMaxExportBatchSize(OpenTelemetrySubsystemDefinition.MAX_EXPORT_BATCH_SIZE.resolveModelAttribute(context, model).asInt()).withExportTimeout(OpenTelemetrySubsystemDefinition.EXPORT_TIMEOUT.resolveModelAttribute(context, model).asLong()).withSampler(OpenTelemetrySubsystemDefinition.SAMPLER.resolveModelAttribute(context, model).asStringOrNull()).withRatio(OpenTelemetrySubsystemDefinition.RATIO.resolveModelAttribute(context, model).asDoubleOrNull()).build();
    final OpenTelemetryHolder holder = new OpenTelemetryHolder(config);
    context.addStep(new AbstractDeploymentChainStep() {

        @Override
        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(OpenTelemetrySubsystemExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, 0x1910, new OpenTelemetryDependencyProcessor());
            processorTarget.addDeploymentProcessor(OpenTelemetrySubsystemExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, 0x3810, new OpenTelemetrySubsystemDeploymentProcessor(holder));
        }
    }, OperationContext.Stage.RUNTIME);
}
Also used : OpenTelemetrySubsystemDeploymentProcessor(org.wildfly.extension.opentelemetry.deployment.OpenTelemetrySubsystemDeploymentProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) OpenTelemetryDependencyProcessor(org.wildfly.extension.opentelemetry.deployment.OpenTelemetryDependencyProcessor)

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