001/*
002 *   Licensed to the Apache Software Foundation (ASF) under one
003 *   or more contributor license agreements.  See the NOTICE file
004 *   distributed with this work for additional information
005 *   regarding copyright ownership.  The ASF licenses this file
006 *   to you under the Apache License, Version 2.0 (the
007 *   "License"); you may not use this file except in compliance
008 *   with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *   Unless required by applicable law or agreed to in writing,
013 *   software distributed under the License is distributed on an
014 *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *   KIND, either express or implied.  See the License for the
016 *   specific language governing permissions and limitations
017 *   under the License.
018 *
019 */
020
021package org.apache.directory.api.ldap.model.cursor;
022
023
024import org.apache.directory.api.ldap.model.entry.Entry;
025import org.apache.directory.api.ldap.model.exception.LdapException;
026import org.apache.directory.api.ldap.model.message.IntermediateResponse;
027import org.apache.directory.api.ldap.model.message.Referral;
028import org.apache.directory.api.ldap.model.message.Response;
029import org.apache.directory.api.ldap.model.message.SearchResultDone;
030
031
032/**
033 * An extension of Cursor which includes the retrieval of the SearchResultDone. 
034 * 
035 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
036 */
037public interface SearchCursor extends Cursor<Response>
038{
039    /**
040     * @return true if the cursor has processed all the elements we were searching
041     */
042    boolean isDone();
043
044
045    /**
046     * gives the SearchResultDone message received at the end of search results
047     * 
048     * @return the SearchResultDone message, null if the search operation fails for any reason 
049     */
050    SearchResultDone getSearchResultDone();
051
052
053    /**
054     * @return true if the next element in the cursor is a referral 
055     */
056    boolean isReferral();
057
058
059    /**
060     * @return The next referral element, if it's a referral 
061     * @throws LdapException If the 
062     */
063    Referral getReferral() throws LdapException;
064
065
066    /**
067     * @return true if the next element in the cursor is an entry 
068     */
069    boolean isEntry();
070
071
072    /**
073     * @return The next entry element, if it's an entry 
074     * @throws LdapException If the 
075     */
076    Entry getEntry() throws LdapException;
077
078
079    /**
080     * @return true if the next element in the cursor is an intermediate response 
081     */
082    boolean isIntermediate();
083
084
085    /**
086     * @return The next intermediate response element, if it's an intermediate response 
087     * @throws LdapException If the 
088     */
089    IntermediateResponse getIntermediate() throws LdapException;
090}