Package org.apache.commons.dbcp.managed

Examples of org.apache.commons.dbcp.managed.DataSourceXAConnectionFactory


            if (dataSource instanceof XADataSource) {

                // Create the XAConectionFactory using the XA data source
                XADataSource xaDataSourceInstance = (XADataSource) dataSource;
                XAConnectionFactory xaConnectionFactory = new DataSourceXAConnectionFactory(getTransactionManager(), xaDataSourceInstance, username, password);
                setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
                return xaConnectionFactory;

            } else {

                // If xa data source is not specified a DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory
                ConnectionFactory connectionFactory = new DataSourceConnectionFactory(dataSource, username, password);
                XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
                setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
                return xaConnectionFactory;
            }
        }
View Full Code Here


            if (dataSource instanceof XADataSource) {

                // Create the XAConectionFactory using the XA data source
                XADataSource xaDataSourceInstance = (XADataSource) dataSource;
                XAConnectionFactory xaConnectionFactory = new DataSourceXAConnectionFactory(getTransactionManager(), xaDataSourceInstance, username, password);
                setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
                return xaConnectionFactory;

            } else {

                // If xa data source is not specified a DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory
                ConnectionFactory connectionFactory = new DataSourceConnectionFactory(dataSource, username, password);
                XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
                setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
                return xaConnectionFactory;
            }
        }
View Full Code Here

      if (!dataService.isEnableXA()) {
        throw new DataServiceFault(
            "Internal XADataSource: XA transaction support must be enabled to use XADataSources");
      }
      XADataSourceInfo xaInfo = ((RDBMSConfig) config).getXADataSourceInfo()
      connectionFactory = new DataSourceXAConnectionFactory(
          dataService.getDSSTxManager().getTransactionManager(), xaInfo.getXADataSource());
    } else if (externalDS != null) {
      if (externalDS instanceof XADataSource) {
        if (!dataService.isEnableXA()) {
          throw new DataServiceFault(
              "External XADataSource: XA transaction support must be enabled to use XADataSources");
        }
        connectionFactory = new DataSourceXAConnectionFactory(
            dataService.getDSSTxManager().getTransactionManager(), (XADataSource) externalDS);
      } else {
        connectionFactory = new DataSourceConnectionFactory(externalDS);
      }
    } else {
View Full Code Here

            if (dataSource instanceof XADataSource) {

                // Create the XAConectionFactory using the XA data source
                XADataSource xaDataSourceInstance = (XADataSource) dataSource;
                XAConnectionFactory xaConnectionFactory = new DataSourceXAConnectionFactory(getTransactionManager(), xaDataSourceInstance, username, password);
                setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
                return xaConnectionFactory;

            } else {

                // If xa data source is not specified a DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory
                ConnectionFactory connectionFactory = new DataSourceConnectionFactory(dataSource, username, password);
                XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
                setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
                return xaConnectionFactory;
            }
        }
View Full Code Here

    @Override
    protected ConnectionFactory createConnectionFactory() throws SQLException {
        if (delegate != null) {
            if (XADataSource.class.isInstance(delegate)) {
                return new DataSourceXAConnectionFactory(OpenEJB.getTransactionManager(), XADataSource.class.cast(delegate), username, password);
            }
            return new DataSourceConnectionFactory(DataSource.class.cast(delegate), username, password);
        }
        return super.createConnectionFactory();
    }
View Full Code Here

    protected ConnectionFactory createConnectionFactory() throws SQLException {
        if (ds instanceof XADataSource) {

            // Create the XAConectionFactory using the XA data source
            final XADataSource xaDataSourceInstance = (XADataSource) ds;
            final XAConnectionFactory xaConnectionFactory = new DataSourceXAConnectionFactory(getTransactionManager(), xaDataSourceInstance, username, password);
            setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
            return xaConnectionFactory;

        }

        // If xa data source is not specified a DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory
        final ConnectionFactory connectionFactory = new DataSourceConnectionFactory(DataSource.class.cast(ds), username, password);
        final XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
        setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
        return xaConnectionFactory;
    }
View Full Code Here

    protected ConnectionFactory createConnectionFactory() throws SQLException {
        if (ds instanceof XADataSource) {

            // Create the XAConectionFactory using the XA data source
            XADataSource xaDataSourceInstance = (XADataSource) ds;
            XAConnectionFactory xaConnectionFactory = new DataSourceXAConnectionFactory(getTransactionManager(), xaDataSourceInstance, username, password);
            setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
            return xaConnectionFactory;

        }

        // If xa data source is not specified a DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory
        ConnectionFactory connectionFactory = new DataSourceConnectionFactory(DataSource.class.cast(ds), username, password);
        XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
        setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
        return xaConnectionFactory;
    }
View Full Code Here

    @Override
    protected ConnectionFactory createConnectionFactory() throws SQLException {
        if (delegate != null) {
            if (XADataSource.class.isInstance(delegate)) {
                return new DataSourceXAConnectionFactory(OpenEJB.getTransactionManager(), XADataSource.class.cast(delegate), username, password);
            }
            return new DataSourceConnectionFactory(DataSource.class.cast(delegate), username, password);
        }
        return super.createConnectionFactory();
    }
View Full Code Here

    @Override
    protected ConnectionFactory createConnectionFactory() throws SQLException {
        if (delegate != null) {
            if (XADataSource.class.isInstance(delegate)) {
                return new DataSourceXAConnectionFactory(OpenEJB.getTransactionManager(), XADataSource.class.cast(delegate), username, password);
            }
            return new DataSourceConnectionFactory(DataSource.class.cast(delegate), username, password);
        }
        return super.createConnectionFactory();
    }
View Full Code Here

        if (this.ds instanceof XADataSource) {

            // Create the XAConectionFactory using the XA data source
            XADataSource xaDataSourceInstance = (XADataSource) this.ds;
            XAConnectionFactory xaConnectionFactory = new DataSourceXAConnectionFactory(getTransactionManager(), xaDataSourceInstance, username, password);
            setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
            return xaConnectionFactory;

        } else {

            // If xa data source is not specified a DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory
            ConnectionFactory connectionFactory = new DataSourceConnectionFactory(this.ds, username, password);
            XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
            setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
            return xaConnectionFactory;
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.dbcp.managed.DataSourceXAConnectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.