directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Narendra Kadali <narendra_kad...@hotmail.com>
Subject RE: Implementing Ldap Persistent search using apache directory api
Date Mon, 18 Apr 2011 07:13:06 GMT

Hi Cordialement,

Thanks for your reply.

At present I am using below code for performing persistent search.

LdapConnection connection = new LdapConnection("localhost", 389);
    connection.bind("CN=Administrator,cn=users,dc=example,dc=com", "password123");

    Control psearchControl = new PersistentSearchControl();
    SearchRequest sr = new SearchRequest();
    sr.setBaseDn("dc=orademo,dc=com");
    sr.setFilter("(objectclass=*)");
    sr.setScope(SearchScope.SUBTREE);
    sr.add(psearchControl);

    SearchCursor results = (SearchCursor) connection.search(sr);


I need to perform this persistent search operation on Active Directory . For Active Directory
OID for persistent search is 1.2.840.113556.1.4.528 which is diffrent from standard oid 2.16.840.1.113730.3.4.
So how can i change defined PersistentSearchControl  OId to this new OID.

Thanks,
Narendra

> Date: Sun, 17 Apr 2011 21:47:42 +0200
> From: elecharny@gmail.com
> To: api@directory.apache.org
> Subject: Re: Implementing Ldap Persistent search using apache directory api
> 
> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message