001    /*
002     * Copyright 2007-2015 UnboundID Corp.
003     * All Rights Reserved.
004     */
005    /*
006     * Copyright (C) 2008-2015 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     */
021    package com.unboundid.ldap.sdk;
022    
023    
024    
025    import java.io.Serializable;
026    
027    
028    
029    
030    /**
031     * This interface defines a set of methods that provide search result entries
032     * and references to a requester as they are returned from the server.  It
033     * provides a memory-efficient mechanism for dealing with searches that match a
034     * large number of entries, as well as more timely processing for those that
035     * take a long time to complete and return entries sporadically over the
036     * duration of the search.
037     * <BR><BR>
038     * The {@code LDAPEntrySource} class implements this interface and may be used
039     * to provide access to the search results in an {@code Iterator}-like manner.
040     */
041    public interface SearchResultListener
042           extends Serializable
043    {
044      /**
045       * Indicates that the provided search result entry has been returned by the
046       * server and may be processed by this search result listener.
047       *
048       * @param  searchEntry  The search result entry that has been returned by the
049       *                      server.
050       */
051      void searchEntryReturned(final SearchResultEntry searchEntry);
052    
053    
054    
055      /**
056       * Indicates that the provided search result reference has been returned by
057       * the server and may be processed by this search result listener.
058       *
059       * @param  searchReference  The search result reference that has been returned
060       *                          by the server.
061       */
062      void searchReferenceReturned(final SearchResultReference searchReference);
063    }