Search in sources :

Example 1 with RepositoryServiceFactory

use of com.evolveum.midpoint.repo.api.RepositoryServiceFactory in project midpoint by Evolveum.

the class RepositoryFactory method init.

public void init() {
    Configuration config = midpointConfiguration.getConfiguration(REPOSITORY_CONFIGURATION);
    try {
        String className = getFactoryClassName(config);
        LOGGER.info("Repository factory class name from configuration '{}'.", new Object[] { className });
        Class<RepositoryServiceFactory> clazz = (Class<RepositoryServiceFactory>) Class.forName(className);
        factory = getFactoryBean(clazz);
        factory.init(config);
    } catch (Exception ex) {
        LoggingUtils.logException(LOGGER, "RepositoryServiceFactory implementation class {} failed to " + "initialize.", ex, config.getString(REPOSITORY_FACTORY_CLASS));
        throw new SystemException("RepositoryServiceFactory implementation class " + config.getString(REPOSITORY_FACTORY_CLASS) + " failed to initialize: " + ex.getMessage(), ex);
    }
}
Also used : MidpointConfiguration(com.evolveum.midpoint.common.configuration.api.MidpointConfiguration) Configuration(org.apache.commons.configuration.Configuration) RuntimeConfiguration(com.evolveum.midpoint.common.configuration.api.RuntimeConfiguration) SystemException(com.evolveum.midpoint.util.exception.SystemException) RepositoryServiceFactory(com.evolveum.midpoint.repo.api.RepositoryServiceFactory) BeansException(org.springframework.beans.BeansException) SystemException(com.evolveum.midpoint.util.exception.SystemException) RepositoryServiceFactoryException(com.evolveum.midpoint.repo.api.RepositoryServiceFactoryException)

Example 2 with RepositoryServiceFactory

use of com.evolveum.midpoint.repo.api.RepositoryServiceFactory in project midpoint by Evolveum.

the class RepositoryFactory method getCacheRepositoryService.

public synchronized RepositoryService getCacheRepositoryService() {
    if (cacheRepositoryService == null) {
        try {
            Class<RepositoryServiceFactory> clazz = (Class<RepositoryServiceFactory>) Class.forName(REPOSITORY_FACTORY_CACHE_CLASS);
            cacheFactory = getFactoryBean(clazz);
            //TODO decompose this dependency, remove class casting !!!
            RepositoryCache repositoryCache = (RepositoryCache) cacheFactory.getRepositoryService();
            repositoryCache.setRepository(getRepositoryService(), prismContext);
            cacheRepositoryService = repositoryCache;
        } catch (Exception ex) {
            LoggingUtils.logException(LOGGER, "Failed to get cache repository service. ExceptionClass = {}", ex, ex.getClass().getName());
            throw new SystemException("Failed to get cache repository service", ex);
        }
    }
    return cacheRepositoryService;
}
Also used : SystemException(com.evolveum.midpoint.util.exception.SystemException) RepositoryServiceFactory(com.evolveum.midpoint.repo.api.RepositoryServiceFactory) RepositoryCache(com.evolveum.midpoint.repo.cache.RepositoryCache) BeansException(org.springframework.beans.BeansException) SystemException(com.evolveum.midpoint.util.exception.SystemException) RepositoryServiceFactoryException(com.evolveum.midpoint.repo.api.RepositoryServiceFactoryException)

Aggregations

RepositoryServiceFactory (com.evolveum.midpoint.repo.api.RepositoryServiceFactory)2 RepositoryServiceFactoryException (com.evolveum.midpoint.repo.api.RepositoryServiceFactoryException)2 SystemException (com.evolveum.midpoint.util.exception.SystemException)2 BeansException (org.springframework.beans.BeansException)2 MidpointConfiguration (com.evolveum.midpoint.common.configuration.api.MidpointConfiguration)1 RuntimeConfiguration (com.evolveum.midpoint.common.configuration.api.RuntimeConfiguration)1 RepositoryCache (com.evolveum.midpoint.repo.cache.RepositoryCache)1 Configuration (org.apache.commons.configuration.Configuration)1