Class C3p0DataSourceProvider

  • All Implemented Interfaces:
    javax.inject.Provider<javax.sql.DataSource>

    public final class C3p0DataSourceProvider
    extends java.lang.Object
    implements javax.inject.Provider<javax.sql.DataSource>
    Provides the C3P0 DataSource.
    • Constructor Detail

      • C3p0DataSourceProvider

        @Inject
        public C3p0DataSourceProvider​(@Named("JDBC.driver")
                                      java.lang.String driver,
                                      @Named("JDBC.url")
                                      java.lang.String url)
        Creates a new ComboPooledDataSource using the needed parameter.
        Parameters:
        driver - The JDBC driver class.
        url - the database URL of the form jdbc:subprotocol:subname.
    • Method Detail

      • setUser

        @Inject(optional=true)
        public void setUser​(@Named("JDBC.username")
                            java.lang.String username)
        Sets the user.
        Parameters:
        username - the new user
        Since:
        3.3
      • setPassword

        @Inject(optional=true)
        public void setPassword​(@Named("JDBC.password")
                                java.lang.String password)
        Sets the password.
        Parameters:
        password - the new password
        Since:
        3.3
      • setAcquireIncrement

        @Inject(optional=true)
        public void setAcquireIncrement​(@Named("c3p0.acquireIncrement")
                                        int acquireIncrement)
        Sets the acquire increment.
        Parameters:
        acquireIncrement - the new acquire increment
      • setAcquireRetryAttempts

        @Inject(optional=true)
        public void setAcquireRetryAttempts​(@Named("c3p0.acquireRetryAttempts")
                                            int acquireRetryAttempts)
        Sets the acquire retry attempts.
        Parameters:
        acquireRetryAttempts - the new acquire retry attempts
      • setAcquireRetryDelay

        @Inject(optional=true)
        public void setAcquireRetryDelay​(@Named("c3p0.acquireRetryDelay")
                                         int acquireRetryDelay)
        Sets the acquire retry delay.
        Parameters:
        acquireRetryDelay - the new acquire retry delay
      • setAutoCommitOnClose

        @Inject(optional=true)
        public void setAutoCommitOnClose​(@Named("JDBC.autoCommit")
                                         boolean autoCommit)
        Sets the auto commit on close.
        Parameters:
        autoCommit - the new auto commit on close
      • setDriverProperties

        @Inject(optional=true)
        public void setDriverProperties​(@Named("JDBC.driverProperties")
                                        java.util.Properties driverProperties)
        Sets the driver properties.
        Parameters:
        driverProperties - the new driver properties
      • setAautomaticTestTable

        @Inject(optional=true)
        public void setAautomaticTestTable​(@Named("c3p0.automaticTestTable")
                                           java.lang.String automaticTestTable)
        Sets the aautomatic test table.
        Parameters:
        automaticTestTable - the new aautomatic test table
      • setBreakAfterAcquireFailure

        @Inject(optional=true)
        public void setBreakAfterAcquireFailure​(@Named("c3p0.breakAfterAcquireFailure")
                                                boolean breakAfterAcquireFailure)
        Sets the break after acquire failure.
        Parameters:
        breakAfterAcquireFailure - the new break after acquire failure
      • setCheckoutTimeout

        @Inject(optional=true)
        public void setCheckoutTimeout​(@Named("c3p0.checkoutTimeout")
                                       int checkoutTimeout)
        Sets the checkout timeout.
        Parameters:
        checkoutTimeout - the new checkout timeout
      • setConnectionCustomizerClassName

        @Inject(optional=true)
        public void setConnectionCustomizerClassName​(@Named("c3p0.connectionCustomizerClassName")
                                                     java.lang.String connectionCustomizerClassName)
        Sets the connection customizer class name.
        Parameters:
        connectionCustomizerClassName - the new connection customizer class name
      • setConnectionTesterClassName

        @Inject(optional=true)
        public void setConnectionTesterClassName​(@Named("c3p0.connectionTesterClassName")
                                                 java.lang.String connectionTesterClassName)
        Sets the connection tester class name.
        Parameters:
        connectionTesterClassName - the new connection tester class name
      • setIdleConnectionTestPeriod

        @Inject(optional=true)
        public void setIdleConnectionTestPeriod​(@Named("c3p0.idleConnectionTestPeriod")
                                                int idleConnectionTestPeriod)
        Sets the idle connection test period.
        Parameters:
        idleConnectionTestPeriod - the new idle connection test period
      • setInitialPoolSize

        @Inject(optional=true)
        public void setInitialPoolSize​(@Named("c3p0.initialPoolSize")
                                       int initialPoolSize)
        Sets the initial pool size.
        Parameters:
        initialPoolSize - the new initial pool size
      • setMaxAdministrativeTaskTime

        @Inject(optional=true)
        public void setMaxAdministrativeTaskTime​(@Named("c3p0.maxAdministrativeTaskTime")
                                                 int maxAdministrativeTaskTime)
        Sets the max administrative task time.
        Parameters:
        maxAdministrativeTaskTime - the new max administrative task time
      • setMaxConnectionAge

        @Inject(optional=true)
        public void setMaxConnectionAge​(@Named("c3p0.maxConnectionAge")
                                        int maxConnectionAge)
        Sets the max connection age.
        Parameters:
        maxConnectionAge - the new max connection age
      • setMaxIdleTime

        @Inject(optional=true)
        public void setMaxIdleTime​(@Named("c3p0.maxIdleTime")
                                   int maxIdleTime)
        Sets the max idle time.
        Parameters:
        maxIdleTime - the new max idle time
      • setMaxIdleTimeExcessConnections

        @Inject(optional=true)
        public void setMaxIdleTimeExcessConnections​(@Named("c3p0.maxIdleTimeExcessConnections")
                                                    int maxIdleTimeExcessConnections)
        Sets the max idle time excess connections.
        Parameters:
        maxIdleTimeExcessConnections - the new max idle time excess connections
      • setMaxPoolSize

        @Inject(optional=true)
        public void setMaxPoolSize​(@Named("c3p0.maxPoolSize")
                                   int maxPoolSize)
        Sets the max pool size.
        Parameters:
        maxPoolSize - the new max pool size
      • setMaxStatements

        @Inject(optional=true)
        public void setMaxStatements​(@Named("c3p0.maxStatements")
                                     int maxStatements)
        Sets the max statements.
        Parameters:
        maxStatements - the new max statements
      • setMaxStatementsPerConnection

        @Inject(optional=true)
        public void setMaxStatementsPerConnection​(@Named("c3p0.maxStatementsPerConnection")
                                                  int maxStatementsPerConnection)
        Sets the max statements per connection.
        Parameters:
        maxStatementsPerConnection - the new max statements per connection
      • setMinPoolSize

        @Inject(optional=true)
        public void setMinPoolSize​(@Named("c3p0.minPoolSize")
                                   int minPoolSize)
        Sets the min pool size.
        Parameters:
        minPoolSize - the new min pool size
      • setPreferredTestQuery

        @Inject(optional=true)
        public void setPreferredTestQuery​(@Named("c3p0.preferredTestQuery")
                                          java.lang.String preferredTestQuery)
        Sets the preferred test query.
        Parameters:
        preferredTestQuery - the new preferred test query
      • setPropertyCycle

        @Inject(optional=true)
        public void setPropertyCycle​(@Named("c3p0.propertyCycle")
                                     int propertyCycle)
        Sets the property cycle.
        Parameters:
        propertyCycle - the new property cycle
      • setTestConnectionOnCheckin

        @Inject(optional=true)
        public void setTestConnectionOnCheckin​(@Named("c3p0.testConnectionOnCheckin")
                                               boolean testConnectionOnCheckin)
        Sets the test connection on checkin.
        Parameters:
        testConnectionOnCheckin - the new test connection on checkin
      • setTestConnectionOnCheckout

        @Inject(optional=true)
        public void setTestConnectionOnCheckout​(@Named("c3p0.testConnectionOnCheckout")
                                                boolean testConnectionOnCheckout)
        Sets the test connection on checkout.
        Parameters:
        testConnectionOnCheckout - the new test connection on checkout
      • setUnreturnedConnectionTimeout

        @Inject(optional=true)
        public void setUnreturnedConnectionTimeout​(@Named("c3p0.unreturnedConnectionTimeout")
                                                   int unreturnedConnectionTimeout)
        Sets the unreturned connection timeout.
        Parameters:
        unreturnedConnectionTimeout - the new unreturned connection timeout
      • setUsesTraditionalReflectiveProxies

        @Inject(optional=true)
        public void setUsesTraditionalReflectiveProxies​(@Named("c3p0.usesTraditionalReflectiveProxies")
                                                        boolean usesTraditionalReflectiveProxies)
        Sets the uses traditional reflective proxies.
        Parameters:
        usesTraditionalReflectiveProxies - the new uses traditional reflective proxies
      • get

        public javax.sql.DataSource get()
        Specified by:
        get in interface javax.inject.Provider<javax.sql.DataSource>