Search in sources :

Example 1 with DataSourceFactory

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);
}
Also used : DataSourceFactory(com.evolveum.midpoint.repo.sqlbase.DataSourceFactory) SqaleRepositoryConfiguration(com.evolveum.midpoint.repo.sqale.SqaleRepositoryConfiguration) DataSource(javax.sql.DataSource)

Aggregations

SqaleRepositoryConfiguration (com.evolveum.midpoint.repo.sqale.SqaleRepositoryConfiguration)1 DataSourceFactory (com.evolveum.midpoint.repo.sqlbase.DataSourceFactory)1 DataSource (javax.sql.DataSource)1