directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Re: CSV to LDIF
Date Mon, 03 May 2010 20:48:53 GMT
On 5/3/10 10:15 PM, Roland Berger wrote:
> Hello
>
> I was looking for a way to import my outlook addresses into an open 
> ldap server to be able to use evolution as an outlook replacement. 
> There is no easy and automatic way to do it so I started to think to 
> write a csv to ldif converter.
> The basic idea is to have on one side the csv headers on the other 
> side attributes of some objectclasses defined in a schema and do the 
> mapping in an gui. Before starting to write my own ldif parser I'm 
> sure you guys have already done it. I have searched the apache ds 
> websites but found only little code which might be reusable to suite 
> my idea. May be its because apache ds is a huge project. Can anyone 
> point me to the right place to start reading and tell me if apache ds 
> would be interested for a contribution like this?
We don't have such a CVS to LDIF converter yet. We do have a Ldif to CVS 
converter.

We would love to have something that does the conversion though !

The best would be to have it in Ldap Studio.

FYI, 6 years ago, I wrote such a tool, and AFAIR, the real issue is the 
mapping. LDAP Attributes may be multi-valued, and each attribute must 
have a name. Assuming that the first row contains the LDAP attribute's 
name, that would be quite easy to transform a CVS file to LDIF.

We do have some convenient classes and methods to manipulate LDIF files, 
and in your case, you might be interested in those classes :
http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/

The LdifEntry class is the one contaning an LDAP entry, so when you have 
created an Entry (that's another class you can find in 
http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/),

you can produce a LDIF file using the LdifUtils.java class. 
<http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/>

Hope it helps !

-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.nextury.com



Mime
View raw message