001/*
002 * Copyright 2007-2014 UnboundID Corp.
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2008-2014 UnboundID Corp.
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021package com.unboundid.ldap.sdk;
022
023
024
025import java.io.Serializable;
026
027import com.unboundid.util.Extensible;
028import com.unboundid.util.ThreadSafety;
029import com.unboundid.util.ThreadSafetyLevel;
030
031
032
033/**
034 * This interface defines a set of methods that provide search result entries
035 * and references to a requester as they are returned from the server.  It
036 * provides a memory-efficient mechanism for dealing with searches that match a
037 * large number of entries, as well as more timely processing for those that
038 * take a long time to complete and return entries sporadically over the
039 * duration of the search.
040 * <BR><BR>
041 * The {@link LDAPEntrySource} class implements this interface and may be used
042 * to provide access to the search results in an {@code Iterator}-like manner.
043 */
044@Extensible()
045@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
046public interface SearchResultListener
047       extends Serializable
048{
049  /**
050   * Indicates that the provided search result entry has been returned by the
051   * server and may be processed by this search result listener.
052   *
053   * @param  searchEntry  The search result entry that has been returned by the
054   *                      server.
055   */
056  void searchEntryReturned(final SearchResultEntry searchEntry);
057
058
059
060  /**
061   * Indicates that the provided search result reference has been returned by
062   * the server and may be processed by this search result listener.
063   *
064   * @param  searchReference  The search result reference that has been returned
065   *                          by the server.
066   */
067  void searchReferenceReturned(final SearchResultReference searchReference);
068}