From 332d3ffe3125b56a7852afeff7902ebc7d38966a Mon Sep 17 00:00:00 2001 From: ljacomet Date: Tue, 19 Feb 2013 03:19:15 +0000 Subject: [PATCH] QTZ-337 Change creation of PoolingConnectionProvider so that all defined properties are honored. merge 2213 --- .../org/quartz/impl/StdSchedulerFactory.java | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/quartz-core/src/main/java/org/quartz/impl/StdSchedulerFactory.java b/quartz-core/src/main/java/org/quartz/impl/StdSchedulerFactory.java index 1ddf5502d..76cb55eb6 100644 --- a/quartz-core/src/main/java/org/quartz/impl/StdSchedulerFactory.java +++ b/quartz-core/src/main/java/org/quartz/impl/StdSchedulerFactory.java @@ -214,16 +214,40 @@ public class StdSchedulerFactory implements SchedulerFactory { public static final String PROP_CONNECTION_PROVIDER_CLASS = "connectionProvider.class"; + /** + * @deprecated Replaced with {@link PoolingConnectionProvider#DB_DRIVER} + */ + @Deprecated public static final String PROP_DATASOURCE_DRIVER = "driver"; + /** + * @deprecated Replaced with {@link PoolingConnectionProvider#DB_URL} + */ + @Deprecated public static final String PROP_DATASOURCE_URL = "URL"; + /** + * @deprecated Replaced with {@link PoolingConnectionProvider#DB_USER} + */ + @Deprecated public static final String PROP_DATASOURCE_USER = "user"; + /** + * @deprecated Replaced with {@link PoolingConnectionProvider#DB_PASSWORD} + */ + @Deprecated public static final String PROP_DATASOURCE_PASSWORD = "password"; + /** + * @deprecated Replaced with {@link PoolingConnectionProvider#DB_MAX_CONNECTIONS} + */ + @Deprecated public static final String PROP_DATASOURCE_MAX_CONNECTIONS = "maxConnections"; + /** + * @deprecated Replaced with {@link PoolingConnectionProvider#DB_VALIDATION_QUERY} + */ + @Deprecated public static final String PROP_DATASOURCE_VALIDATION_QUERY = "validationQuery"; public static final String PROP_DATASOURCE_JNDI_URL = "jndiURL"; @@ -971,12 +995,8 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) { dbMgr = DBConnectionManager.getInstance(); dbMgr.addConnectionProvider(dsNames[i], cp); } else { - String dsDriver = pp.getStringProperty(PROP_DATASOURCE_DRIVER); - String dsURL = pp.getStringProperty(PROP_DATASOURCE_URL); - String dsUser = pp.getStringProperty(PROP_DATASOURCE_USER, ""); - String dsPass = pp.getStringProperty(PROP_DATASOURCE_PASSWORD, ""); - int dsCnt = pp.getIntProperty(PROP_DATASOURCE_MAX_CONNECTIONS, 10); - String dsValidation = pp.getStringProperty(PROP_DATASOURCE_VALIDATION_QUERY); + String dsDriver = pp.getStringProperty(PoolingConnectionProvider.DB_DRIVER); + String dsURL = pp.getStringProperty(PoolingConnectionProvider.DB_URL); if (dsDriver == null) { initException = new SchedulerException( @@ -991,9 +1011,7 @@ else if (schedInstId.equals(SYSTEM_PROPERTY_AS_INSTANCE_ID)) { throw initException; } try { - PoolingConnectionProvider cp = new PoolingConnectionProvider( - dsDriver, dsURL, dsUser, dsPass, dsCnt, - dsValidation); + PoolingConnectionProvider cp = new PoolingConnectionProvider(pp.getUnderlyingProperties()); dbMgr = DBConnectionManager.getInstance(); dbMgr.addConnectionProvider(dsNames[i], cp); } catch (SQLException sqle) {