directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: Register as listener for LDAP changes
Date Mon, 27 Feb 2017 15:00:32 GMT
Hi,


Le 27/02/2017 à 13:23, Martin Hastrup Krogh a écrit :
> Hi,
>
> I'm currently implementing a module for our system to connect to a LDAP server and retrieve
information about the currently logged on user.
> As a part of the requirements, our system should act if data on the LDAP server changes
- thus, I would like to know in my Java code, if anything changes on the server.
>
> I found this example how to do it: https://docs.oracle.com/javase/tutorial/displayCode.html?code=https://docs.oracle.com/javase/tutorial/jndi/ldap/examples/RegUnsol.java
> But, that is not through the Apache LDAP API.
> I can't seem to find anything about it in your guide http://directory.apache.org/api/user-guide.html
>
> Could you help me/write a section about this?

The way it works is through PersistentSearch, which is a control that
has to be sent with a search operation. It requires a dedicated thread
that send the search with the control, and whch gets back any update
made on the server.

We have some code that leverage JNDI, it should be quite straigthforward
to use the LDAP API to do teh exact same thing :

http://svn.apache.org/viewvc/directory/apacheds/tags/2.0.0-M23/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java?revision=1752913&view=markup

The important piece is the PSearchListener class (line 595) and the
setUpListener() method which instanciate the Thread.

This code should be converted to use the API, we haven't had teh time to
do so.

Let me know if that helps you, do not hesitate to ask for direction if
you need some.

Last, not least, if you ands with something working with teh LDAP API,
we would be pleased to inject it into the code base.

Thanks !

-- 
Emmanuel Lecharny

Symas.com
directory.apache.org


Mime
View raw message