I did some research about accessing LDAP from Groovy, in order to create some simple scripts. It is possible to use both JNDI and libraries like Netscape or Novell SDK from Groovy (you can basically use any Java library in Groovy scripts).
But these approaches have disadvantages. Netscape SDK is plain LDAP, so the scripts look like one familiar to LDAP would expect. But the API is not connected very well to the Collection API, so sometimes it is not easy to use the result from Groovy. And you have a non-standard dependency. JNDI on the other hand is easier to use (exists in every VM), but the scripts look horrible, because of the LDAP abstraction JNDI does. For instance you have to type "entry.nameInNamespace" instead of "entry.DN" (Netscape).
It seems that there does no special solution/library for Groovy and LDAP exist. So I started to create a little prototype. Basically, it is a wrapper which uses JNDI (in order to omit the dependency to a non-standard library) under the hood, but looks like LDAP from the outside (script). Unfortunately, I am not a Groovy expert.
Stefan Zoerner on Jun 30, 2007