* @see org.springframework.beans.factory.FactoryBean#getObject()
*/
public Object getObject() throws Exception {
if(StringUtils.hasText(dataSourceJndiName)) {
logger.info("JNDI datasource requested, looking up datasource from JNDI name: '" + dataSourceJndiName + "'");
JndiObjectFactoryBean factoryBean = new JndiObjectFactoryBean();
factoryBean.setJndiName(dataSourceJndiName);
// "java:comp/env/" will be prefixed if the JNDI name doesn't already have it
factoryBean.setResourceRef(true);
// This step actually does the JNDI lookup
try {
factoryBean.afterPropertiesSet();
} catch(Exception e) {
logger.error("datasource init from JNDI failed : " + e);
logger.error("aborting application startup");
throw new RuntimeException(e);
} // end try..catch
dataSource = (DataSource) factoryBean.getObject();
} else if(url.startsWith("jdbc:hsqldb:file")) {
logger.info("embedded HSQLDB mode detected, switching on spring single connection data source");
SingleConnectionDataSource ds = new SingleConnectionDataSource();
ds.setUrl(url);
ds.setDriverClassName(driverClassName);