LDAP Entry Modification Event Listener

Hi Friends,

We are trying to write an event listener for the modification of an entry in LDAP. Everything works fine using the approach specified in the JNDI tutorial. But, we need to know the old value(s) of the attribute(s) that was modified. The "getOldBinding()" method donot help us to the old attribute values. While trying to get the old context it returns null.

Is there any other way to know which attribute(s) were modified? Or is there something that we miss in our approach.

We have a requirement that if a particular attribute is modified, write that entry into a file.

(We are using Netscape Directory Server4.0 with Netscape LDAP service provider)

[700 byte] By [sunilkg] at [2007-9-26 8:26:05]
# 1
Is the change log going to help me here? Any idea?
sunilkg at 2007-7-1 19:03:06 > top of Java-index,Core,Core APIs...
# 2
Hi Sunil,I am running into the same issue with Netscape Directory Server 4.12. If you have found a solution pls let me know.
kmarella at 2007-7-1 19:03:06 > top of Java-index,Core,Core APIs...
# 3
Could you please send me the sample (working code) thats to listen the ldap event and its usage?
vasu_ak at 2007-7-1 19:03:06 > top of Java-index,Core,Core APIs...
# 4

Did you ever get this event listener to work?

We are trying to install an UnsolicitedNotiificationListener with a Sun One 5.2 Directory server and whilst we get no errors we do not receive any event notification.

If anyone has any experience in this area I would really appreciate your help

Mike

mike2drummond at 2007-7-1 19:03:06 > top of Java-index,Core,Core APIs...
# 5

Sorry I cannot help. Only thing I know is that every Ldap Server I've run into until now doesn't support Notification. This is OpenLdap, MS AD W2K, W2K3, Netscape.

For Microsoft there is another approach. I think forum author "adler_steven" posted an example of how to use this feature.

Hm, just asked aunt google...her big glassball showed some interessting info:

Seems like there's a netscape specific LDAP Provider "com.netscape.jndi.ldap.LdapContextFactory". Look here http://docs.sun.com/source/816-6402-10/jndichap.htm#1013584 and

http://docs.sun.com/source/816-6402-10/controls.htm#2849610

Cheers Peter

Soylent at 2007-7-1 19:03:06 > top of Java-index,Core,Core APIs...
# 6

Take a look at the API description for the Event Listener. It clearly described when the getNewBinding() will return NULL and when the getOldBinding() will return null.

public Binding getOldBinding()

Retrieves the binding of the object before the change.

The binding must be nonnull if the object existed before the change relative to the source context (getEventContext()). That is, it must be nonnull for OBJECT_REMOVED and OBJECT_CHANGED. For OBJECT_RENAMED, it is null if the object before the rename is outside of the scope for which the listener has registered interest; it is nonnull if the object is inside the scope before the rename.

The name in the binding is to be resolved relative to the event source getEventContext(). The object returned by Binding.getObject() may be null if such information is unavailable.

Returns:

The possibly null binding of the object before the change.

public Binding getNewBinding()

Retrieves the binding of the object after the change.

The binding must be nonnull if the object existed after the change relative to the source context (getEventContext()). That is, it must be nonnull for OBJECT_ADDED and OBJECT_CHANGED. For OBJECT_RENAMED, it is null if the object after the rename is outside the scope for which the listener registered interest; it is nonnull if the object is inside the scope after the rename.

The name in the binding is to be resolved relative to the event source getEventContext(). The object returned by Binding.getObject() may be null if such information is unavailable.

Returns:

The possibly null binding of the object after the change.

beyonddc at 2007-7-1 19:03:06 > top of Java-index,Core,Core APIs...