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 */ 020package org.apache.directory.ldap.client.api.future; 021 022 023import java.util.concurrent.ExecutionException; 024import java.util.concurrent.TimeUnit; 025import java.util.concurrent.TimeoutException; 026 027import org.apache.directory.ldap.client.api.LdapConnection; 028import org.apache.directory.shared.ldap.model.message.Response; 029 030 031/** 032 * A Future to manage SerachRequest. 033 * 034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 035 */ 036public class SearchFuture extends ResponseFuture<Response> 037{ 038 /** 039 * Creates a new instance of SearchFuture. 040 * 041 * @param connection the LDAP connection 042 * @param messageId The associated messageId 043 */ 044 // Implicit super constructor ResponseFuture<BindResponse>() is undefined for default constructor. 045 @SuppressWarnings("PMD.UselessOverridingMethod") 046 public SearchFuture( LdapConnection connection, int messageId ) 047 { 048 super( connection, messageId ); 049 } 050 051 052 /** 053 * Get the SearchResponse, blocking until one is received. 054 * It can be either a SearchResultEntry, a SearchResultReference 055 * or a SearchResultDone, the last of all the search responses. 056 * 057 * @return the response, either a SearchResultEntry, a SearchResultReference, or a SearchResultDone 058 * @throws InterruptedException {@inheritDoc} 059 * @throws ExecutionException {@inheritDoc} 060 */ 061 @SuppressWarnings("PMD.UselessOverridingMethod") 062 public Response get() throws InterruptedException, ExecutionException 063 { 064 return super.get(); 065 } 066 067 068 /** 069 * Get the SearchResponse, blocking until one is received, or until the 070 * given timeout is reached. It can be either a SearchResultEntry, 071 * a SearchResultReference or a SearchResultDone, the last of all 072 * the search responses. 073 * 074 * Get the ModifyResponse, blocking until one is received, or until the 075 * given timeout is reached. 076 * 077 * @param timeout {@inheritDoc} 078 * @param unit {@inheritDoc} 079 * @return the response, either a SearchResultEntry, a SearchResultReference, or a SearchResultDone 080 * @throws InterruptedException {@inheritDoc} 081 * @throws ExecutionException {@inheritDoc} 082 * @throws TimeoutException {@inheritDoc} 083 */ 084 public Response get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException, 085 TimeoutException 086 { 087 return super.get( timeout, unit ); 088 } 089 090 091 /** 092 * {@inheritDoc} 093 */ 094 public String toString() 095 { 096 StringBuilder sb = new StringBuilder(); 097 098 sb.append( "SearchFuture" ).append( super.toString() ); 099 100 return sb.toString(); 101 } 102}