001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2009-2010 Sun Microsystems, Inc. 025 * Portions copyright 2011-2014 ForgeRock AS. 026 */ 027 028package org.forgerock.opendj.ldap; 029 030import org.forgerock.opendj.ldap.responses.SearchResultEntry; 031import org.forgerock.opendj.ldap.responses.SearchResultReference; 032 033/** 034 * A completion handler for consuming the results of a Search operation. 035 * <p> 036 * {@link Connection} and {@link Connection} objects allow a search result 037 * completion handler to be specified when sending Search operation requests to 038 * a Directory Server. The {@link #handleEntry} method is invoked each time a 039 * Search Result Entry is returned from the Directory Server. The 040 * {@link #handleReference} method is invoked for each Search Result Reference 041 * returned from the Directory Server. 042 * <p> 043 * Implementations of these methods should complete in a timely manner so as to 044 * avoid keeping the invoking thread from dispatching to other completion 045 * handlers. 046 */ 047public interface SearchResultHandler { 048 /** 049 * Invoked each time a search result entry is returned from an asynchronous 050 * search operation. 051 * 052 * @param entry 053 * The search result entry. 054 * @return {@code true} if this handler should continue to be notified of 055 * any remaining entries and references, or {@code false} if the 056 * remaining entries and references should be skipped for some 057 * reason (e.g. a client side size limit has been reached). 058 */ 059 boolean handleEntry(SearchResultEntry entry); 060 061 /** 062 * Invoked each time a search result reference is returned from an 063 * asynchronous search operation. 064 * 065 * @param reference 066 * The search result reference. 067 * @return {@code true} if this handler should continue to be notified of 068 * any remaining entries and references, or {@code false} if the 069 * remaining entries and references should be skipped for some 070 * reason (e.g. a client side size limit has been reached). 071 */ 072 boolean handleReference(SearchResultReference reference); 073}