Search in sources :

Example 1 with SharedConfigurationEntry

use of org.gluu.conf.model.SharedConfigurationEntry in project oxCore by GluuFederation.

the class ConfigurationFactory method loadCacheConfiguration.

private CacheConfiguration loadCacheConfiguration() {
    SharedConfigurationEntry sharedConfigurationEntry = persistenceEntryManager.find(SharedConfigurationEntry.class, SHARED_CONFIGURATION_DN);
    if (sharedConfigurationEntry == null) {
        LOG.error("Failed to load share configuration from DB. Please fix it!!!.");
        throw new ConfigurationException("Failed to load shared configuration from DB.");
    }
    CacheConfiguration cacheConfiguration = sharedConfigurationEntry.getCacheConfiguration();
    if (cacheConfiguration == null || cacheConfiguration.getCacheProviderType() == null) {
        LOG.error("Failed to read cache configuration from DB. Please check configuration oxCacheConfiguration attribute " + "that must contain cache configuration JSON represented by CacheConfiguration.class. Shared configuration DN: " + SHARED_CONFIGURATION_DN);
        LOG.info("Creating fallback IN-MEMORY cache configuration ... ");
        cacheConfiguration = new CacheConfiguration();
        cacheConfiguration.setInMemoryConfiguration(new InMemoryConfiguration());
        LOG.info("IN-MEMORY cache configuration is created.");
    }
    LOG.info("Cache configuration: " + cacheConfiguration);
    return cacheConfiguration;
}
Also used : InMemoryConfiguration(org.gluu.service.cache.InMemoryConfiguration) ConfigurationException(org.gluu.util.exception.ConfigurationException) SharedConfigurationEntry(org.gluu.conf.model.SharedConfigurationEntry) CacheConfiguration(org.gluu.service.cache.CacheConfiguration)

Aggregations

SharedConfigurationEntry (org.gluu.conf.model.SharedConfigurationEntry)1 CacheConfiguration (org.gluu.service.cache.CacheConfiguration)1 InMemoryConfiguration (org.gluu.service.cache.InMemoryConfiguration)1 ConfigurationException (org.gluu.util.exception.ConfigurationException)1