directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Re: Implementing Ldap Persistent search using apache directory api
Date Sun, 17 Apr 2011 19:47:42 GMT
On 4/17/11 6:35 PM, Narendra Kadali wrote:
> Hi All,
>
> I am new to this apache directory api and there is no documentation available.
The documentation effort is currently being conducted.

> I need to implement directory persistance search using this api.
This is pretty simple.
>
> Can any one give me sample code for implementing my scenario or any refrences for doing
this.
Persistent search is just a normal search except that you pass the 
PersistentSearch control with the search request.
The search operation is explained on 
http://directory.apache.org/api/tutorials.html.

Adding a control can be done following this sample :

         Control psearchControl = new PersistentSearchImpl();
         SearchRequest sr = new SearchRequestImpl();
         sr.setBase( new Dn( "ou=system" ) );
         sr.setFilter( "(objectclass=*" );
         sr.setScope( SearchScope.SUBTREE );
         sr.addControl( psearchControl );

         SearchCursor results = connection.search( sr );

then process the entries.

You will also have to set the connection timeout to 0, otherwise it 
won't last longer than 30 seconds.

Hope it helps.

-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.iktek.com


Mime
View raw message