use of com.evolveum.midpoint.repo.sqlbase.DataSourceFactory in project midpoint by Evolveum.
the class SqaleAuditServiceFactory method createSqaleRepoContext.
private SqaleRepoContext createSqaleRepoContext(Configuration configuration) throws RepositoryServiceFactoryException {
// one of these properties must be present to trigger separate audit datasource config
if (configuration.getString(PROPERTY_JDBC_URL) == null && configuration.getString(PROPERTY_DATASOURCE) == null) {
LOGGER.info("SQL audit service will use default repository configuration.");
return createSqaleRepoContext(SqaleRepositoryConfiguration.initForAudit(sqaleRepositoryConfiguration, configuration), repositoryDataSource, schemaService);
}
LOGGER.info("Configuring SQL audit service to use a different datasource");
SqaleRepositoryConfiguration config = new SqaleRepositoryConfiguration(configuration);
// normally Spring calls this, but for audit this is unmanaged bean
config.init();
DataSourceFactory dataSourceFactory = new DataSourceFactory(config);
DataSource dataSource = dataSourceFactory.createDataSource("mp-audit");
return createSqaleRepoContext(config, dataSource, schemaService);
}
Aggregations