directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <>
Subject Re: Persistent Search
Date Mon, 22 Jul 2013 11:09:28 GMT
On Mon, Jul 22, 2013 at 4:15 PM, Alexander Broekhuis

> 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
SearchCursor gives you all entries and referrals (if present) as well

> 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())

> Thanks,
> --
> Met vriendelijke groet,
> Alexander Broekhuis

Kiran Ayyagari

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message