Title: Groovy LDAP Download, Sources & Building Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. # Groovy LDAP Download, Sources & Building ## Download Groovy LDAP Here is a ZIP-File which contains the source code and the compiled jar file to be used as a Groovy module. **[groovy-ldap.zip](download/groovy-ldap.zip)** ## 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 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>_ ## Building the software ### Resolving the dependencies Groovy LDAP needs Java 5 to compile. Besides this, it has only one dependency: Groovy itself. For LDAP communication, JNDI and its LDAP provider are used. These are part of the JDK since ages. In order to build the software, Apache ant is used. For dependency resolution we use [Ivy](http://incubator.apache.org/ivy). You need to configure your ant tool to use Ivy. One option is to place the corresponding jar file _ivy-1.4.1.jar_ (or later) in the _lib_ folder of your ant distribution. ### Building with ant and ivy (deprecated) Simply change to the _groovyldap_ directory and type _ant_. D:\Apache>cd groovyldap D:\Apache\groovyldap>ant Buildfile: build.xml prepare: [mkdir] Created dir: D:\Apache\groovyldap\dist [mkdir] Created dir: D:\Apache\groovyldap\dist\classes [mkdir] Created dir: D:\Apache\groovyldap\lib resolve: [ivy:retrieve] :: Ivy 1.4.1 - 20061109165313 :: http://ivy.jayasoft.org/ :: ... jarfile: [jar] Building jar: D:\Apache\groovyldap\dist\groovy-ldap.jar BUILD SUCCESSFUL Total time: 7 seconds D:\Apache\groovyldap>_ Done. The jarfile which includes the software, _groovy-ldap.jar_, is created in the _dist_ directory. Feel free to call _ant clean_ afterwards. ### Building with Maven We are changing the build process to Maven 2, in order to have the same build tool for all sub projects within Apache Directory. Simply change to the _groovyldap_ directory and type _mvn install_. D:\Apache\groovyldap>mvn install [INFO] Scanning for projects... [INFO] ----------------------------------------------------------------- [INFO] Building Apache Directory Groovy LDAP [INFO] task-segment: [install] [INFO] ----------------------------------------------------------------- ... [INFO] ----------------------------------------------------------------- [INFO] BUILD SUCCESSFUL [INFO] ----------------------------------------------------------------- [INFO] Total time: 25 seconds [INFO] Finished at: Mon Mar 02 22:06:54 CET 2009 [INFO] Final Memory: 19M/38M [INFO] -----------------------------------------------------------------