public SearchResponse search(SearchRequest request, SearchResponse response) throws Exception { Session session = createAdminSession(); LDAPClient client = null; try { LDAPConnection connection = (LDAPConnection) getConnection(); client = connection.getClient(session); client.search(request, response); int rc = response.waitFor(); log.debug("RC: " + rc); } catch (Exception e) { response.setException(e); } finally { if (client != null) try { client.close(); } catch (Exception e) { log.error(e.getMessage(), e); } if (session != null) try { session.close(); } catch (Exception e) { log.error(e.getMessage(), e); } response.close(); } return response; }
public SearchResult find(DN dn) throws Exception { Session session = createAdminSession(); LDAPClient client = null; try { LDAPConnection connection = (LDAPConnection) getConnection(); client = connection.getClient(session); return client.find(dn); } finally { if (client != null) try { client.close(); } catch (Exception e) { log.error(e.getMessage(), e); } if (session != null) try { session.close(); } catch (Exception e) { log.error(e.getMessage(), e); } } }
public Schema getSchema() throws Exception { LDAPConnection connection = (LDAPConnection) getConnection(); return connection.getSchema(); }