@Override protected Connection getConnection() throws LdapException { return factory.getConnection(); }
@Override protected Connection getConnection() throws LdapException { return factory.getConnection(); }
@Override protected Connection getConnection() throws LdapException { return factory.getConnection(); }
@Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
@Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
@Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
@Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
@Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
@Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
@Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
/** * Create and open a connection to ldap * via the given config and provider. * * @return the connection * @throws LdapException the ldap exception */ protected Connection createConnection() throws LdapException { logger.debug("Establishing a connection..."); final Connection connection = this.connectionFactory.getConnection(); connection.open(); return connection; }
/** * Retrieve a connection that is ready for use. * * @return connection * * @throws LdapException if an error occurs opening the connection */ @Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
/** * Retrieve a connection that is ready for use. * * @return connection * * @throws LdapException if an error occurs opening the connection */ @Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
/** * Retrieve a connection that is ready for use. * * @return connection * * @throws LdapException if an error occurs opening the connection */ @Override protected Connection getConnection() throws LdapException { final Connection conn = factory.getConnection(); conn.open(); return conn; }
/** * Gets connection from the factory. * Opens the connection if needed. * * @param connectionFactory the connection factory * @return the connection * @throws LdapException the ldap exception */ public static Connection createConnection(final ConnectionFactory connectionFactory) throws LdapException { final Connection c = connectionFactory.getConnection(); if (!c.isOpen()) { c.open(); } return c; }
@Override public Response<Void> delete(final T object) throws LdapException { final String dn = getLdapEntryMapper().mapDn(object); final DeleteRequest request = new DeleteRequest(dn); try (Connection conn = getConnectionFactory().getConnection()) { conn.open(); final DeleteOperation delete = new DeleteOperation(conn); return delete.execute(request); } } }
@Override protected void deleteById(final String id) { Connection connection = null; try { connection = connectionFactory.getConnection(); connection.open(); final DeleteOperation delete = new DeleteOperation(connection); delete.execute(new DeleteRequest(getIdAttribute() + "=" + id + "," + usersDn)); } catch (final LdapException e) { throw new TechnicalException(e); } finally { if (connection != null) { connection.close(); } } }
@Override public Response<Void> merge(final T object) throws LdapException { final LdapEntry entry = new LdapEntry(); getLdapEntryMapper().map(object, entry); final MergeRequest request = new MergeRequest(entry); try (Connection conn = getConnectionFactory().getConnection()) { conn.open(); final MergeOperation merge = new MergeOperation(conn); return merge.execute(request); } }
@Override public Response<Void> add(final T object) throws LdapException { final LdapEntry entry = new LdapEntry(); getLdapEntryMapper().map(object, entry); final AddRequest request = new AddRequest(entry.getDn(), entry.getAttributes()); try (Connection conn = getConnectionFactory().getConnection()) { conn.open(); final AddOperation add = new AddOperation(conn); return add.execute(request); } }
@Override public SearchResult performLdapSearch( final AuthenticationCriteria criteria, final AuthenticationHandlerResponse response) throws LdapException { if (factory == null) { final SearchOperation op = createSearchOperation(response.getConnection()); return op.execute(createSearchRequest(criteria)).getResult(); } else { try (Connection factoryConn = factory.getConnection()) { factoryConn.open(); final SearchOperation op = createSearchOperation(factoryConn); return op.execute(createSearchRequest(criteria)).getResult(); } } }