Search in sources :

Example 1 with ConnectionFactoryDefinitionInjectionSource

use of org.jboss.as.connector.deployers.ra.ConnectionFactoryDefinitionInjectionSource in project wildfly by wildfly.

the class JMSConnectionFactoryDefinitionInjectionSource method getResourceValue.

@Override
public void getResourceValue(ResolutionContext context, ServiceBuilder<?> serviceBuilder, DeploymentPhaseContext phaseContext, Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (targetsPooledConnectionFactory(getActiveMQServerName(properties), resourceAdapter, phaseContext.getServiceRegistry())) {
        try {
            startedPooledConnectionFactory(context, jndiName, serviceBuilder, phaseContext.getServiceTarget(), deploymentUnit, injector);
        } catch (OperationFailedException e) {
            throw new DeploymentUnitProcessingException(e);
        }
    } else {
        // delegate to the resource-adapter subsystem to create a generic JCA connection factory.
        ConnectionFactoryDefinitionInjectionSource cfdis = new ConnectionFactoryDefinitionInjectionSource(jndiName, interfaceName, resourceAdapter);
        cfdis.setMaxPoolSize(maxPoolSize);
        cfdis.setMinPoolSize(minPoolSize);
        cfdis.setTransactionSupportLevel(transactional ? TransactionSupport.TransactionSupportLevel.XATransaction : TransactionSupport.TransactionSupportLevel.NoTransaction);
        // transfer all the generic properties + the additional properties specific to the JMSConnectionFactoryDefinition
        for (Map.Entry<String, String> property : properties.entrySet()) {
            cfdis.addProperty(property.getKey(), property.getValue());
        }
        if (!user.isEmpty()) {
            cfdis.addProperty("user", user);
        }
        if (!password.isEmpty()) {
            cfdis.addProperty("password", password);
        }
        if (!clientId.isEmpty()) {
            cfdis.addProperty("clientId", clientId);
        }
        cfdis.getResourceValue(context, serviceBuilder, phaseContext, injector);
    }
}
Also used : DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) OperationFailedException(org.jboss.as.controller.OperationFailedException) ConnectionFactoryDefinitionInjectionSource(org.jboss.as.connector.deployers.ra.ConnectionFactoryDefinitionInjectionSource) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConnectionFactoryDefinitionInjectionSource (org.jboss.as.connector.deployers.ra.ConnectionFactoryDefinitionInjectionSource)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)1