Search in sources :

Example 1 with LdapOxTrustConfiguration

use of org.xdi.config.oxtrust.LdapOxTrustConfiguration in project oxTrust by GluuFederation.

the class JsonConfigurationService method saveOxTrustImportPersonConfiguration.

public boolean saveOxTrustImportPersonConfiguration(ImportPersonConfig oxTrustImportPersonConfiguration) {
    LdapOxTrustConfiguration ldapOxTrustConfiguration = getOxTrustConfiguration();
    ldapOxTrustConfiguration.setImportPersonConfig(oxTrustImportPersonConfiguration);
    ldapOxTrustConfiguration.setRevision(ldapOxTrustConfiguration.getRevision() + 1);
    ldapEntryManager.merge(ldapOxTrustConfiguration);
    return true;
}
Also used : LdapOxTrustConfiguration(org.xdi.config.oxtrust.LdapOxTrustConfiguration)

Example 2 with LdapOxTrustConfiguration

use of org.xdi.config.oxtrust.LdapOxTrustConfiguration in project oxTrust by GluuFederation.

the class JsonConfigurationService method saveOxTrustCacheRefreshConfiguration.

public boolean saveOxTrustCacheRefreshConfiguration(CacheRefreshConfiguration oxTrustCacheRefreshConfiguration) {
    LdapOxTrustConfiguration ldapOxTrustConfiguration = getOxTrustConfiguration();
    ldapOxTrustConfiguration.setCacheRefresh(oxTrustCacheRefreshConfiguration);
    ldapOxTrustConfiguration.setRevision(ldapOxTrustConfiguration.getRevision() + 1);
    ldapEntryManager.merge(ldapOxTrustConfiguration);
    return true;
}
Also used : LdapOxTrustConfiguration(org.xdi.config.oxtrust.LdapOxTrustConfiguration)

Example 3 with LdapOxTrustConfiguration

use of org.xdi.config.oxtrust.LdapOxTrustConfiguration in project oxTrust by GluuFederation.

the class JsonConfigurationService method getOxTrustConfiguration.

private LdapOxTrustConfiguration getOxTrustConfiguration() {
    String configurationDn = configurationFactory.getConfigurationDn();
    LdapOxTrustConfiguration ldapOxTrustConfiguration = loadOxTrustConfig(configurationDn);
    return ldapOxTrustConfiguration;
}
Also used : LdapOxTrustConfiguration(org.xdi.config.oxtrust.LdapOxTrustConfiguration)

Example 4 with LdapOxTrustConfiguration

use of org.xdi.config.oxtrust.LdapOxTrustConfiguration in project oxTrust by GluuFederation.

the class JsonConfigurationService method saveOxTrustappConfiguration.

public boolean saveOxTrustappConfiguration(AppConfiguration oxTrustappConfiguration) {
    LdapOxTrustConfiguration ldapOxTrustConfiguration = getOxTrustConfiguration();
    ldapOxTrustConfiguration.setApplication(oxTrustappConfiguration);
    ldapOxTrustConfiguration.setRevision(ldapOxTrustConfiguration.getRevision() + 1);
    ldapEntryManager.merge(ldapOxTrustConfiguration);
    return true;
}
Also used : LdapOxTrustConfiguration(org.xdi.config.oxtrust.LdapOxTrustConfiguration)

Example 5 with LdapOxTrustConfiguration

use of org.xdi.config.oxtrust.LdapOxTrustConfiguration in project oxTrust by GluuFederation.

the class ConfigurationFactory method reloadConfiguration.

private void reloadConfiguration() {
    // Reload LDAP configuration if needed
    String ldapFileName = determineLdapConfigurationFileName();
    File ldapFile = new File(ldapFileName);
    if (ldapFile.exists()) {
        final long lastModified = ldapFile.lastModified();
        if (!StringHelper.equalsIgnoreCase(this.prevLdapFileName, ldapFileName) || (lastModified > ldapFileLastModifiedTime)) {
            // reload configuration only if it was modified
            // Reload configuration only if it was modified
            this.prevLdapFileName = loadLdapConfiguration(ldapFileName);
            event.select(LdapConfigurationReload.Literal.INSTANCE).fire(LDAP_CONFIGUARION_RELOAD_EVENT_TYPE);
        }
    }
    // Reload LDAP central configuration if needed
    File ldapCentralFile = new File(LDAP_CENTRAL_PROPERTIES_FILE);
    if (ldapCentralFile.exists()) {
        final long lastModified = ldapCentralFile.lastModified();
        if (lastModified > ldapCentralFileLastModifiedTime) {
            // Reload configuration only if it was modified
            loadLdapCentralConfiguration();
            event.select(LdapCentralConfigurationReload.Literal.INSTANCE).fire(LDAP_CENTRAL_CONFIGUARION_RELOAD_EVENT_TYPE);
        }
    } else if (this.ldapCentralConfiguration != null) {
        // Allow to remove not mandatory configuration file
        this.ldapCentralConfiguration = null;
        event.select(LdapCentralConfigurationReload.Literal.INSTANCE).fire(LDAP_CENTRAL_CONFIGUARION_RELOAD_EVENT_TYPE);
    }
    if (!loadedFromLdap) {
        return;
    }
    final LdapOxTrustConfiguration conf = loadConfigurationFromLdap("oxRevision");
    if (conf == null) {
        return;
    }
    if (conf.getRevision() <= this.loadedRevision) {
        return;
    }
    createFromLdap(false);
}
Also used : LdapOxTrustConfiguration(org.xdi.config.oxtrust.LdapOxTrustConfiguration) File(java.io.File)

Aggregations

LdapOxTrustConfiguration (org.xdi.config.oxtrust.LdapOxTrustConfiguration)7 LdapMappingException (org.gluu.site.ldap.persistence.exception.LdapMappingException)2 File (java.io.File)1 LdapEntryManager (org.gluu.site.ldap.persistence.LdapEntryManager)1 ConfigurationException (org.xdi.exception.ConfigurationException)1