Search in sources :

Example 1 with ResourceAdapterDeploymentService

use of org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService in project wildfly by wildfly.

the class ParsedRaDeploymentProcessor method process.

public static ServiceBuilder<ResourceAdapterDeployment> process(final ConnectorXmlDescriptor connectorXmlDescriptor, final IronJacamarXmlDescriptor ironJacamarXmlDescriptor, final ClassLoader classLoader, final ServiceTarget serviceTarget, final Map<ResourceRoot, Index> annotationIndexes, final ServiceName duServiceName, final ManagementResourceRegistration registration, Resource deploymentResource) throws DeploymentUnitProcessingException {
    Connector cmd = connectorXmlDescriptor != null ? connectorXmlDescriptor.getConnector() : null;
    final Activation activation = ironJacamarXmlDescriptor != null ? ironJacamarXmlDescriptor.getIronJacamar() : null;
    try {
        // Annotation merging
        Annotations annotator = new Annotations();
        if (annotationIndexes != null && annotationIndexes.size() > 0) {
            DEPLOYMENT_CONNECTOR_LOGGER.debugf("ParsedRaDeploymentProcessor: Found %d annotationIndexes", annotationIndexes.size());
            for (Index index : annotationIndexes.values()) {
                // Don't apply any empty indexes, as IronJacamar doesn't like that atm.
                if (index.getKnownClasses() != null && index.getKnownClasses().size() > 0) {
                    AnnotationRepository repository = new JandexAnnotationRepositoryImpl(index, classLoader);
                    cmd = annotator.merge(cmd, repository, classLoader);
                    DEPLOYMENT_CONNECTOR_LOGGER.debugf("ParsedRaDeploymentProcessor: CMD=%s", cmd);
                }
            }
        }
        if (annotationIndexes == null || annotationIndexes.size() == 0)
            DEPLOYMENT_CONNECTOR_LOGGER.debugf("ParsedRaDeploymentProcessor: Found 0 annotationIndexes");
        // FIXME: when the connector is null the Iron Jacamar data is ignored
        if (cmd != null) {
            // Validate metadata
            cmd.validate();
            // Merge metadata
            cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(activation, cmd);
        }
        TransactionSupportEnum transactionSupport = TransactionSupportEnum.NoTransaction;
        if (cmd != null && cmd.getResourceadapter() != null && cmd.getResourceadapter().getOutboundResourceadapter() != null) {
            transactionSupport = cmd.getResourceadapter().getOutboundResourceadapter().getTransactionSupport();
        }
        if (activation != null && activation.getTransactionSupport() != null) {
            transactionSupport = activation.getTransactionSupport();
        }
        final ServiceName deployerServiceName = ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(connectorXmlDescriptor.getDeploymentName());
        final ResourceAdapterDeploymentService raDeploymentService = new ResourceAdapterDeploymentService(connectorXmlDescriptor, cmd, activation, classLoader, deployerServiceName, duServiceName, registration, deploymentResource);
        // Create the service
        ServiceBuilder<ResourceAdapterDeployment> builder = Services.addServerExecutorDependency(serviceTarget.addService(deployerServiceName, raDeploymentService), raDeploymentService.getExecutorServiceInjector(), false).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, raDeploymentService.getMdrInjector()).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, raDeploymentService.getRaRepositoryInjector()).addDependency(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, ManagementRepository.class, raDeploymentService.getManagementRepositoryInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, ResourceAdapterDeploymentRegistry.class, raDeploymentService.getRegistryInjector()).addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class, raDeploymentService.getTxIntegrationInjector()).addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE, JcaSubsystemConfiguration.class, raDeploymentService.getConfigInjector()).addDependency(ConnectorServices.IDLE_REMOVER_SERVICE).addDependency(ConnectorServices.CONNECTION_VALIDATOR_SERVICE).addDependency(NamingService.SERVICE_NAME);
        if (transactionSupport == null || transactionSupport.equals(TransactionSupportEnum.NoTransaction)) {
            builder.addDependency(ConnectorServices.NON_TX_CCM_SERVICE, CachedConnectionManager.class, raDeploymentService.getCcmInjector());
        } else {
            builder.addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, raDeploymentService.getCcmInjector());
        }
        if (activation != null && ActivationSecurityUtil.isLegacySecurityRequired(activation)) {
            builder.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class, raDeploymentService.getSubjectFactoryInjector()).addDependency(SimpleSecurityManagerService.SERVICE_NAME, ServerSecurityManager.class, raDeploymentService.getServerSecurityManager());
        }
        return builder;
    } catch (Throwable t) {
        throw new DeploymentUnitProcessingException(t);
    }
}
Also used : JandexAnnotationRepositoryImpl(org.jboss.as.connector.annotations.repository.jandex.JandexAnnotationRepositoryImpl) ResourceAdapterDeployment(org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) Connector(org.jboss.jca.common.api.metadata.spec.Connector) SubjectFactory(org.jboss.security.SubjectFactory) JcaSubsystemConfiguration(org.jboss.as.connector.subsystems.jca.JcaSubsystemConfiguration) Activation(org.jboss.jca.common.api.metadata.resourceadapter.Activation) Index(org.jboss.jandex.Index) ResourceAdapterDeploymentService(org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService) Annotations(org.jboss.jca.common.annotations.Annotations) Merger(org.jboss.jca.common.metadata.merge.Merger) ServiceName(org.jboss.msc.service.ServiceName) AnnotationRepository(org.jboss.jca.common.spi.annotations.repository.AnnotationRepository) ResourceAdapterRepository(org.jboss.jca.core.spi.rar.ResourceAdapterRepository) TransactionSupportEnum(org.jboss.jca.common.api.metadata.common.TransactionSupportEnum) ResourceAdapterDeploymentRegistry(org.jboss.as.connector.services.resourceadapters.deployment.registry.ResourceAdapterDeploymentRegistry)

Example 2 with ResourceAdapterDeploymentService

use of org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService in project wildfly by wildfly.

the class ParsedRaDeploymentProcessor method process.

public static ServiceBuilder<ResourceAdapterDeployment> process(final ConnectorXmlDescriptor connectorXmlDescriptor, final IronJacamarXmlDescriptor ironJacamarXmlDescriptor, final ClassLoader classLoader, final ServiceTarget serviceTarget, final Map<ResourceRoot, Index> annotationIndexes, final ServiceName duServiceName, final ManagementResourceRegistration registration, Resource deploymentResource, final CapabilityServiceSupport support) throws DeploymentUnitProcessingException {
    Connector cmd = connectorXmlDescriptor != null ? connectorXmlDescriptor.getConnector() : null;
    final Activation activation = ironJacamarXmlDescriptor != null ? ironJacamarXmlDescriptor.getIronJacamar() : null;
    try {
        // Annotation merging
        Annotations annotator = new Annotations();
        if (annotationIndexes != null && annotationIndexes.size() > 0) {
            DEPLOYMENT_CONNECTOR_LOGGER.debugf("ParsedRaDeploymentProcessor: Found %d annotationIndexes", annotationIndexes.size());
            for (Index index : annotationIndexes.values()) {
                // Don't apply any empty indexes, as IronJacamar doesn't like that atm.
                if (index.getKnownClasses() != null && !index.getKnownClasses().isEmpty()) {
                    AnnotationRepository repository = new JandexAnnotationRepositoryImpl(index, classLoader);
                    cmd = annotator.merge(cmd, repository, classLoader);
                    DEPLOYMENT_CONNECTOR_LOGGER.debugf("ParsedRaDeploymentProcessor: CMD=%s", cmd);
                }
            }
        }
        if (annotationIndexes == null || annotationIndexes.size() == 0)
            DEPLOYMENT_CONNECTOR_LOGGER.debugf("ParsedRaDeploymentProcessor: Found 0 annotationIndexes");
        // FIXME: when the connector is null the Iron Jacamar data is ignored
        if (cmd != null) {
            // Validate metadata
            cmd.validate();
            // Merge metadata
            cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(activation, cmd);
        }
        TransactionSupportEnum transactionSupport = TransactionSupportEnum.NoTransaction;
        if (cmd != null && cmd.getResourceadapter() != null && cmd.getResourceadapter().getOutboundResourceadapter() != null) {
            transactionSupport = cmd.getResourceadapter().getOutboundResourceadapter().getTransactionSupport();
        }
        if (activation != null && activation.getTransactionSupport() != null) {
            transactionSupport = activation.getTransactionSupport();
        }
        final ServiceName deployerServiceName = ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(connectorXmlDescriptor.getDeploymentName());
        final ResourceAdapterDeploymentService raDeploymentService = new ResourceAdapterDeploymentService(connectorXmlDescriptor, cmd, activation, classLoader, deployerServiceName, duServiceName, registration, deploymentResource);
        // Create the service
        ServiceBuilder<ResourceAdapterDeployment> builder = Services.addServerExecutorDependency(serviceTarget.addService(deployerServiceName, raDeploymentService), raDeploymentService.getExecutorServiceInjector()).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, raDeploymentService.getMdrInjector()).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, raDeploymentService.getRaRepositoryInjector()).addDependency(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, ManagementRepository.class, raDeploymentService.getManagementRepositoryInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, ResourceAdapterDeploymentRegistry.class, raDeploymentService.getRegistryInjector()).addDependency(support.getCapabilityServiceName(ConnectorServices.TRANSACTION_INTEGRATION_CAPABILITY_NAME), TransactionIntegration.class, raDeploymentService.getTxIntegrationInjector()).addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE, JcaSubsystemConfiguration.class, raDeploymentService.getConfigInjector());
        builder.requires(ConnectorServices.IDLE_REMOVER_SERVICE);
        builder.requires(ConnectorServices.CONNECTION_VALIDATOR_SERVICE);
        builder.requires(support.getCapabilityServiceName(NamingService.CAPABILITY_NAME));
        if (transactionSupport == null || transactionSupport.equals(TransactionSupportEnum.NoTransaction)) {
            builder.addDependency(ConnectorServices.NON_TX_CCM_SERVICE, CachedConnectionManager.class, raDeploymentService.getCcmInjector());
        } else {
            builder.addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, raDeploymentService.getCcmInjector());
        }
        if (activation != null && ActivationSecurityUtil.isLegacySecurityRequired(activation)) {
            throw ConnectorLogger.DS_DEPLOYER_LOGGER.legacySecurityNotAvailableForRa(connectorXmlDescriptor.getDeploymentName());
        }
        return builder;
    } catch (Throwable t) {
        throw new DeploymentUnitProcessingException(t);
    }
}
Also used : JandexAnnotationRepositoryImpl(org.jboss.as.connector.annotations.repository.jandex.JandexAnnotationRepositoryImpl) ResourceAdapterDeployment(org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) Connector(org.jboss.jca.common.api.metadata.spec.Connector) TransactionIntegration(org.jboss.jca.core.spi.transaction.TransactionIntegration) Activation(org.jboss.jca.common.api.metadata.resourceadapter.Activation) Index(org.jboss.jandex.Index) ResourceAdapterDeploymentService(org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService) AS7MetadataRepository(org.jboss.as.connector.services.mdr.AS7MetadataRepository) Annotations(org.jboss.jca.common.annotations.Annotations) Merger(org.jboss.jca.common.metadata.merge.Merger) ManagementRepository(org.jboss.jca.core.api.management.ManagementRepository) ServiceName(org.jboss.msc.service.ServiceName) AnnotationRepository(org.jboss.jca.common.spi.annotations.repository.AnnotationRepository) TransactionSupportEnum(org.jboss.jca.common.api.metadata.common.TransactionSupportEnum)

Aggregations

JandexAnnotationRepositoryImpl (org.jboss.as.connector.annotations.repository.jandex.JandexAnnotationRepositoryImpl)2 ResourceAdapterDeployment (org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment)2 ResourceAdapterDeploymentService (org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterDeploymentService)2 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)2 Index (org.jboss.jandex.Index)2 Annotations (org.jboss.jca.common.annotations.Annotations)2 TransactionSupportEnum (org.jboss.jca.common.api.metadata.common.TransactionSupportEnum)2 Activation (org.jboss.jca.common.api.metadata.resourceadapter.Activation)2 Connector (org.jboss.jca.common.api.metadata.spec.Connector)2 Merger (org.jboss.jca.common.metadata.merge.Merger)2 AnnotationRepository (org.jboss.jca.common.spi.annotations.repository.AnnotationRepository)2 ServiceName (org.jboss.msc.service.ServiceName)2 AS7MetadataRepository (org.jboss.as.connector.services.mdr.AS7MetadataRepository)1 ResourceAdapterDeploymentRegistry (org.jboss.as.connector.services.resourceadapters.deployment.registry.ResourceAdapterDeploymentRegistry)1 JcaSubsystemConfiguration (org.jboss.as.connector.subsystems.jca.JcaSubsystemConfiguration)1 ManagementRepository (org.jboss.jca.core.api.management.ManagementRepository)1 ResourceAdapterRepository (org.jboss.jca.core.spi.rar.ResourceAdapterRepository)1 TransactionIntegration (org.jboss.jca.core.spi.transaction.TransactionIntegration)1 SubjectFactory (org.jboss.security.SubjectFactory)1