use of org.gluu.config.oxtrust.CacheRefreshConfiguration in project oxTrust by GluuFederation.
the class ConfigureCacheRefreshAction method getOxTrustCacheRefreshConfig.
private CacheRefreshConfiguration getOxTrustCacheRefreshConfig() {
CacheRefreshConfiguration cacheRefreshConfiguration = jsonConfigurationService.getOxTrustCacheRefreshConfiguration();
if (cacheRefreshConfiguration == null) {
cacheRefreshConfiguration = new CacheRefreshConfiguration();
cacheRefreshConfiguration.setUpdateMethod(CacheRefreshUpdateMethod.COPY.getValue());
cacheRefreshConfiguration.setSourceConfigs(new ArrayList<GluuLdapConfiguration>());
cacheRefreshConfiguration.setInumConfig(new GluuLdapConfiguration());
cacheRefreshConfiguration.setTargetConfig(new GluuLdapConfiguration());
cacheRefreshConfiguration.setKeyAttributes(new ArrayList<String>(0));
cacheRefreshConfiguration.setKeyObjectClasses(new ArrayList<String>());
cacheRefreshConfiguration.setSourceAttributes(new ArrayList<String>());
cacheRefreshConfiguration.setAttributeMapping(new ArrayList<CacheRefreshAttributeMapping>());
cacheRefreshConfiguration.setDefaultInumServer(true);
}
this.updateMethod = CacheRefreshUpdateMethod.getByValue(cacheRefreshConfiguration.getUpdateMethod());
this.keyAttributes = toSimpleProperties(cacheRefreshConfiguration.getKeyAttributes());
this.keyObjectClasses = toSimpleProperties(cacheRefreshConfiguration.getKeyObjectClasses());
this.sourceAttributes = toSimpleProperties(cacheRefreshConfiguration.getSourceAttributes());
this.attributeMapping = toSimpleCustomProperties(cacheRefreshConfiguration.getAttributeMapping());
return cacheRefreshConfiguration;
}
use of org.gluu.config.oxtrust.CacheRefreshConfiguration in project oxTrust by GluuFederation.
the class CacheRefreshTimer method initTimer.
public void initTimer() {
log.info("Initializing Cache Refresh Timer");
this.isActive = new AtomicBoolean(false);
// Clean up previous Inum cache
CacheRefreshConfiguration cacheRefreshConfiguration = configurationFactory.getCacheRefreshConfiguration();
if (cacheRefreshConfiguration != null) {
String snapshotFolder = cacheRefreshConfiguration.getSnapshotFolder();
if (StringHelper.isNotEmpty(snapshotFolder)) {
String inumCachePath = getInumCachePath(cacheRefreshConfiguration);
objectSerializationService.cleanup(inumCachePath);
}
}
// Schedule to start cache refresh every 1 minute
timerEvent.fire(new TimerEvent(new TimerSchedule(DEFAULT_INTERVAL, DEFAULT_INTERVAL), new CacheRefreshEvent(), Scheduled.Literal.INSTANCE));
this.lastFinishedTime = System.currentTimeMillis();
}
use of org.gluu.config.oxtrust.CacheRefreshConfiguration in project oxTrust by GluuFederation.
the class CacheRefreshTimer method processInt.
public void processInt() {
CacheRefreshConfiguration cacheRefreshConfiguration = configurationFactory.getCacheRefreshConfiguration();
try {
GluuConfiguration currentConfiguration = configurationService.getConfiguration();
if (!isStartCacheRefresh(cacheRefreshConfiguration, currentConfiguration)) {
log.debug("Starting conditions aren't reached");
return;
}
processImpl(cacheRefreshConfiguration, currentConfiguration);
updateStatus(currentConfiguration, System.currentTimeMillis());
this.lastFinishedTime = System.currentTimeMillis();
} catch (Throwable ex) {
log.error("Exception happened while executing cache refresh synchronization", ex);
}
}
Aggregations