Search in sources :

Example 1 with TransactionSupport

use of com.sun.appserv.connectors.spi.TransactionSupport in project Payara by payara.

the class ActiveResourceAdapterImpl method createManagedConnectionFactory.

/**
 * Creates managed Connection factory instance.
 *
 * @param ccp Connector connection pool which contains the pool properties
 *            and ra.xml values pertaining to managed connection factory
 *            class. These values are used in MCF creation.
 * @param jcl Classloader used to managed connection factory class.
 * @return ManagedConnectionFactory created managed connection factory
 *         instance
 */
public ManagedConnectionFactory createManagedConnectionFactory(ConnectorConnectionPool ccp, ClassLoader jcl) {
    final String mcfClass = ccp.getConnectorDescriptorInfo().getManagedConnectionFactoryClass();
    try {
        ManagedConnectionFactory mcf = null;
        mcf = instantiateMCF(mcfClass, jcl);
        if (mcf instanceof ConfigurableTransactionSupport) {
            TransactionSupport ts = ConnectionPoolObjectsUtils.getTransactionSupport(ccp.getTransactionSupport());
            ((ConfigurableTransactionSupport) mcf).setTransactionSupport(ts);
        }
        SetMethodAction setMethodAction = new SetMethodAction(mcf, ccp.getConnectorDescriptorInfo().getMCFConfigProperties());
        setMethodAction.run();
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "Created MCF object : ", mcfClass);
        }
        return mcf;
    } catch (ClassNotFoundException Ex) {
        _logger.log(Level.SEVERE, "rardeployment.class_not_found", new Object[] { mcfClass, Ex.getMessage() });
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "rardeployment.class_not_found", Ex);
        }
        return null;
    } catch (InstantiationException Ex) {
        _logger.log(Level.SEVERE, "rardeployment.class_instantiation_error", new Object[] { mcfClass, Ex.getMessage() });
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "rardeployment.class_instantiation_error", Ex);
        }
        return null;
    } catch (IllegalAccessException Ex) {
        _logger.log(Level.SEVERE, "rardeployment.illegalaccess_error", new Object[] { mcfClass, Ex.getMessage() });
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "rardeployment.illegalaccess_error", Ex);
        }
        return null;
    } catch (Exception Ex) {
        _logger.log(Level.SEVERE, "rardeployment.mcfcreation_error", new Object[] { mcfClass, Ex.getMessage() });
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "rardeployment.mcfcreation_error", Ex);
        }
        return null;
    }
}
Also used : ManagedConnectionFactory(javax.resource.spi.ManagedConnectionFactory) ConfigurableTransactionSupport(com.sun.appserv.connectors.spi.ConfigurableTransactionSupport) TransactionSupport(com.sun.appserv.connectors.spi.TransactionSupport) ConfigurableTransactionSupport(com.sun.appserv.connectors.spi.ConfigurableTransactionSupport) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) SetMethodAction(com.sun.enterprise.connectors.util.SetMethodAction)

Aggregations

ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)1 ConfigurableTransactionSupport (com.sun.appserv.connectors.spi.ConfigurableTransactionSupport)1 TransactionSupport (com.sun.appserv.connectors.spi.TransactionSupport)1 SetMethodAction (com.sun.enterprise.connectors.util.SetMethodAction)1 ManagedConnectionFactory (javax.resource.spi.ManagedConnectionFactory)1