{
throw new RuntimeException("Please ensure that all of the following jms.jdbc.* properties " +
"are specified for a custom JMS data source: url, driver, user, password");
}
JDBCInfo jdbcInfo = JDBCInfo.getInstance(sJMSDBURL);
RelationalDatabase jmsDB = new RelationalDatabase(sJMSDBName);
RelationalDatabaseFragment jmsDBFragment = (RelationalDatabaseFragment)jmsDB.getDefaultFragment();
jmsDB.setAlias(sJMSDBName);
jmsDB.setUnicode(false);
jmsDB.setAdapter(new DataSourceAdapter(jdbcInfo.getDBTypeName()));
jmsDBFragment.setAlias(sJMSDBName + jmsDBFragment.getSuffix());
jmsDBFragment.setUser(sJMSDBUser);
jmsDBFragment.setPassword(sJMSDBPassword);
int nMinPoolSize;
int nMaxPoolSize;
try
{
String sMaxPoolSize = m_properties.getProperty("jms.jdbc.maxPoolSize");
nMaxPoolSize = (sMaxPoolSize == null) ? getJMSDSMaxPoolSize() : Integer.parseInt(sMaxPoolSize);
}
catch (NumberFormatException e)
{
throw new IllegalArgumentException("Invalid JMS DS maxPoolSize \"" + m_properties.getProperty("jms.jdbc.maxPoolSize") + "\"", e);
}
try
{
String sMinPoolSize = m_properties.getProperty("jms.jdbc.minPoolSize");
nMinPoolSize = (sMinPoolSize == null) ? Math.min(3, nMaxPoolSize) : Integer.parseInt(sMinPoolSize);
}
catch (NumberFormatException e)
{
throw new IllegalArgumentException("Invalid JMS DS minPoolSize \"" + m_properties.getProperty("jms.jdbc.minPoolSize") + "\"", e);
}
jmsDBFragment.setMinPoolSize(nMinPoolSize);
jmsDBFragment.setMaxPoolSize(nMaxPoolSize);
String sCustomProps = m_properties.getProperty("jms.jdbc.properties");
if (sCustomProps != null)
{
Properties properties = PropertyUtil.fromString(sCustomProps);
for (Iterator itr = properties.entrySet().iterator(); itr.hasNext();)
{
Map.Entry entry = (Map.Entry)itr.next();
jmsDBFragment.getPropertyHolder().addDefaultProperty((String)entry.getKey(), (String)entry.getValue());
}
}
return new JDBCConnectionInfo(jmsDB, sJMSDBDriver, sJMSDBURL, jdbcInfo.getTestSQL());
}