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);
}
}
}
});
}
Aggregations