You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Roland Berger <ro...@exasoft.ch> on 2010/05/03 22:15:07 UTC

CSV to LDIF

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?

Thank you Roland

Re: CSV to LDIF

Posted by Emmanuel Lecharny <el...@gmail.com>.
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