List of usage examples for java.util Properties propertyNames
public Enumeration<?> propertyNames()
From source file:org.imsglobal.lti2.LTI2Util.java
public static void substituteCustom(Properties custom, Properties lti2subst) { if (custom == null || lti2subst == null) return;//from ww w . jav a 2 s .com Enumeration<?> e = custom.propertyNames(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); String value = custom.getProperty(key); if (value == null || value.length() < 1) continue; String newValue = lti2subst.getProperty(value); if (newValue == null || newValue.length() < 1) continue; setProperty(custom, key, (String) newValue); } }
From source file:org.wso2.carbon.identity.event.EventManagementUtils.java
/** * @param prefix Prefix of the property key * @param propertiesWithFullKeys Set of properties which needs to be converted to single word key properties * @return Set of properties which has keys containing single word. *//*www. j ava 2s . co m*/ public static Properties buildSingleWordKeyProperties(String prefix, Properties propertiesWithFullKeys) { // Stop proceeding if required arguments are not present if (StringUtils.isEmpty(prefix) || propertiesWithFullKeys == null) { throw new IllegalArgumentException( "Prefix and properties should not be null to get properties with " + "single word keys."); } propertiesWithFullKeys = EventManagementUtils.getPropertiesWithPrefix(prefix, propertiesWithFullKeys); Properties properties = new Properties(); Enumeration propertyNames = propertiesWithFullKeys.propertyNames(); while (propertyNames.hasMoreElements()) { String key = (String) propertyNames.nextElement(); String newKey = key.substring(key.lastIndexOf(".") + 1, key.length()); if (!newKey.trim().isEmpty()) { // Remove from original properties to hold property schema. ie need to get the set of properties which // remains after consuming all required specific properties properties.put(newKey, propertiesWithFullKeys.remove(key)); } } return properties; }
From source file:org.wso2.carbon.identity.notification.mgt.NotificationManagementUtils.java
/** * @param prefix Prefix of the property key * @param propertiesWithFullKeys Set of properties which needs to be converted to single word key properties * @return Set of properties which has keys containing single word. *///from w w w . j ava 2 s . c om public static Properties buildSingleWordKeyProperties(String prefix, Properties propertiesWithFullKeys) { // Stop proceeding if required arguments are not present if (StringUtils.isEmpty(prefix) || propertiesWithFullKeys == null) { throw new IllegalArgumentException( "Prefix and properties should not be null to get properties with " + "single word keys."); } propertiesWithFullKeys = NotificationManagementUtils.getPropertiesWithPrefix(prefix, propertiesWithFullKeys); Properties properties = new Properties(); Enumeration propertyNames = propertiesWithFullKeys.propertyNames(); while (propertyNames.hasMoreElements()) { String key = (String) propertyNames.nextElement(); String newKey = key.substring(key.lastIndexOf(".") + 1, key.length()); if (!newKey.trim().isEmpty()) { // Remove from original properties to hold property schema. ie need to get the set of properties which // remains after consuming all required specific properties properties.put(newKey, propertiesWithFullKeys.remove(key)); } } return properties; }
From source file:gr.interamerican.bo2.utils.JavaBeanUtils.java
/** * Copies all common properties from a map to a target object. * /*from w w w. ja v a 2 s. c o m*/ * For non string properties, the method delegates the bean property * setting to the apache commons beanutils (http://commons.apache.org/beanutils/) * library. This pauses restriction to the formatting of any non * string property in the properties object. * <li> dates should be formatted as yyyy-MM-dd </li> * <li> decimal numbers must be formatted using as xxx.dd </li> * * @param source * Source properties object. * @param target * Object to which the properties will be copied. */ public static void copyFromProperties(Properties source, Object target) { Enumeration<?> names = source.propertyNames(); while (names.hasMoreElements()) { String propertyName = (String) names.nextElement(); String propertyValue = source.getProperty(propertyName); setPropertyTo(target, propertyName, propertyValue); } }
From source file:net.sourceforge.czt.gnast.Gnast.java
/** * Returns a property list of all the properties in <code>props</code> * that start with the given <code>prefix</code>. * Furthermore, the values of both properties are equal. * * @param prefix //from w w w .j a va 2 s . c o m * @param props * @return should never be <code>null</code>. */ public static Properties withPrefix(String prefix, Properties props) { Properties result = new Properties(); for (Enumeration<?> e = props.propertyNames(); e.hasMoreElements();) { String propertyName = (String) e.nextElement(); if (propertyName.startsWith(prefix)) result.setProperty(propertyName, props.getProperty(propertyName)); } return result; }
From source file:net.aepik.alasca.core.ldap.Schema.java
/** * Get sorted object identifiers keys, to loop on object identifiers * into a valid order.//from w w w.j a v a 2 s . c o m * @param oids Object identifiers. * @return String[] Sorted keys */ public static String[] getSortedObjectsIdentifiersKeys(Properties oids) { Hashtable<String, String> ht = new Hashtable<String, String>(); for (Enumeration keys = oids.propertyNames(); keys.hasMoreElements();) { String k = (String) keys.nextElement(); Oid o = new Oid(oids.getProperty(k)); String v = o.toString(); String p = o.getPrefix(); while (p != null) { v = v.replaceFirst(p + ":", oids.getProperty(p) + "."); p = (new Oid(oids.getProperty(p))).getPrefix(); } ht.put(v, k); } String[] st = ht.keySet().toArray(new String[0]); Arrays.sort(st); String[] result = new String[st.length]; int result_index = 0; for (String k : st) { result[result_index] = ht.get(k); result_index++; } return result; }
From source file:com.liferay.ide.server.util.ServerUtil.java
public static Properties getPortletCategories(IPath portalDir) { Properties props = getAllCategories(portalDir); Properties categories = new Properties(); Enumeration<?> names = props.propertyNames(); String[] controlPanelCategories = { "category.my", //$NON-NLS-1$ "category.users", //$NON-NLS-1$ "category.apps", //$NON-NLS-1$ "category.configuration", //$NON-NLS-1$ "category.sites", //$NON-NLS-1$ "category.site_administration.configuration", //$NON-NLS-1$ "category.site_administration.content", //$NON-NLS-1$ "category.site_administration.pages", //$NON-NLS-1$ "category.site_administration.users" //$NON-NLS-1$ };/* www . j av a 2 s .c om*/ while (names.hasMoreElements()) { boolean isControlPanelCategory = false; String name = names.nextElement().toString(); for (String category : controlPanelCategories) { if (name.equals(category)) { isControlPanelCategory = true; break; } } if (!isControlPanelCategory) { categories.put(name, props.getProperty(name)); } } return categories; }
From source file:org.kawanfw.sql.tomcat.TomcatStarterUtil.java
/** * Returns the index from the servlet name * //from w w w. j a v a 2 s. c o m * @param properties * Properties extracted from the server-sql.properties files * @param serverSqlManagerServletName * The Server SQL servlet name that is defined in a property of * properties * @return the index corresponding to the Server SQL servlet name * @throws IllegalArgumentException */ public static String getIndexFromServletName(Properties properties, String serverSqlManagerServletName) throws IllegalArgumentException { if (properties == null) { throw new IllegalArgumentException("properties can not be null"); } if (serverSqlManagerServletName == null) { throw new IllegalArgumentException("serverSqlManagerServletName can not be null"); } serverSqlManagerServletName = serverSqlManagerServletName.trim(); for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) { String propertyName = (String) e.nextElement(); String propertyValue = properties.getProperty(propertyName); propertyValue = propertyValue.trim(); if (propertyValue.equals(serverSqlManagerServletName)) { String index = null; propertyName = propertyName.trim(); if (!propertyName.contains(".")) { index = ""; // First Servlet, no index } else { index = "." + StringUtils.substringAfterLast(propertyName, "."); } return index; } } throw new SqlConfigurationException( "Server SQL Manager servlet name not found in properties file: " + serverSqlManagerServletName); }
From source file:JDBCPool.dbcp.demo.sourcecode.BasicDataSourceFactory.java
/** * Creates and configures a {@link BasicDataSource} instance based on the * given properties./*from w w w. ja v a 2 s . c o m*/ * * @param properties the datasource configuration properties * @throws Exception if an error occurs creating the data source */ public static BasicDataSource createDataSource(Properties properties) throws Exception { BasicDataSource dataSource = new BasicDataSource(); String value = null; value = properties.getProperty(PROP_DEFAULTAUTOCOMMIT); if (value != null) { dataSource.setDefaultAutoCommit(Boolean.valueOf(value)); } value = properties.getProperty(PROP_DEFAULTREADONLY); if (value != null) { dataSource.setDefaultReadOnly(Boolean.valueOf(value)); } value = properties.getProperty(PROP_DEFAULTTRANSACTIONISOLATION); if (value != null) { int level = PoolableConnectionFactory.UNKNOWN_TRANSACTIONISOLATION; if ("NONE".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_NONE; } else if ("READ_COMMITTED".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_READ_COMMITTED; } else if ("READ_UNCOMMITTED".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_READ_UNCOMMITTED; } else if ("REPEATABLE_READ".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_REPEATABLE_READ; } else if ("SERIALIZABLE".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_SERIALIZABLE; } else { try { level = Integer.parseInt(value); } catch (NumberFormatException e) { System.err.println("Could not parse defaultTransactionIsolation: " + value); System.err.println("WARNING: defaultTransactionIsolation not set"); System.err.println("using default value of database driver"); level = PoolableConnectionFactory.UNKNOWN_TRANSACTIONISOLATION; } } dataSource.setDefaultTransactionIsolation(level); } value = properties.getProperty(PROP_DEFAULTCATALOG); if (value != null) { dataSource.setDefaultCatalog(value); } value = properties.getProperty(PROP_CACHESTATE); if (value != null) { dataSource.setCacheState(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_DRIVERCLASSNAME); if (value != null) { dataSource.setDriverClassName(value); } value = properties.getProperty(PROP_LIFO); if (value != null) { dataSource.setLifo(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_MAXTOTAL); if (value != null) { dataSource.setMaxTotal(Integer.parseInt(value)); } value = properties.getProperty(PROP_MAXIDLE); if (value != null) { dataSource.setMaxIdle(Integer.parseInt(value)); } value = properties.getProperty(PROP_MINIDLE); if (value != null) { dataSource.setMinIdle(Integer.parseInt(value)); } value = properties.getProperty(PROP_INITIALSIZE); if (value != null) { dataSource.setInitialSize(Integer.parseInt(value)); } value = properties.getProperty(PROP_MAXWAITMILLIS); if (value != null) { dataSource.setMaxWaitMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_TESTONCREATE); if (value != null) { dataSource.setTestOnCreate(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_TESTONBORROW); if (value != null) { dataSource.setTestOnBorrow(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_TESTONRETURN); if (value != null) { dataSource.setTestOnReturn(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_TIMEBETWEENEVICTIONRUNSMILLIS); if (value != null) { dataSource.setTimeBetweenEvictionRunsMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_NUMTESTSPEREVICTIONRUN); if (value != null) { dataSource.setNumTestsPerEvictionRun(Integer.parseInt(value)); } value = properties.getProperty(PROP_MINEVICTABLEIDLETIMEMILLIS); if (value != null) { dataSource.setMinEvictableIdleTimeMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_SOFTMINEVICTABLEIDLETIMEMILLIS); if (value != null) { dataSource.setSoftMinEvictableIdleTimeMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_EVICTIONPOLICYCLASSNAME); if (value != null) { dataSource.setEvictionPolicyClassName(value); } value = properties.getProperty(PROP_TESTWHILEIDLE); if (value != null) { dataSource.setTestWhileIdle(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_PASSWORD); if (value != null) { dataSource.setPassword(value); } value = properties.getProperty(PROP_URL); if (value != null) { dataSource.setUrl(value); } value = properties.getProperty(PROP_USERNAME); if (value != null) { dataSource.setUsername(value); } value = properties.getProperty(PROP_VALIDATIONQUERY); if (value != null) { dataSource.setValidationQuery(value); } value = properties.getProperty(PROP_VALIDATIONQUERY_TIMEOUT); if (value != null) { dataSource.setValidationQueryTimeout(Integer.parseInt(value)); } value = properties.getProperty(PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED); if (value != null) { dataSource.setAccessToUnderlyingConnectionAllowed(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_REMOVEABANDONEDONBORROW); if (value != null) { dataSource.setRemoveAbandonedOnBorrow(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_REMOVEABANDONEDONMAINTENANCE); if (value != null) { dataSource.setRemoveAbandonedOnMaintenance(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_REMOVEABANDONEDTIMEOUT); if (value != null) { dataSource.setRemoveAbandonedTimeout(Integer.parseInt(value)); } value = properties.getProperty(PROP_LOGABANDONED); if (value != null) { dataSource.setLogAbandoned(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_POOLPREPAREDSTATEMENTS); if (value != null) { dataSource.setPoolPreparedStatements(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_MAXOPENPREPAREDSTATEMENTS); if (value != null) { dataSource.setMaxOpenPreparedStatements(Integer.parseInt(value)); } value = properties.getProperty(PROP_CONNECTIONINITSQLS); //?ConnectionSQL? if (value != null) { dataSource.setConnectionInitSqls(parseList(value, ';')); } value = properties.getProperty(PROP_CONNECTIONPROPERTIES); if (value != null) { Properties p = getProperties(value); Enumeration<?> e = p.propertyNames(); while (e.hasMoreElements()) { String propertyName = (String) e.nextElement(); dataSource.addConnectionProperty(propertyName, p.getProperty(propertyName)); } } value = properties.getProperty(PROP_MAXCONNLIFETIMEMILLIS); if (value != null) { dataSource.setMaxConnLifetimeMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_LOGEXPIREDCONNECTIONS); if (value != null) { dataSource.setLogExpiredConnections(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_JMX_NAME); if (value != null) { dataSource.setJmxName(value); } value = properties.getProperty(PROP_ENABLE_AUTOCOMMIT_ON_RETURN); if (value != null) { dataSource.setEnableAutoCommitOnReturn(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_ROLLBACK_ON_RETURN); if (value != null) { dataSource.setRollbackOnReturn(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_DEFAULT_QUERYTIMEOUT); if (value != null) { dataSource.setDefaultQueryTimeout(Integer.valueOf(value)); } value = properties.getProperty(PROP_FASTFAIL_VALIDATION); if (value != null) { dataSource.setFastFailValidation(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_DISCONNECTION_SQL_CODES); if (value != null) { dataSource.setDisconnectionSqlCodes(parseList(value, ',')); } // DBCP-215 // Trick to make sure that initialSize connections are created if (dataSource.getInitialSize() > 0) { dataSource.getLogWriter(); } // Return the configured DataSource instance return dataSource; }
From source file:com.frameworkset.commons.dbcp2.BasicDataSourceFactory.java
/** * Creates and configures a {@link BasicDataSource} instance based on the * given properties.//from ww w . j a va 2s. c o m * * @param properties the datasource configuration properties * @throws Exception if an error occurs creating the data source */ public static BasicDataSource createDataSource(Properties properties) throws Exception { BasicDataSource dataSource = new BasicDataSource(); String value = null; value = properties.getProperty(PROP_DEFAULTAUTOCOMMIT); if (value != null) { dataSource.setDefaultAutoCommit(Boolean.valueOf(value)); } value = properties.getProperty(PROP_DEFAULTREADONLY); if (value != null) { dataSource.setDefaultReadOnly(Boolean.valueOf(value)); } value = properties.getProperty(PROP_DEFAULTTRANSACTIONISOLATION); if (value != null) { int level = PoolableConnectionFactory.UNKNOWN_TRANSACTIONISOLATION; if ("NONE".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_NONE; } else if ("READ_COMMITTED".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_READ_COMMITTED; } else if ("READ_UNCOMMITTED".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_READ_UNCOMMITTED; } else if ("REPEATABLE_READ".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_REPEATABLE_READ; } else if ("SERIALIZABLE".equalsIgnoreCase(value)) { level = Connection.TRANSACTION_SERIALIZABLE; } else { try { level = Integer.parseInt(value); } catch (NumberFormatException e) { System.err.println("Could not parse defaultTransactionIsolation: " + value); System.err.println("WARNING: defaultTransactionIsolation not set"); System.err.println("using default value of database driver"); level = PoolableConnectionFactory.UNKNOWN_TRANSACTIONISOLATION; } } dataSource.setDefaultTransactionIsolation(level); } value = properties.getProperty(PROP_DEFAULTCATALOG); if (value != null) { dataSource.setDefaultCatalog(value); } value = properties.getProperty(PROP_CACHESTATE); if (value != null) { dataSource.setCacheState(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_DRIVERCLASSNAME); if (value != null) { dataSource.setDriverClassName(value); } value = properties.getProperty(PROP_LIFO); if (value != null) { dataSource.setLifo(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_MAXTOTAL); if (value != null) { dataSource.setMaxTotal(Integer.parseInt(value)); } value = properties.getProperty(PROP_MAXIDLE); if (value != null) { dataSource.setMaxIdle(Integer.parseInt(value)); } value = properties.getProperty(PROP_MINIDLE); if (value != null) { dataSource.setMinIdle(Integer.parseInt(value)); } value = properties.getProperty(PROP_INITIALSIZE); if (value != null) { dataSource.setInitialSize(Integer.parseInt(value)); } value = properties.getProperty(PROP_MAXWAITMILLIS); if (value != null) { dataSource.setMaxWaitMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_TESTONCREATE); if (value != null) { dataSource.setTestOnCreate(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_TESTONBORROW); if (value != null) { dataSource.setTestOnBorrow(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_TESTONRETURN); if (value != null) { dataSource.setTestOnReturn(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_TIMEBETWEENEVICTIONRUNSMILLIS); if (value != null) { dataSource.setTimeBetweenEvictionRunsMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_NUMTESTSPEREVICTIONRUN); if (value != null) { dataSource.setNumTestsPerEvictionRun(Integer.parseInt(value)); } value = properties.getProperty(PROP_MINEVICTABLEIDLETIMEMILLIS); if (value != null) { dataSource.setMinEvictableIdleTimeMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_SOFTMINEVICTABLEIDLETIMEMILLIS); if (value != null) { dataSource.setSoftMinEvictableIdleTimeMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_EVICTIONPOLICYCLASSNAME); if (value != null) { dataSource.setEvictionPolicyClassName(value); } value = properties.getProperty(PROP_TESTWHILEIDLE); if (value != null) { dataSource.setTestWhileIdle(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_PASSWORD); if (value != null) { dataSource.setPassword(value); } value = properties.getProperty(PROP_URL); if (value != null) { dataSource.setUrl(value); } value = properties.getProperty(PROP_USERNAME); if (value != null) { dataSource.setUsername(value); } value = properties.getProperty(PROP_VALIDATIONQUERY); if (value != null) { dataSource.setValidationQuery(value); } value = properties.getProperty(PROP_VALIDATIONQUERY_TIMEOUT); if (value != null) { dataSource.setValidationQueryTimeout(Integer.parseInt(value)); } value = properties.getProperty(PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED); if (value != null) { dataSource.setAccessToUnderlyingConnectionAllowed(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_REMOVEABANDONEDONBORROW); if (value != null) { dataSource.setRemoveAbandonedOnBorrow(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_REMOVEABANDONEDONMAINTENANCE); if (value != null) { dataSource.setRemoveAbandonedOnMaintenance(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_REMOVEABANDONEDTIMEOUT); if (value != null) { dataSource.setRemoveAbandonedTimeout(Integer.parseInt(value)); } value = properties.getProperty(PROP_LOGABANDONED); if (value != null) { dataSource.setLogAbandoned(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_POOLPREPAREDSTATEMENTS); if (value != null) { dataSource.setPoolPreparedStatements(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_MAXOPENPREPAREDSTATEMENTS); if (value != null) { dataSource.setMaxOpenPreparedStatements(Integer.parseInt(value)); } value = properties.getProperty(PROP_CONNECTIONINITSQLS); if (value != null) { dataSource.setConnectionInitSqls(parseList(value, ';')); } value = properties.getProperty(PROP_CONNECTIONPROPERTIES); if (value != null) { Properties p = getProperties(value); Enumeration<?> e = p.propertyNames(); while (e.hasMoreElements()) { String propertyName = (String) e.nextElement(); dataSource.addConnectionProperty(propertyName, p.getProperty(propertyName)); } } value = properties.getProperty(PROP_MAXCONNLIFETIMEMILLIS); if (value != null) { dataSource.setMaxConnLifetimeMillis(Long.parseLong(value)); } value = properties.getProperty(PROP_LOGEXPIREDCONNECTIONS); if (value != null) { dataSource.setLogExpiredConnections(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_JMX_NAME); if (value != null) { dataSource.setJmxName(value); } value = properties.getProperty(PROP_ENABLE_AUTOCOMMIT_ON_RETURN); if (value != null) { dataSource.setEnableAutoCommitOnReturn(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_ROLLBACK_ON_RETURN); if (value != null) { dataSource.setRollbackOnReturn(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_DEFAULT_QUERYTIMEOUT); if (value != null) { dataSource.setDefaultQueryTimeout(Integer.valueOf(value)); } value = properties.getProperty(PROP_FASTFAIL_VALIDATION); if (value != null) { dataSource.setFastFailValidation(Boolean.valueOf(value).booleanValue()); } value = properties.getProperty(PROP_DISCONNECTION_SQL_CODES); if (value != null) { dataSource.setDisconnectionSqlCodes(parseList(value, ',')); } // DBCP-215 // Trick to make sure that initialSize connections are created if (dataSource.getInitialSize() > 0) { dataSource.getLogWriter(); } // Return the configured DataSource instance return dataSource; }