Package org.enhydra.jdbc.standard

Examples of org.enhydra.jdbc.standard.StandardXADataSource


    this.transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
    this.userTransaction = com.arjuna.ats.jta.UserTransaction.userTransaction();

    Properties environmentProperties = Environment.getProperties();
    StandardXADataSource dataSource = new StandardXADataSource();
    dataSource.setTransactionManager( com.arjuna.ats.jta.TransactionManager.transactionManager() );
    try {
      dataSource.setDriverName( environmentProperties.getProperty( Environment.DRIVER ) );
    }
    catch (SQLException e) {
      throw new RuntimeException( "Unable to set DataSource JDBC driver name", e );
    }
    dataSource.setUrl( environmentProperties.getProperty( Environment.URL ) );
    dataSource.setUser( environmentProperties.getProperty( Environment.USER ) );
    dataSource.setPassword( environmentProperties.getProperty( Environment.PASS ) );
    final String isolationString = environmentProperties.getProperty( Environment.ISOLATION );
    if ( isolationString != null ) {
      dataSource.setTransactionIsolation( Integer.valueOf( isolationString ) );
    }
    this.dataSource = dataSource;
  }
View Full Code Here


      return txService_;
   }

   private DataSource createDatasource(Map<String, String> props) throws Exception
   {
      StandardXADataSource ds = SecurityHelper.doPrivilegedAction(new PrivilegedAction<StandardXADataSource>()
      {
         public StandardXADataSource run()
         {
            return new StandardXADataSource();
         }
      });

      ds.setDriverName(props.get("connection.driver"));
      ds.setUrl(props.get("connection.url"));
      ds.setUser(props.get("connection.login"));
      ds.setPassword(props.get("connection.password"));
      ds.setTransactionManager(txService_.getTransactionManager());

      StandardXAPoolDataSource pool = new StandardXAPoolDataSource(3);
      pool.setMinSize(Integer.parseInt(props.get("connection.min-size")));
      pool.setMaxSize(Integer.parseInt(props.get("connection.max-size")));
      pool.setUser(props.get("connection.login"));
View Full Code Here

            }

            // the xapool wrapper class
            String wrapperClass = jotmJdbcElement.getAttribute("pool-xa-wrapper-class");

            StandardXADataSource ds = null;
            try {
                //ds =  new StandardXADataSource();
                ds = (StandardXADataSource) ObjectType.getInstance(wrapperClass);
                pds = new StandardXAPoolDataSource();
            } catch (NoClassDefFoundError e) {
                throw new GenericEntityException("Cannot find xapool.jar");
            } catch (ClassNotFoundException e) {
                throw new GenericEntityException("Cannot load wrapper class: " + wrapperClass, e);
            } catch (InstantiationException e) {
                throw new GenericEntityException("Unable to instantiate " + wrapperClass, e);
            } catch (IllegalAccessException e) {
                throw new GenericEntityException("Problems getting instance of " + wrapperClass, e);
            }

            if (ds == null)
                throw new GenericEntityException("StandardXaDataSource was not created, big problem!");

            ds.setDriverName(jotmJdbcElement.getAttribute("jdbc-driver"));
            ds.setUrl(jotmJdbcElement.getAttribute("jdbc-uri"));
            ds.setUser(jotmJdbcElement.getAttribute("jdbc-username"));
            ds.setPassword(jotmJdbcElement.getAttribute("jdbc-password"));
            ds.setDescription(helperName);
            ds.setTransactionManager(TransactionFactory.getTransactionManager());

            String transIso = jotmJdbcElement.getAttribute("isolation-level");
            if (transIso != null && transIso.length() > 0) {
                if ("Serializable".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
                } else if ("RepeatableRead".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
                } else if ("ReadUncommitted".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
                } else if ("ReadCommitted".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
                } else if ("None".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_NONE);
                }
            }

            // set the datasource in the pool
            pds.setDataSource(ds);
            pds.setDescription(ds.getDescription());
            pds.setUser(ds.getUser());
            pds.setPassword(ds.getPassword());
            Debug.logInfo("XADataSource: " + ds.getClass().getName() + " attached to pool.", module);

            // set the transaction manager in the pool
            pds.setTransactionManager(TransactionFactory.getTransactionManager());

            // configure the pool settings
View Full Code Here

* @author Thierry Templier
*/
public class XAPoolDataSourceMCF extends AbstractXADataSourceMCF {

  public XAPoolDataSourceMCF() {
    super(new StandardXADataSource(),new AllExceptionsAreFatalSorter());
  }
View Full Code Here

        return new XaTransactionFactory();
    }

    protected DataSource createDataSource() throws Exception
    {
        StandardXADataSource ds = new StandardXADataSource();
        ds.setDriverName(EMBEDDED_DRIVER_NAME);
        ds.setUrl(EMBEDDED_CONNECTION_STRING);
        ds.setTransactionManager(txManager);
        return new DataSourceWrapper(ds);
    }
View Full Code Here

            }

            // the xapool wrapper class
            String wrapperClass = jdbcElement.getAttribute("pool-xa-wrapper-class");

            StandardXADataSource ds = null;
            try {
                //ds =  new StandardXADataSource();
                ds = (StandardXADataSource) ObjectType.getInstance(wrapperClass);
                pds = new StandardXAPoolDataSource();
            } catch (NoClassDefFoundError e) {
                throw new GenericEntityException("Cannot find xapool.jar");
            } catch (ClassNotFoundException e) {
                throw new GenericEntityException("Cannot load wrapper class: " + wrapperClass, e);
            } catch (InstantiationException e) {
                throw new GenericEntityException("Unable to instantiate " + wrapperClass, e);
            } catch (IllegalAccessException e) {
                throw new GenericEntityException("Problems getting instance of " + wrapperClass, e);
            }

            if (ds == null)
                throw new GenericEntityException("StandardXaDataSource was not created, big problem!");

            ds.setDriverName(jdbcElement.getAttribute("jdbc-driver"));
            ds.setUrl(jdbcElement.getAttribute("jdbc-uri"));
            ds.setUser(jdbcElement.getAttribute("jdbc-username"));
            ds.setPassword(jdbcElement.getAttribute("jdbc-password"));
            ds.setDescription(helperName);
            ds.setTransactionManager(TransactionFactory.getTransactionManager());

            String transIso = jdbcElement.getAttribute("isolation-level");
            if (UtilValidate.isNotEmpty(transIso)) {
                if ("Serializable".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
                } else if ("RepeatableRead".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
                } else if ("ReadUncommitted".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
                } else if ("ReadCommitted".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
                } else if ("None".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_NONE);
                }
            }

            // set the datasource in the pool
            pds.setDataSource(ds);
            pds.setDescription(ds.getDescription());
            pds.setUser(ds.getUser());
            pds.setPassword(ds.getPassword());
            Debug.logInfo("XADataSource: " + ds.getClass().getName() + " attached to pool.", module);

            // set the transaction manager in the pool
            pds.setTransactionManager(TransactionFactory.getTransactionManager());

            // configure the pool settings
View Full Code Here

            }
           
            // the xapool wrapper class
            String wrapperClass = jotmJdbcElement.getAttribute("pool-xa-wrapper-class");
           
            StandardXADataSource ds = null;        
            try {           
                //ds =  new StandardXADataSource();               
                ds = (StandardXADataSource) ObjectType.getInstance(wrapperClass);
                pds = new StandardXAPoolDataSource();
            } catch (NoClassDefFoundError e) {               
                throw new GenericEntityException("Cannot find xapool.jar");                      
            } catch (ClassNotFoundException e) {
                throw new GenericEntityException("Cannot load wrapper class: " + wrapperClass, e);               
            } catch (InstantiationException e) {
                throw new GenericEntityException("Unable to instantiate " + wrapperClass, e);               
            } catch (IllegalAccessException e) {
                throw new GenericEntityException("Problems getting instance of " + wrapperClass, e);               
            }
           
            if (ds == null)
                throw new GenericEntityException("StandardXaDataSource was not created, big problem!");
           
            ds.setDriverName(jotmJdbcElement.getAttribute("jdbc-driver"));
            ds.setUrl(jotmJdbcElement.getAttribute("jdbc-uri"));
            ds.setUser(jotmJdbcElement.getAttribute("jdbc-username"));
            ds.setPassword(jotmJdbcElement.getAttribute("jdbc-password"));
            ds.setDescription(helperName)
            ds.setTransactionManager(TransactionFactory.getTransactionManager());
           
            String transIso = jotmJdbcElement.getAttribute("isolation-level");
            if (transIso != null && transIso.length() > 0) {
                if ("Serializable".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
                } else if ("RepeatableRead".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
                } else if ("ReadUncommitted".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
                } else if ("ReadCommitted".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
                } else if ("None".equals(transIso)) {
                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_NONE);
                }                                           
            }
           
            // set the datasource in the pool           
            pds.setDataSource(ds);
            pds.setDescription(ds.getDescription());
            pds.setUser(ds.getUser());
            pds.setPassword(ds.getPassword());
            Debug.logInfo("XADataSource: " + ds.getClass().getName() + " attached to pool.", module);
           
            // set the transaction manager in the pool
            pds.setTransactionManager(TransactionFactory.getTransactionManager());
           
            // configure the pool settings          
View Full Code Here

     * transaction factory. which is not bound to a registry.
     */
    try {
      jotm = new Jotm(true, false);

      xads = new StandardXADataSource();
      ((StandardXADataSource) xads).setDriverName(jdbcResource
          .getClassName());
      ((StandardXADataSource) xads).setUrl(jdbcResource.getUrl());
      ((StandardXADataSource) xads).setTransactionManager(jotm
          .getTransactionManager());
View Full Code Here

    }

    @Override
    protected DataSource createDataSource() throws Exception
    {
        StandardXADataSource ds = new StandardXADataSource();
        ds.setDriverName(EMBEDDED_DRIVER_NAME);
        ds.setUrl(EMBEDDED_CONNECTION_STRING);
        ds.setTransactionManager(txManager);
        return new DataSourceWrapper(ds);
    }
View Full Code Here

        }
    }

    private DataSource createSingleDataSource() throws SQLException
    {
        StandardDataSource dataSource = useXaTransactions ? new StandardXADataSource() : new StandardDataSource();
        dataSource.setDriverName(driverClassName);
        if (connectionTimeout >= 0)
        {
            dataSource.setLoginTimeout(connectionTimeout);
        }
View Full Code Here

TOP

Related Classes of org.enhydra.jdbc.standard.StandardXADataSource

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.