Search in sources :

Example 1 with ServerSettings

use of com.radensolutions.reporting.service.ServerSettings in project netxms by netxms.

the class Launcher method registerReportingDataSources.

private static void registerReportingDataSources(AnnotationConfigApplicationContext context) {
    ServerSettings settings = context.getBean(ServerSettings.class);
    Set<String> registeredDataSources = settings.getReportingDataSources();
    for (String name : registeredDataSources) {
        BeanDefinition definition = new RootBeanDefinition(BasicDataSource.class);
        ServerSettings.DataSourceConfig dataSourceConfig = settings.getDataSourceConfig(name);
        definition.getPropertyValues().add("driverClassName", dataSourceConfig.getDriver());
        definition.getPropertyValues().add("url", dataSourceConfig.getUrl());
        definition.getPropertyValues().add("username", dataSourceConfig.getUsername());
        definition.getPropertyValues().add("password", dataSourceConfig.getPassword());
        context.registerBeanDefinition(name, definition);
    }
}
Also used : ServerSettings(com.radensolutions.reporting.service.ServerSettings) RootBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition) RootBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition) BeanDefinition(org.springframework.beans.factory.config.BeanDefinition)

Aggregations

ServerSettings (com.radensolutions.reporting.service.ServerSettings)1 BeanDefinition (org.springframework.beans.factory.config.BeanDefinition)1 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)1