Search in sources :

Example 1 with CacheRefreshConfiguration

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;
}
Also used : CacheRefreshConfiguration(org.gluu.config.oxtrust.CacheRefreshConfiguration) GluuLdapConfiguration(org.gluu.model.ldap.GluuLdapConfiguration) CacheRefreshAttributeMapping(org.gluu.config.oxtrust.CacheRefreshAttributeMapping)

Example 2 with 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();
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TimerSchedule(org.gluu.service.timer.schedule.TimerSchedule) CacheRefreshConfiguration(org.gluu.config.oxtrust.CacheRefreshConfiguration) TimerEvent(org.gluu.service.timer.event.TimerEvent) CacheRefreshEvent(org.gluu.oxtrust.service.cdi.event.CacheRefreshEvent)

Example 3 with CacheRefreshConfiguration

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);
    }
}
Also used : CacheRefreshConfiguration(org.gluu.config.oxtrust.CacheRefreshConfiguration) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration)

Aggregations

CacheRefreshConfiguration (org.gluu.config.oxtrust.CacheRefreshConfiguration)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 CacheRefreshAttributeMapping (org.gluu.config.oxtrust.CacheRefreshAttributeMapping)1 GluuLdapConfiguration (org.gluu.model.ldap.GluuLdapConfiguration)1 GluuConfiguration (org.gluu.oxtrust.model.GluuConfiguration)1 CacheRefreshEvent (org.gluu.oxtrust.service.cdi.event.CacheRefreshEvent)1 TimerEvent (org.gluu.service.timer.event.TimerEvent)1 TimerSchedule (org.gluu.service.timer.schedule.TimerSchedule)1