directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Broekhuis <a.broekh...@gmail.com>
Subject Persistent Search
Date Mon, 22 Jul 2013 10:45:42 GMT
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
connection.search(String, String,....) returns a EntryCursor, and not a
SearchCursor, whereas a connection.search(SearchRequest) does return a
SearchCursor.
So a first question, why this difference? And what way is the
best/preferred way to do a search etc?

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 = con.search(searchRequest);

  while (cursor.next()) {
    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 cursor.next(). 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.

Thanks,

-- 
Met vriendelijke groet,

Alexander Broekhuis

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