Package org.quartz.utils

Examples of org.quartz.utils.ConnectionProvider


    setDontSetAutoCommitFalse(true);

    // Register transactional ConnectionProvider for Quartz.
    DBConnectionManager.getInstance().addConnectionProvider(
        TX_DATA_SOURCE_PREFIX + getInstanceName(),
        new ConnectionProvider() {
          public Connection getConnection() throws SQLException {
            // Return a transactional Connection, if any.
            return DataSourceUtils.doGetConnection(dataSource);
          }
          public void shutdown() {
            // Do nothing - a Spring-managed DataSource has its own lifecycle.
          }
        }
    );

    // Non-transactional DataSource is optional: fall back to default
    // DataSource if not explicitly specified.
    DataSource nonTxDataSource = SchedulerFactoryBean.getConfigTimeNonTransactionalDataSource();
    final DataSource nonTxDataSourceToUse =
        (nonTxDataSource != null ? nonTxDataSource : this.dataSource);

    // Configure non-transactional connection settings for Quartz.
    setNonManagedTXDataSource(NON_TX_DATA_SOURCE_PREFIX + getInstanceName());

    // Register non-transactional ConnectionProvider for Quartz.
    DBConnectionManager.getInstance().addConnectionProvider(
        NON_TX_DATA_SOURCE_PREFIX + getInstanceName(),
        new ConnectionProvider() {
          public Connection getConnection() throws SQLException {
            // Always return a non-transactional Connection.
            return nonTxDataSourceToUse.getConnection();
          }
          public void shutdown() {
View Full Code Here


        }

        String dsName = dsConfig.getValue();
        String dsType = dsConfig.getAttribute("provider", "jndi");

        ConnectionProvider provider;
        if (dsType.equals("jndi")) {
            provider = new JNDIConnectionProvider(dsName, false);
        } else if (dsType.equals("excalibur")) {
            provider = new DataSourceComponentConnectionProvider(dsName, this.manager);
        } else {
View Full Code Here

            String cpClass = pp.getStringProperty(PROP_CONNECTION_PROVIDER_CLASS, null);

            // custom connectionProvider...
            if(cpClass != null) {
                ConnectionProvider cp = null;
                try {
                    cp = (ConnectionProvider) loadHelper.loadClass(cpClass).newInstance();
                } catch (Exception e) {
                    initException = new SchedulerException("ConnectionProvider class '" + cpClass
                            + "' could not be instantiated.", e);
View Full Code Here

            String cpClass = pp.getStringProperty(PROP_CONNECTION_PROVIDER_CLASS, null);

            // custom connectionProvider...
            if(cpClass != null) {
                ConnectionProvider cp = null;
                try {
                    cp = (ConnectionProvider) loadHelper.loadClass(cpClass).newInstance();
                } catch (Exception e) {
                    initException = new SchedulerException("ConnectionProvider class '" + cpClass
                            + "' could not be instantiated.", e);
                    throw initException;
                }

                try {
                    // remove the class name, so it isn't attempted to be set
                    pp.getUnderlyingProperties().remove(
                            PROP_CONNECTION_PROVIDER_CLASS);

                    setBeanProps(cp, pp.getUnderlyingProperties());
                    cp.initialize();
                } catch (Exception e) {
                    initException = new SchedulerException("ConnectionProvider class '" + cpClass
                            + "' props could not be configured.", e);
                    throw initException;
                }
View Full Code Here

        }

        String dsName = dsConfig.getValue();
        String dsType = dsConfig.getAttribute("provider", "jndi");

        ConnectionProvider provider;
        if (dsType.equals("jndi")) {
            provider = new JNDIConnectionProvider(dsName, false);
        } else if (dsType.equals("excalibur")) {
            provider = new DataSourceComponentConnectionProvider(dsName, this.manager);
        } else {
View Full Code Here

        }

        String dsName = dsConfig.getValue();
        String dsType = dsConfig.getAttribute("provider", "jndi");

        ConnectionProvider provider;
        if (dsType.equals("jndi")) {
            provider = new JNDIConnectionProvider(dsName, false);
        } else if (dsType.equals("excalibur")) {
            provider = new DataSourceComponentConnectionProvider(dsName, this.manager);
        } else {
View Full Code Here

        }

        String dsName = dsConfig.getValue();
        String dsType = dsConfig.getAttribute("provider", "jndi");

        ConnectionProvider provider;
        if (dsType.equals("jndi")) {
            provider = new JNDIConnectionProvider(dsName, false);
        } else if (dsType.equals("excalibur")) {
            provider = new DataSourceComponentConnectionProvider(dsName, this.manager);
        } else {
View Full Code Here

    setDontSetAutoCommitFalse(true);

    // Register transactional ConnectionProvider for Quartz.
    DBConnectionManager.getInstance().addConnectionProvider(
        TX_DATA_SOURCE_PREFIX + getInstanceName(),
        new ConnectionProvider() {
          @Override
          public Connection getConnection() throws SQLException {
            // Return a transactional Connection, if any.
            return DataSourceUtils.doGetConnection(dataSource);
          }
          @Override
          public void shutdown() {
            // Do nothing - a Spring-managed DataSource has its own lifecycle.
          }
          /* Quartz 2.2 initialize method */
          public void initialize() {
            // Do nothing - a Spring-managed DataSource has its own lifecycle.
          }
        }
    );

    // Non-transactional DataSource is optional: fall back to default
    // DataSource if not explicitly specified.
    DataSource nonTxDataSource = SchedulerFactoryBean.getConfigTimeNonTransactionalDataSource();
    final DataSource nonTxDataSourceToUse = (nonTxDataSource != null ? nonTxDataSource : this.dataSource);

    // Configure non-transactional connection settings for Quartz.
    setNonManagedTXDataSource(NON_TX_DATA_SOURCE_PREFIX + getInstanceName());

    // Register non-transactional ConnectionProvider for Quartz.
    DBConnectionManager.getInstance().addConnectionProvider(
        NON_TX_DATA_SOURCE_PREFIX + getInstanceName(),
        new ConnectionProvider() {
          @Override
          public Connection getConnection() throws SQLException {
            // Always return a non-transactional Connection.
            return nonTxDataSourceToUse.getConnection();
          }
View Full Code Here

    setDontSetAutoCommitFalse(true);

    // Register transactional ConnectionProvider for Quartz.
    DBConnectionManager.getInstance().addConnectionProvider(
        TX_DATA_SOURCE_PREFIX + getInstanceName(),
        new ConnectionProvider() {
          public Connection getConnection() throws SQLException {
            // Return a transactional Connection, if any.
            return DataSourceUtils.doGetConnection(dataSource);
          }
          public void shutdown() {
            // Do nothing - a Spring-managed DataSource has its own lifecycle.
          }
        }
    );

    // Non-transactional DataSource is optional: fall back to default
    // DataSource if not explicitly specified.
    DataSource nonTxDataSource = SchedulerFactoryBean.getConfigTimeNonTransactionalDataSource();
    final DataSource nonTxDataSourceToUse =
        (nonTxDataSource != null ? nonTxDataSource : this.dataSource);

    // Configure non-transactional connection settings for Quartz.
    setNonManagedTXDataSource(NON_TX_DATA_SOURCE_PREFIX + getInstanceName());

    // Register non-transactional ConnectionProvider for Quartz.
    DBConnectionManager.getInstance().addConnectionProvider(
        NON_TX_DATA_SOURCE_PREFIX + getInstanceName(),
        new ConnectionProvider() {
          public Connection getConnection() throws SQLException {
            // Always return a non-transactional Connection.
            return nonTxDataSourceToUse.getConnection();
          }
          public void shutdown() {
View Full Code Here

/*  667 */       PropertiesParser pp = new PropertiesParser(this.cfg.getPropertyGroup("org.quartz.dataSource." + dsNames[i], true));
/*      */
/*  670 */       String cpClass = pp.getStringProperty("connectionProvider.class", null);
/*      */
/*  673 */       if (cpClass != null) {
/*  674 */         ConnectionProvider cp = null;
/*      */         try {
/*  676 */           cp = (ConnectionProvider)loadHelper.loadClass(cpClass).newInstance();
/*      */         } catch (Exception e) {
/*  678 */           this.initException = new SchedulerException("ConnectionProvider class '" + cpClass + "' could not be instantiated.", e);
/*      */
View Full Code Here

TOP

Related Classes of org.quartz.utils.ConnectionProvider

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.