use of org.xdi.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.xdi.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
final int delay = 1 * 60;
final int interval = DEFAULT_INTERVAL;
timerEvent.fire(new TimerEvent(new TimerSchedule(delay, DEFAULT_INTERVAL), new CacheRefreshEvent(), Scheduled.Literal.INSTANCE));
this.lastFinishedTime = System.currentTimeMillis();
}
use of org.xdi.config.oxtrust.CacheRefreshConfiguration in project oxTrust by GluuFederation.
the class CacheRefreshTimer method processInt.
public void processInt() {
CacheRefreshConfiguration cacheRefreshConfiguration = configurationFactory.getCacheRefreshConfiguration();
try {
GluuAppliance currentAppliance = applianceService.getAppliance();
if (!isStartCacheRefresh(cacheRefreshConfiguration, currentAppliance)) {
log.debug("Starting conditions aren't reached");
return;
}
processImpl(cacheRefreshConfiguration, currentAppliance);
updateApplianceStatus(currentAppliance, System.currentTimeMillis());
this.lastFinishedTime = System.currentTimeMillis();
} catch (Throwable ex) {
log.error("Exception happened while executing cache refresh synchronization", ex);
}
}
Aggregations