Search in sources :

Example 1 with BasePersistenceException

use of io.jans.orm.exception.BasePersistenceException in project jans by JanssenProject.

the class AppInitializer method loadConfiguration.

private GluuConfiguration loadConfiguration(PersistenceEntryManager localPersistenceEntryManager, String... persistenceReturnAttributes) {
    String configurationDn = configurationFactory.getBaseDn().getConfiguration();
    if (StringHelper.isEmpty(configurationDn)) {
        return null;
    }
    GluuConfiguration configuration = null;
    try {
        configuration = localPersistenceEntryManager.find(configurationDn, GluuConfiguration.class, persistenceReturnAttributes);
    } catch (BasePersistenceException ex) {
        log.error("Failed to load global configuration entry from Ldap", ex);
        return null;
    }
    return configuration;
}
Also used : BasePersistenceException(io.jans.orm.exception.BasePersistenceException) GluuConfiguration(io.jans.as.persistence.model.configuration.GluuConfiguration)

Example 2 with BasePersistenceException

use of io.jans.orm.exception.BasePersistenceException in project jans by JanssenProject.

the class ConfigurationFactory method loadConfigurationFromDb.

private <T> T loadConfigurationFromDb(String dn, T obj, String... returnAttributes) {
    log.debug("loadConfigurationFromDb dn:{}, clazz:{}, returnAttributes:{}", dn, obj, returnAttributes);
    final PersistenceEntryManager persistenceEntryManager = persistenceEntryManagerInstance.get();
    try {
        return (T) persistenceEntryManager.find(dn, obj.getClass(), returnAttributes);
    } catch (BasePersistenceException ex) {
        log.error(ex.getMessage());
        return null;
    }
}
Also used : PersistenceEntryManager(io.jans.orm.PersistenceEntryManager) BasePersistenceException(io.jans.orm.exception.BasePersistenceException)

Example 3 with BasePersistenceException

use of io.jans.orm.exception.BasePersistenceException in project jans by JanssenProject.

the class ConfigurationFactory method loadConfigurationFromLdap.

private Conf loadConfigurationFromLdap(String... returnAttributes) {
    final PersistenceEntryManager persistenceEntryManager = persistenceEntryManagerInstance.get();
    final String dn = getConfigurationDn();
    try {
        final Conf conf = persistenceEntryManager.find(dn, Conf.class, returnAttributes);
        return conf;
    } catch (BasePersistenceException ex) {
        log.error(ex.getMessage());
    }
    return null;
}
Also used : PersistenceEntryManager(io.jans.orm.PersistenceEntryManager) Conf(io.jans.scim.model.conf.Conf) BasePersistenceException(io.jans.orm.exception.BasePersistenceException)

Example 4 with BasePersistenceException

use of io.jans.orm.exception.BasePersistenceException in project jans by JanssenProject.

the class ConfigurationFactory method loadConfigurationFromLdap.

private Conf loadConfigurationFromLdap(String... returnAttributes) {
    final PersistenceEntryManager persistenceEntryManager = persistenceEntryManagerInstance.get();
    final String dn = this.baseConfiguration.getString("fido2_ConfigurationEntryDN");
    try {
        final Conf conf = persistenceEntryManager.find(dn, Conf.class, returnAttributes);
        return conf;
    } catch (BasePersistenceException ex) {
        log.error(ex.getMessage());
    }
    return null;
}
Also used : PersistenceEntryManager(io.jans.orm.PersistenceEntryManager) Conf(io.jans.fido2.model.conf.Conf) BasePersistenceException(io.jans.orm.exception.BasePersistenceException)

Example 5 with BasePersistenceException

use of io.jans.orm.exception.BasePersistenceException in project jans by JanssenProject.

the class ConfigurationFactory method loadConfigurationFromPersistence.

private io.jans.as.model.config.Conf loadConfigurationFromPersistence(String... returnAttributes) {
    final PersistenceEntryManager ldapManager = persistenceEntryManagerInstance.get();
    final String dn = this.baseConfiguration.getString(SERVER_KEY_OF_CONFIGURATION_ENTRY);
    try {
        return ldapManager.find(dn, io.jans.as.model.config.Conf.class, returnAttributes);
    } catch (BasePersistenceException ex) {
        if (!dn.contains("_test")) {
            ex.printStackTrace();
        }
        log.error(ex.getMessage());
    }
    return null;
}
Also used : PersistenceEntryManager(io.jans.orm.PersistenceEntryManager) BasePersistenceException(io.jans.orm.exception.BasePersistenceException)

Aggregations

BasePersistenceException (io.jans.orm.exception.BasePersistenceException)5 PersistenceEntryManager (io.jans.orm.PersistenceEntryManager)4 GluuConfiguration (io.jans.as.persistence.model.configuration.GluuConfiguration)1 Conf (io.jans.fido2.model.conf.Conf)1 Conf (io.jans.scim.model.conf.Conf)1