Search in sources :

Example 31 with DeploymentProcessorTarget

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

the class JSR77ManagementSubsystemAdd method performBoottime.

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

        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(JSR77ManagementExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_JSR77, new Jsr77DependenciesProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
    final boolean appclient = context.getProcessType() == ProcessType.APPLICATION_CLIENT;
    if (!appclient) {
        context.addStep(new OperationStepHandler() {

            @Override
            public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                ServiceTarget target = context.getServiceTarget();
                ServiceName mbeanServerServiceName = context.getCapabilityServiceName(JSR77ManagementRootResource.JMX_CAPABILITY, MBeanServer.class);
                RegisterMBeanServerDelegateService mbeanServerService = new RegisterMBeanServerDelegateService();
                target.addService(RegisterMBeanServerDelegateService.SERVICE_NAME, mbeanServerService).addDependency(mbeanServerServiceName, PluggableMBeanServer.class, mbeanServerService.injectedMbeanServer).addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, mbeanServerService.injectedController).setInitialMode(Mode.ACTIVE).install();
                RegisterManagementEJBService managementEjbService = new RegisterManagementEJBService();
                target.addService(RegisterManagementEJBService.SERVICE_NAME, managementEjbService).addDependency(DeploymentRepositoryService.SERVICE_NAME, DeploymentRepository.class, managementEjbService.deploymentRepositoryValue).addDependency(mbeanServerServiceName, MBeanServer.class, managementEjbService.mbeanServerValue).addDependency(EJBClientContextService.DEFAULT_SERVICE_NAME, EJBClientContextService.class, managementEjbService.ejbClientContextValue).addDependency(AssociationService.SERVICE_NAME, AssociationService.class, managementEjbService.associationServiceInjector).setInitialMode(Mode.PASSIVE).install();
                // TODO null for source ok?
                final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(JNDI_NAME);
                final BinderService binderService = new BinderService(bindInfo.getBindName(), null);
                final InjectedValue<ClassLoader> viewClassLoader = new InjectedValue<ClassLoader>();
                binderService.getManagedObjectInjector().inject(new RemoteViewManagedReferenceFactory(APP_NAME, MODULE_NAME, DISTINCT_NAME, EJB_NAME, ManagementHome.class.getName(), false, viewClassLoader, appclient));
                viewClassLoader.setValue(Values.immediateValue(ManagementHome.class.getClassLoader()));
                target.addService(bindInfo.getBinderServiceName(), binderService).addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).install();
                // Rollback is handled by the parent step
                context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
            }
        }, Stage.RUNTIME);
    }
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) InjectedValue(org.jboss.msc.value.InjectedValue) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) ServiceTarget(org.jboss.msc.service.ServiceTarget) OperationFailedException(org.jboss.as.controller.OperationFailedException) RemoteViewManagedReferenceFactory(org.jboss.as.ejb3.remote.RemoteViewManagedReferenceFactory) AssociationService(org.jboss.as.ejb3.remote.AssociationService) BinderService(org.jboss.as.naming.service.BinderService) ManagementHome(javax.management.j2ee.ManagementHome) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ServiceName(org.jboss.msc.service.ServiceName) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ModelNode(org.jboss.dmr.ModelNode) ModelController(org.jboss.as.controller.ModelController) PluggableMBeanServer(org.jboss.as.server.jmx.PluggableMBeanServer) MBeanServer(javax.management.MBeanServer)

Example 32 with DeploymentProcessorTarget

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

the class MetricsSubsystemAdd method performBoottime.

@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    super.performBoottime(context, operation, model);
    List<String> exposedSubsystems = MetricsSubsystemDefinition.EXPOSED_SUBSYSTEMS.unwrap(context, model);
    boolean exposeAnySubsystem = exposedSubsystems.remove("*");
    String prefix = MetricsSubsystemDefinition.PREFIX.resolveModelAttribute(context, model).asStringOrNull();
    boolean securityEnabled = MetricsSubsystemDefinition.SECURITY_ENABLED.resolveModelAttribute(context, model).asBoolean();
    WildFlyMetricRegistryService.install(context);
    MetricsCollectorService.install(context);
    MetricsContextService.install(context, securityEnabled);
    // handles that instead.
    if (!context.getCapabilityServiceSupport().hasCapability(MetricsSubsystemDefinition.METRICS_SCAN_CAPABILITY)) {
        context.addStep(new AbstractDeploymentChainStep() {

            public void execute(DeploymentProcessorTarget processorTarget) {
                processorTarget.addDeploymentProcessor(SUBSYSTEM_NAME, INSTALL, POST_MODULE_METRICS, new DeploymentMetricProcessor(exposeAnySubsystem, exposedSubsystems, prefix));
            }
        }, RUNTIME);
        // 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());
                ServiceController<?> wildflyRegistryController = context.getServiceRegistry(false).getService(METRICS_REGISTRY_RUNTIME_CAPABILITY.getCapabilityServiceName());
                WildFlyMetricRegistry metricRegistry = WildFlyMetricRegistry.class.cast(wildflyRegistryController.getValue());
                ImmutableManagementResourceRegistration rootResourceRegistration = context.getRootResourceRegistration();
                Resource rootResource = context.readResourceFromRoot(EMPTY_ADDRESS);
                MetricRegistration registration = new MetricRegistration(metricRegistry);
                metricCollector.collectResourceMetrics(rootResource, rootResourceRegistration, Function.identity(), exposeAnySubsystem, exposedSubsystems, prefix, registration);
            }
        }, VERIFY);
    }
    LOGGER.activatingSubsystem();
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) Resource(org.jboss.as.controller.registry.Resource) DeploymentMetricProcessor(org.wildfly.extension.metrics.deployment.DeploymentMetricProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ServiceController(org.jboss.msc.service.ServiceController) ImmutableManagementResourceRegistration(org.jboss.as.controller.registry.ImmutableManagementResourceRegistration) ModelNode(org.jboss.dmr.ModelNode)

Example 33 with DeploymentProcessorTarget

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

the class MicroProfileConfigSubsystemAdd method performBoottime.

/**
 * {@inheritDoc}
 */
@Override
public void performBoottime(OperationContext context, ModelNode operation, ModelNode model) {
    MicroProfileConfigLogger.ROOT_LOGGER.activatingSubsystem();
    context.addStep(new AbstractDeploymentChainStep() {

        @Override
        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(MicroProfileConfigExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_MICROPROFILE_CONFIG, new DependencyProcessor());
            processorTarget.addDeploymentProcessor(MicroProfileConfigExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_MICROPROFILE_CONFIG, new SubsystemDeploymentProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
}
Also used : DependencyProcessor(org.wildfly.extension.microprofile.config.smallrye.deployment.DependencyProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) SubsystemDeploymentProcessor(org.wildfly.extension.microprofile.config.smallrye.deployment.SubsystemDeploymentProcessor)

Example 34 with DeploymentProcessorTarget

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

the class JcaSubsystemAdd method performBoottime.

protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) {
    final boolean appclient = context.getProcessType() == ProcessType.APPLICATION_CLIENT;
    final boolean legacySecurityAvailable = context.hasOptionalCapability("org.wildfly.legacy-security", null, null);
    final RaDeploymentActivator raDeploymentActivator = new RaDeploymentActivator(appclient, legacySecurityAvailable);
    context.addStep(new AbstractDeploymentChainStep() {

        protected void execute(DeploymentProcessorTarget processorTarget) {
            raDeploymentActivator.activateProcessors(processorTarget);
        }
    }, OperationContext.Stage.RUNTIME);
    CapabilityServiceTarget serviceTarget = context.getCapabilityServiceTarget();
    TransactionIntegrationService tiService = new TransactionIntegrationService();
    serviceTarget.addCapability(TRANSACTION_INTEGRATION_CAPABILITY).setInstance(tiService).addCapabilityRequirement(LOCAL_TRANSACTION_PROVIDER_CAPABILITY, Void.class).addCapabilityRequirement(TRANSACTION_XA_RESOURCE_RECOVERY_REGISTRY_CAPABILITY, XAResourceRecoveryRegistry.class, tiService.getRrInjector()).addCapabilityRequirement(TRANSACTION_SYNCHRONIZATION_REGISTRY_CAPABILITY, TransactionSynchronizationRegistry.class, tiService.getTsrInjector()).addDependency(TxnServices.JBOSS_TXN_USER_TRANSACTION_REGISTRY, org.jboss.tm.usertx.UserTransactionRegistry.class, tiService.getUtrInjector()).addDependency(TxnServices.JBOSS_TXN_CONTEXT_XA_TERMINATOR, JBossContextXATerminator.class, tiService.getTerminatorInjector()).setInitialMode(ServiceController.Mode.ACTIVE).addAliases(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE).install();
    // Cache the some capability service names for use by our runtime services
    final CapabilityServiceSupport support = context.getCapabilityServiceSupport();
    ConnectorServices.registerCapabilityServiceName(LOCAL_TRANSACTION_PROVIDER_CAPABILITY, support.getCapabilityServiceName(LOCAL_TRANSACTION_PROVIDER_CAPABILITY));
    ConnectorServices.registerCapabilityServiceName(NamingService.CAPABILITY_NAME, support.getCapabilityServiceName(NamingService.CAPABILITY_NAME));
    ConnectorServices.registerCapabilityServiceName(TRANSACTION_INTEGRATION_CAPABILITY_NAME, support.getCapabilityServiceName(TRANSACTION_INTEGRATION_CAPABILITY_NAME));
    final JcaSubsystemConfiguration config = new JcaSubsystemConfiguration();
    final JcaConfigService connectorConfigService = new JcaConfigService(config);
    serviceTarget.addService(ConnectorServices.CONNECTOR_CONFIG_SERVICE, connectorConfigService).setInitialMode(Mode.ACTIVE).install();
    final IdleRemoverService idleRemoverService = new IdleRemoverService();
    serviceTarget.addService(ConnectorServices.IDLE_REMOVER_SERVICE, idleRemoverService).setInitialMode(Mode.ACTIVE).install();
    final ConnectionValidatorService connectionValidatorService = new ConnectionValidatorService();
    serviceTarget.addService(ConnectorServices.CONNECTION_VALIDATOR_SERVICE, connectionValidatorService).setInitialMode(Mode.ACTIVE).install();
    // TODO does the install of this and the DriverProcessor
    // belong in DataSourcesSubsystemAdd?
    final DriverRegistryService driverRegistryService = new DriverRegistryService();
    serviceTarget.addService(ConnectorServices.JDBC_DRIVER_REGISTRY_SERVICE, driverRegistryService).install();
    raDeploymentActivator.activateServices(serviceTarget);
}
Also used : JBossContextXATerminator(org.jboss.as.txn.integration.JBossContextXATerminator) DriverRegistryService(org.jboss.as.connector.services.driver.registry.DriverRegistryService) RaDeploymentActivator(org.jboss.as.connector.deployers.ra.RaDeploymentActivator) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) TransactionSynchronizationRegistry(javax.transaction.TransactionSynchronizationRegistry) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) TransactionIntegrationService(org.jboss.as.connector.services.transactionintegration.TransactionIntegrationService) CapabilityServiceTarget(org.jboss.as.controller.CapabilityServiceTarget)

Example 35 with DeploymentProcessorTarget

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

the class EESecuritySubsystemAdd method performBoottime.

protected void performBoottime(final OperationContext context, ModelNode operation, Resource resource) {
    final ServiceTarget serviceTarget = context.getServiceTarget();
    context.addStep(new AbstractDeploymentChainStep() {

        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(EESecurityExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EE_SECURITY_ANNOTATIONS, new EESecurityAnnotationProcessor());
            processorTarget.addDeploymentProcessor(EESecurityExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_EE_SECURITY, new EESecurityDependencyProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
}
Also used : DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ServiceTarget(org.jboss.msc.service.ServiceTarget) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep)

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