use of org.gluu.service.cache.CacheConfiguration in project oxCore by GluuFederation.
the class InMemoryCacheProviderTest method beforeClass.
@BeforeClass
public void beforeClass() {
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cache = new InMemoryCacheProvider();
cache.configure(cacheConfiguration);
cache.create();
}
use of org.gluu.service.cache.CacheConfiguration 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;
}
use of org.gluu.service.cache.CacheConfiguration in project oxCore by GluuFederation.
the class DummyConfigurationFactoryTest method checkCacheConfiguration.
@Test(enabled = false)
public void checkCacheConfiguration() {
CacheConfiguration cacheConfiguration = dummyConfigurationFactory.getCacheConfiguration();
assertNotNull(cacheConfiguration);
assertNotNull(cacheConfiguration.getCacheProviderType());
}
use of org.gluu.service.cache.CacheConfiguration in project oxTrust by GluuFederation.
the class ApplicationFactory method getCacheConfiguration.
@Produces
@ApplicationScoped
public CacheConfiguration getCacheConfiguration() {
CacheConfiguration cacheConfiguration = configurationService.getConfiguration().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. Appliance DN: " + configurationService.getConfiguration().getDn());
log.info("Creating fallback IN-MEMORY cache configuration ... ");
cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setInMemoryConfiguration(new InMemoryConfiguration());
log.info("IN-MEMORY cache configuration is created.");
} else if (cacheConfiguration.getNativePersistenceConfiguration() != null) {
cacheConfiguration.getNativePersistenceConfiguration().setBaseDn(appConfiguration.getBaseDN());
}
log.info("Cache configuration: " + cacheConfiguration);
return cacheConfiguration;
}
use of org.gluu.service.cache.CacheConfiguration in project oxAuth by GluuFederation.
the class ApplicationFactory method getCacheConfiguration.
@Produces
@ApplicationScoped
public CacheConfiguration getCacheConfiguration() {
CacheConfiguration cacheConfiguration = configurationService.getConfiguration().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. Appliance DN: " + configurationService.getConfiguration().getDn());
log.info("Creating fallback IN-MEMORY cache configuration ... ");
cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setInMemoryConfiguration(new InMemoryConfiguration());
log.info("IN-MEMORY cache configuration is created.");
}
if (cacheConfiguration.getNativePersistenceConfiguration() != null) {
if (!StringUtils.isEmpty(staticConfiguration.getBaseDn().getSessions())) {
cacheConfiguration.getNativePersistenceConfiguration().setBaseDn(StringUtils.remove(staticConfiguration.getBaseDn().getSessions(), "ou=sessions,").trim());
}
}
log.info("Cache configuration: " + cacheConfiguration);
return cacheConfiguration;
}
Aggregations