Search in sources :

Example 1 with DirectConnectionFactoryActivatorService

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

the class ConnectionFactoryDefinitionInjectionSource method getResourceValue.

public void getResourceValue(final ResolutionContext context, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
    String raId = resourceAdapter;
    if (resourceAdapter.startsWith("#")) {
        raId = deploymentUnit.getParent().getName() + raId;
    }
    String deployerServiceName = raId;
    if (!raId.endsWith(".rar")) {
        deployerServiceName = deployerServiceName + ".rar";
        raId = deployerServiceName;
    }
    SUBSYSTEM_RA_LOGGER.debugf("@ConnectionFactoryDefinition: %s for %s binding to %s ", interfaceName, resourceAdapter, jndiName);
    ContextNames.BindInfo bindInfo = ContextNames.bindInfoForEnvEntry(context.getApplicationName(), context.getModuleName(), context.getComponentName(), !context.isCompUsesModule(), jndiName);
    DirectConnectionFactoryActivatorService service = new DirectConnectionFactoryActivatorService(jndiName, interfaceName, resourceAdapter, raId, maxPoolSize, minPoolSize, properties, transactionSupport, module, bindInfo);
    ServiceName serviceName = DirectConnectionFactoryActivatorService.SERVICE_NAME_BASE.append(jndiName);
    phaseContext.getServiceTarget().addService(serviceName, service).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, service.getMdrInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(deployerServiceName)).setInitialMode(ServiceController.Mode.ACTIVE).install();
    serviceBuilder.addDependency(ConnectionFactoryReferenceFactoryService.SERVICE_NAME_BASE.append(bindInfo.getBinderServiceName()), ManagedReferenceFactory.class, injector);
    serviceBuilder.addListener(new AbstractServiceListener<Object>() {

        public void transition(final ServiceController<? extends Object> controller, final ServiceController.Transition transition) {
            switch(transition) {
                case STARTING_to_UP:
                    {
                        DEPLOYMENT_CONNECTOR_LOGGER.connectionFactoryAnnotation(jndiName);
                        break;
                    }
                case STOPPING_to_DOWN:
                    {
                        break;
                    }
                case REMOVING_to_REMOVED:
                    {
                        DEPLOYMENT_CONNECTOR_LOGGER.debugf("Removed JCA ConnectionFactory [%s]", jndiName);
                    }
            }
        }
    });
}
Also used : AS7MetadataRepository(org.jboss.as.connector.services.mdr.AS7MetadataRepository) DirectConnectionFactoryActivatorService(org.jboss.as.connector.services.resourceadapters.DirectConnectionFactoryActivatorService) ServiceName(org.jboss.msc.service.ServiceName) ServiceController(org.jboss.msc.service.ServiceController) Module(org.jboss.modules.Module) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) ContextNames(org.jboss.as.naming.deployment.ContextNames)

Aggregations

AS7MetadataRepository (org.jboss.as.connector.services.mdr.AS7MetadataRepository)1 DirectConnectionFactoryActivatorService (org.jboss.as.connector.services.resourceadapters.DirectConnectionFactoryActivatorService)1 ContextNames (org.jboss.as.naming.deployment.ContextNames)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 Module (org.jboss.modules.Module)1 ServiceController (org.jboss.msc.service.ServiceController)1 ServiceName (org.jboss.msc.service.ServiceName)1