Search in sources :

Example 1 with ConfigurationException

use of org.gluu.persist.exception.operation.ConfigurationException in project oxCore by GluuFederation.

the class LdapEntryManagerFactory method createEntryManager.

@Override
public LdapEntryManager createEntryManager(Properties conf) {
    LdapConnectionProvider connectionProvider = new LdapConnectionProvider(conf);
    if (!connectionProvider.isCreated()) {
        throw new ConfigurationException(String.format("Failed to create LDAP connection pool! Result code: '%s'", connectionProvider.getCreationResultCode()));
    }
    LOG.debug("Created connectionProvider '{}' with code '{}'", connectionProvider, connectionProvider.getCreationResultCode());
    LdapConnectionProvider bindConnectionProvider = new LdapAuthConnectionProvider(conf);
    if (!bindConnectionProvider.isCreated()) {
        throw new ConfigurationException(String.format("Failed to create LDAP bind connection pool! Result code: '%s'", bindConnectionProvider.getCreationResultCode()));
    }
    LOG.debug("Created bindConnectionProvider '{}' with code '{}'", bindConnectionProvider, bindConnectionProvider.getCreationResultCode());
    LdapEntryManager ldapEntryManager = new LdapEntryManager(new LdapOperationsServiceImpl(connectionProvider, bindConnectionProvider));
    LOG.info("Created LdapEntryManager: {}", ldapEntryManager.getOperationService());
    return ldapEntryManager;
}
Also used : ConfigurationException(org.gluu.persist.exception.operation.ConfigurationException) LdapConnectionProvider(org.gluu.persist.ldap.operation.impl.LdapConnectionProvider) LdapAuthConnectionProvider(org.gluu.persist.ldap.operation.impl.LdapAuthConnectionProvider) LdapOperationsServiceImpl(org.gluu.persist.ldap.operation.impl.LdapOperationsServiceImpl)

Aggregations

ConfigurationException (org.gluu.persist.exception.operation.ConfigurationException)1 LdapAuthConnectionProvider (org.gluu.persist.ldap.operation.impl.LdapAuthConnectionProvider)1 LdapConnectionProvider (org.gluu.persist.ldap.operation.impl.LdapConnectionProvider)1 LdapOperationsServiceImpl (org.gluu.persist.ldap.operation.impl.LdapOperationsServiceImpl)1