use of org.springframework.jndi.JndiObjectFactoryBean in project vorto by eclipse.
the class QPidConfiguration method honoConnectionFactory.
@Bean
public JndiObjectFactoryBean honoConnectionFactory() {
JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();
jndiObjectFactoryBean.setJndiTemplate(jndiTemplate());
jndiObjectFactoryBean.setJndiName("vorto");
return jndiObjectFactoryBean;
}
use of org.springframework.jndi.JndiObjectFactoryBean in project midpoint by Evolveum.
the class DataSourceFactory method createJNDIDataSource.
private DataSource createJNDIDataSource() throws IllegalArgumentException, NamingException {
JndiObjectFactoryBean factory = new JndiObjectFactoryBean();
factory.setJndiName(configuration.getDataSource());
factory.afterPropertiesSet();
return (DataSource) factory.getObject();
}
use of org.springframework.jndi.JndiObjectFactoryBean in project midpoint by Evolveum.
the class DataSourceFactory method createJndiDataSource.
private DataSource createJndiDataSource() throws IllegalArgumentException, NamingException {
JndiObjectFactoryBean factory = new JndiObjectFactoryBean();
factory.setJndiName(configuration.getDataSource());
factory.afterPropertiesSet();
return (DataSource) factory.getObject();
}
use of org.springframework.jndi.JndiObjectFactoryBean in project symmetric-ds by JumpMind.
the class ClientSymmetricEngine method createDatabasePlatform.
public static IDatabasePlatform createDatabasePlatform(ApplicationContext springContext, TypedProperties properties, DataSource dataSource, boolean waitOnAvailableDatabase) {
if (dataSource == null) {
String jndiName = properties.getProperty(ParameterConstants.DB_JNDI_NAME);
if (StringUtils.isNotBlank(jndiName)) {
try {
log.info("Looking up datasource in jndi. The jndi name is {}", jndiName);
JndiObjectFactoryBean jndiFactory = new JndiObjectFactoryBean();
jndiFactory.setJndiName(jndiName);
jndiFactory.afterPropertiesSet();
dataSource = (DataSource) jndiFactory.getObject();
if (dataSource == null) {
throw new SymmetricException("Could not locate the configured datasource in jndi. The jndi name is %s", jndiName);
}
} catch (IllegalArgumentException e) {
throw new SymmetricException("Could not locate the configured datasource in jndi. The jndi name is %s", e, jndiName);
} catch (NamingException e) {
throw new SymmetricException("Could not locate the configured datasource in jndi. The jndi name is %s", e, jndiName);
}
}
String springBeanName = properties.getProperty(ParameterConstants.DB_SPRING_BEAN_NAME);
if (isNotBlank(springBeanName) && springContext != null) {
log.info("Using datasource from spring. The spring bean name is {}", springBeanName);
dataSource = (DataSource) springContext.getBean(springBeanName);
}
if (dataSource == null) {
dataSource = BasicDataSourceFactory.create(properties, SecurityServiceFactory.create(SecurityServiceType.CLIENT, properties));
}
}
if (waitOnAvailableDatabase) {
waitForAvailableDatabase(dataSource);
}
boolean delimitedIdentifierMode = properties.is(ParameterConstants.DB_DELIMITED_IDENTIFIER_MODE, true);
return JdbcDatabasePlatformFactory.createNewPlatformInstance(dataSource, createSqlTemplateSettings(properties), delimitedIdentifierMode);
}
Aggregations