directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <>
Subject Re: Persistent Search
Date Mon, 22 Jul 2013 11:27:25 GMT
Le 7/22/13 1:09 PM, Kiran Ayyagari a écrit :
> On Mon, Jul 22, 2013 at 4:15 PM, Alexander Broekhuis
> <>wrote:
>> Hi all,
>> I am looking into ApacheDS and the Api to work with the server. I am trying
>> to implement some of the examples used in the documentation, but there are
>> several small things differently with the latest release? Eg a
>>, String,....) returns a EntryCursor, and not a
>> SearchCursor, whereas a does return a
>> SearchCursor.
>> So a first question, why this difference? And what way is the
>> best/preferred way to do a search etc?
> EntryCursor is used when you expect only entries (not referrals) in the
> results
> SearchCursor gives you all entries and referrals (if present) as well

At this point, I'm wondering if it makes sense to not use a SearchCursor
in any case ?

>> My next question is about PersistentSearch, how do I do this? For example,
>> I have the following code:
>>   SearchRequest searchRequest = new SearchRequestImpl().setBase( new Dn(
>> "ou=system" ) ).setFilter( "objectclass=*)").setScope(
>> SearchScope.ONELEVEL).addControl( new PersistentSearchImpl() );
>>   SearchCursor cursor =;
>>   while ( {
>>     Response response = cursor.get();
>> System.out.println(((SearchResultEntry)response).getEntry());
>>   }
>>   cursor.close();
>> When I run this code without the Control it returns the entries I expect,
>> but with the Control, it somehow blocks at I am not even
>> sure this is the correct way to do a persistent search, I can't find any
>> documentation on this at all. Also, when I have a persistent search, how
>> can I get a call that the result has been changed? Eg entry added/removed
>> etc.
>> you get the results asynchronously, i.e, you leave the loop running and it
> will wait for
> the incoming results, just make sure you increase the timeout either at the
> connection (setTimeOut)
> level or in the SearchRequest (setTimeLimit())

It would be cnvenient to have a persistentSearch() method hich returns a
future, and you should have a non-blocking method to get a result when
called, beside a blockig method.

Wdyt ?

Emmanuel Lécharny 

View raw message