use of org.apache.directory.ldap.client.template.exception.LdapRuntimeException in project directory-ldap-api by apache.
the class LdapConnectionTemplate method modifyPassword.
/**
* {@inheritDoc}
*/
@Override
public void modifyPassword(Dn userDn, char[] oldPassword, char[] newPassword, boolean asAdmin) throws PasswordException {
LdapConnection connection = null;
try {
connection = connectionPool.getConnection();
if (!asAdmin) {
authenticateConnection(connection, userDn, oldPassword);
}
modifyPassword(connection, userDn, newPassword);
} catch (LdapException e) {
throw new LdapRuntimeException(e);
} finally {
returnLdapConnection(connection);
}
}
use of org.apache.directory.ldap.client.template.exception.LdapRuntimeException in project directory-ldap-api by apache.
the class LdapConnectionTemplate method search.
/**
* {@inheritDoc}
*/
@Override
public <T> List<T> search(SearchRequest searchRequest, EntryMapper<T> entryMapper) {
List<T> entries = new ArrayList<>();
LdapConnection connection = null;
try {
connection = connectionPool.getConnection();
for (Entry entry : new EntryCursorImpl(connection.search(searchRequest))) {
entries.add(entryMapper.map(entry));
}
} catch (LdapException e) {
throw new LdapRuntimeException(e);
} finally {
returnLdapConnection(connection);
}
return entries;
}
use of org.apache.directory.ldap.client.template.exception.LdapRuntimeException in project directory-ldap-api by apache.
the class LdapConnectionTemplate method lookup.
/**
* {@inheritDoc}
*/
@Override
public <T> T lookup(Dn dn, String[] attributes, EntryMapper<T> entryMapper) {
LdapConnection connection = null;
try {
connection = connectionPool.getConnection();
Entry entry = attributes == null ? connection.lookup(dn) : connection.lookup(dn, attributes);
return entry == null ? null : entryMapper.map(entry);
} catch (LdapException e) {
throw new LdapRuntimeException(e);
} finally {
returnLdapConnection(connection);
}
}
Aggregations