3 - Groovy LDAP : Implementation¶
Currently, the implementation is comprised of some Java classes and two enumerations (search scopes and modification types). The class LDAP is the main entry point for scripts, just as the class LDAPConnection in the Netscape SDK. It provides the operations implemented so far. I have decided to omit methods for connecting and disconnecting explicitly (bind, unbind in LDAP). Instead all methods handle the connection themselves, which makes the Groovy source code shorter. Class DirContextToMapObjectFactory acts under the hood. It transforms a DirContext object from JNDI search results and lookups into a Java map. This trick enables the script writer to use expressions like tori.cn in order to retrieve an attribute value. There are probably better solutions to accomplish this task.
Source code of the proof of concept is currently available for review here :
In order to check it out, simply type
D:\Apache>svn co http://svn.apache.org/repos/asf/directory/sandbox/szoerner/groovyldap A groovyldap\src A groovyldap\src\main A groovyldap\src\main\java A groovyldap\src\main\java\org A groovyldap\src\main\java\org\apache ... Checked out revision 558335. D:\Apache>_