Search in sources :

Example 21 with AbstractDeploymentChainStep

use of org.jboss.as.server.AbstractDeploymentChainStep 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 22 with AbstractDeploymentChainStep

use of org.jboss.as.server.AbstractDeploymentChainStep 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 RaDeploymentActivator raDeploymentActivator = new RaDeploymentActivator(appclient);
    context.addStep(new AbstractDeploymentChainStep() {

        protected void execute(DeploymentProcessorTarget processorTarget) {
            raDeploymentActivator.activateProcessors(processorTarget);
        }
    }, OperationContext.Stage.RUNTIME);
    ServiceTarget serviceTarget = context.getServiceTarget();
    TransactionIntegrationService tiService = new TransactionIntegrationService();
    serviceTarget.addService(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, tiService).addDependency(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER, TransactionManager.class, tiService.getTmInjector()).addDependency(TxnServices.JBOSS_TXN_SYNCHRONIZATION_REGISTRY, 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()).addDependency(TxnServices.JBOSS_TXN_ARJUNA_RECOVERY_MANAGER, XAResourceRecoveryRegistry.class, tiService.getRrInjector()).setInitialMode(ServiceController.Mode.ACTIVE).install();
    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) ServiceTarget(org.jboss.msc.service.ServiceTarget) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) TransactionSynchronizationRegistry(javax.transaction.TransactionSynchronizationRegistry) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) TransactionIntegrationService(org.jboss.as.connector.services.transactionintegration.TransactionIntegrationService)

Example 23 with AbstractDeploymentChainStep

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

the class TransactionSubsystemAdd method performBoottime.

@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    checkIfNodeIdentifierIsDefault(context, model);
    boolean jts = model.hasDefined(JTS) && model.get(JTS).asBoolean();
    final Resource subsystemResource = context.readResourceFromRoot(PathAddress.pathAddress(TransactionExtension.SUBSYSTEM_PATH));
    final List<ServiceName> deps = new LinkedList<>();
    for (Resource.ResourceEntry re : subsystemResource.getChildren(CM_RESOURCE)) {
        deps.add(TxnServices.JBOSS_TXN_CMR.append(re.getName()));
    }
    //recovery environment
    performRecoveryEnvBoottime(context, model, jts, deps);
    //core environment
    performCoreEnvironmentBootTime(context, model);
    //coordinator environment
    performCoordinatorEnvBoottime(context, model, jts);
    //object store
    performObjectStoreBoottime(context, model);
    //always propagate the transaction context
    //TODO: need a better way to do this, but this value gets cached in a static
    //so we need to make sure we set it before anything tries to read it
    jtsPropertyManager.getJTSEnvironmentBean().setAlwaysPropagateContext(true);
    context.addStep(new AbstractDeploymentChainStep() {

        protected void execute(final DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(TransactionExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_TRANSACTION_ROLLBACK_ACTION, new TransactionLeakRollbackProcessor());
            processorTarget.addDeploymentProcessor(TransactionExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_TRANSACTIONS_EE_CONCURRENCY, new EEConcurrencyContextHandleFactoryProcessor());
            processorTarget.addDeploymentProcessor(TransactionExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_TRANSACTION_BINDINGS, new TransactionJndiBindingProcessor());
            processorTarget.addDeploymentProcessor(TransactionExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_TRANSACTIONS, new TransactionDependenciesProcessor());
            processorTarget.addDeploymentProcessor(TransactionExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_TRANSACTIONS, new CompensationsDependenciesDeploymentProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
    //bind the TransactionManger and the TSR into JNDI
    final BinderService tmBinderService = new BinderService("TransactionManager");
    final ServiceBuilder<ManagedReferenceFactory> tmBuilder = context.getServiceTarget().addService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append("TransactionManager"), tmBinderService);
    tmBuilder.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, tmBinderService.getNamingStoreInjector());
    tmBuilder.addDependency(TransactionManagerService.SERVICE_NAME, javax.transaction.TransactionManager.class, new Injector<javax.transaction.TransactionManager>() {

        @Override
        public void inject(final javax.transaction.TransactionManager value) throws InjectionException {
            tmBinderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
        }

        @Override
        public void uninject() {
            tmBinderService.getManagedObjectInjector().uninject();
        }
    });
    tmBuilder.install();
    final BinderService tmLegacyBinderService = new BinderService("TransactionManager");
    final ServiceBuilder<ManagedReferenceFactory> tmLegacyBuilder = context.getServiceTarget().addService(ContextNames.JAVA_CONTEXT_SERVICE_NAME.append("TransactionManager"), tmLegacyBinderService);
    tmLegacyBuilder.addDependency(ContextNames.JAVA_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, tmLegacyBinderService.getNamingStoreInjector());
    tmLegacyBuilder.addDependency(TransactionManagerService.SERVICE_NAME, javax.transaction.TransactionManager.class, new Injector<javax.transaction.TransactionManager>() {

        @Override
        public void inject(final javax.transaction.TransactionManager value) throws InjectionException {
            tmLegacyBinderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
        }

        @Override
        public void uninject() {
            tmLegacyBinderService.getManagedObjectInjector().uninject();
        }
    });
    tmLegacyBuilder.install();
    final BinderService tsrBinderService = new BinderService("TransactionSynchronizationRegistry");
    final ServiceBuilder<ManagedReferenceFactory> tsrBuilder = context.getServiceTarget().addService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append("TransactionSynchronizationRegistry"), tsrBinderService);
    tsrBuilder.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, tsrBinderService.getNamingStoreInjector());
    tsrBuilder.addDependency(TransactionSynchronizationRegistryService.SERVICE_NAME, TransactionSynchronizationRegistry.class, new Injector<TransactionSynchronizationRegistry>() {

        @Override
        public void inject(final TransactionSynchronizationRegistry value) throws InjectionException {
            tsrBinderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
        }

        @Override
        public void uninject() {
            tsrBinderService.getManagedObjectInjector().uninject();
        }
    });
    tsrBuilder.install();
    // Install the UserTransactionAccessControlService
    final UserTransactionAccessControlService lookupControlService = new UserTransactionAccessControlService();
    context.getServiceTarget().addService(UserTransactionAccessControlService.SERVICE_NAME, lookupControlService).install();
    // Bind the UserTransaction into JNDI
    final UserTransactionBindingService userTransactionBindingService = new UserTransactionBindingService("UserTransaction");
    final ServiceBuilder<ManagedReferenceFactory> utBuilder = context.getServiceTarget().addService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append("UserTransaction"), userTransactionBindingService);
    utBuilder.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, userTransactionBindingService.getNamingStoreInjector()).addDependency(UserTransactionAccessControlService.SERVICE_NAME, UserTransactionAccessControlService.class, userTransactionBindingService.getUserTransactionAccessControlServiceInjector()).addDependency(UserTransactionService.SERVICE_NAME, UserTransaction.class, new ManagedReferenceInjector<UserTransaction>(userTransactionBindingService.getManagedObjectInjector()));
    utBuilder.install();
    // install the EE Concurrency transaction setup provider's service
    final TransactionSetupProviderService transactionSetupProviderService = new TransactionSetupProviderService();
    context.getServiceTarget().addService(ConcurrentServiceNames.TRANSACTION_SETUP_PROVIDER_SERVICE_NAME, transactionSetupProviderService).addDependency(TransactionManagerService.SERVICE_NAME, TransactionManager.class, transactionSetupProviderService.getTransactionManagerInjectedValue()).install();
}
Also used : TransactionLeakRollbackProcessor(org.jboss.as.txn.deployment.TransactionLeakRollbackProcessor) EEConcurrencyContextHandleFactoryProcessor(org.jboss.as.txn.ee.concurrency.EEConcurrencyContextHandleFactoryProcessor) TransactionDependenciesProcessor(org.jboss.as.txn.deployment.TransactionDependenciesProcessor) BinderService(org.jboss.as.naming.service.BinderService) InjectionException(org.jboss.msc.inject.InjectionException) ManagedReferenceFactory(org.jboss.as.naming.ManagedReferenceFactory) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) UserTransaction(javax.transaction.UserTransaction) Resource(org.jboss.as.controller.registry.Resource) UserTransactionBindingService(org.jboss.as.txn.service.UserTransactionBindingService) LinkedList(java.util.LinkedList) TransactionSetupProviderService(org.jboss.as.txn.ee.concurrency.TransactionSetupProviderService) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ServiceName(org.jboss.msc.service.ServiceName) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) ContextTransactionManager(org.wildfly.transaction.client.ContextTransactionManager) TransactionManager(javax.transaction.TransactionManager) TransactionSynchronizationRegistry(javax.transaction.TransactionSynchronizationRegistry) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) UserTransactionAccessControlService(org.jboss.as.txn.service.UserTransactionAccessControlService) TransactionManager(javax.transaction.TransactionManager) TransactionJndiBindingProcessor(org.jboss.as.txn.deployment.TransactionJndiBindingProcessor)

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