Search in sources :

Example 26 with BaseMappingException

use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.

the class ConfigurationFactory method loadConfigurationFromLdap.

public LdapOxTrustConfiguration loadConfigurationFromLdap(String... returnAttributes) {
    final LdapEntryManager ldapEntryManager = ldapEntryManagerInstance.get();
    final String configurationDn = getConfigurationDn();
    try {
        final LdapOxTrustConfiguration conf = ldapEntryManager.find(LdapOxTrustConfiguration.class, configurationDn, returnAttributes);
        return conf;
    } catch (BaseMappingException ex) {
        log.error("Failed to load configuration from LDAP", ex);
    }
    return null;
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) LdapOxTrustConfiguration(org.xdi.config.oxtrust.LdapOxTrustConfiguration) LdapEntryManager(org.gluu.persist.ldap.impl.LdapEntryManager)

Example 27 with BaseMappingException

use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.

the class CacheRefreshTimer method updateTargetEntriesViaVDS.

private List<String> updateTargetEntriesViaVDS(CacheRefreshConfiguration cacheRefreshConfiguration, LdapServerConnection targetServerConnection, Set<String> changedInums) {
    List<String> result = new ArrayList<String>();
    LdapEntryManager targetLdapEntryManager = targetServerConnection.getLdapEntryManager();
    Filter filter = cacheRefreshService.createObjectClassPresenceFilter();
    for (String changedInum : changedInums) {
        String baseDn = "action=synchronizecache," + personService.getDnForPerson(changedInum);
        try {
            targetLdapEntryManager.findEntries(baseDn, GluuDummyEntry.class, filter, SearchScope.SUB, null, 0, cacheRefreshConfiguration.getLdapSearchSizeLimit());
            result.add(changedInum);
            log.debug("Updated entry with inum {}", changedInum);
        } catch (BaseMappingException ex) {
            log.error("Failed to update entry with inum '{}' using baseDN {}", changedInum, baseDn, ex);
        }
    }
    return result;
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) LdapEntryManager(org.gluu.persist.ldap.impl.LdapEntryManager) Filter(org.gluu.search.filter.Filter) ArrayList(java.util.ArrayList)

Example 28 with BaseMappingException

use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.

the class OrganizationService method getOxAuthSetting.

public LdapOxAuthConfiguration getOxAuthSetting(String configurationDn) {
    // String configurationDn = configurationFactory.getConfigurationDn();
    LdapOxAuthConfiguration ldapOxAuthConfiguration = null;
    try {
        configurationDn = configurationDn.replace("ou=oxtrust", "ou=oxauth");
        ldapOxAuthConfiguration = ldapEntryManager.find(LdapOxAuthConfiguration.class, configurationDn);
        return ldapOxAuthConfiguration;
    } catch (BaseMappingException ex) {
        log.error("Failed to load configuration from LDAP");
    }
    return null;
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) LdapOxAuthConfiguration(org.xdi.config.oxtrust.LdapOxAuthConfiguration)

Example 29 with BaseMappingException

use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.

the class StatusCheckerTimer method processInt.

/**
 * Gather periodically site and server status
 *
 * @param when
 *            Date
 * @param interval
 *            Interval
 */
private void processInt() {
    log.debug("Starting update of appliance status");
    AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
    if (!appConfiguration.isUpdateApplianceStatus()) {
        return;
    }
    GluuAppliance appliance;
    try {
        appliance = applianceService.getAppliance();
    } catch (BaseMappingException ex) {
        log.error("Failed to load current appliance", ex);
        return;
    }
    // Execute facter and update appliance attributes
    setFactorAttributes(appliance);
    // Execute df and update appliance attributes
    setDfAttributes(appliance);
    // Set HTTPD attributes
    setHttpdAttributes(appliance);
    try {
        setCertificateExpiryAttributes(appliance);
    } catch (Exception ex) {
        log.error("Failed to check certificate expiration", ex);
    }
    // setVDSAttributes(appliance);
    Date currentDateTime = new Date();
    appliance.setLastUpdate(currentDateTime);
    try {
        applianceService.updateAppliance(appliance);
    } catch (BaseMappingException ex) {
        log.error("Failed to update current appliance", ex);
        return;
    }
    if (centralLdapService.isUseCentralServer()) {
        try {
            GluuAppliance tmpAppliance = new GluuAppliance();
            tmpAppliance.setDn(appliance.getDn());
            boolean existAppliance = centralLdapService.containsAppliance(tmpAppliance);
            if (existAppliance) {
                centralLdapService.updateAppliance(appliance);
            } else {
                centralLdapService.addAppliance(appliance);
            }
        } catch (BaseMappingException ex) {
            log.error("Failed to update appliance at central server", ex);
            return;
        }
    }
    log.debug("Appliance status update finished");
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) AppConfiguration(org.xdi.config.oxtrust.AppConfiguration) BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) ParseException(java.text.ParseException) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Date(java.util.Date)

Aggregations

BaseMappingException (org.gluu.persist.exception.mapping.BaseMappingException)29 IOException (java.io.IOException)7 ArrayList (java.util.ArrayList)6 GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)5 GluuSAMLTrustRelationship (org.gluu.oxtrust.model.GluuSAMLTrustRelationship)4 Date (java.util.Date)3 OxAuthClient (org.gluu.oxtrust.model.OxAuthClient)3 LdapEntryManager (org.gluu.persist.ldap.impl.LdapEntryManager)3 CustomScript (org.xdi.model.custom.script.model.CustomScript)3 CertificateEncodingException (java.security.cert.CertificateEncodingException)2 ParseException (java.text.ParseException)2 JsonParseException (org.codehaus.jackson.JsonParseException)2 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)2 GluuCustomAttribute (org.gluu.oxtrust.model.GluuCustomAttribute)2 GluuStatus (org.gluu.persist.model.base.GluuStatus)2 AppConfiguration (org.xdi.config.oxtrust.AppConfiguration)2 SelectableEntity (org.xdi.model.SelectableEntity)2 UmaScopeDescription (org.xdi.oxauth.model.uma.persistence.UmaScopeDescription)2 LDAPConnection (com.unboundid.ldap.sdk.LDAPConnection)1 LDAPException (com.unboundid.ldap.sdk.LDAPException)1