directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eric tse <hfe...@gmail.com>
Subject Re: Ldif sort and Ldif split
Date Thu, 30 Jan 2014 15:39:21 GMT
Thanks a lot :)


On Thu, Jan 30, 2014 at 8:33 AM, Kiran Ayyagari <kayyagari@apache.org>wrote:

>
>
>
> On Thu, Jan 30, 2014 at 8:43 PM, eric tse <hfetse@gmail.com> wrote:
>
>> Hello,
>>
>> Do you guys have an apache brand of tools that can
>>
>> do something like
>>
>> sort ldif
>> &
>> split ldif
>>
>> ?????
>>
>> I have this functionality as part of a bulk load tool that am creating
> for Mavibot (the new ApacheDS backend)
> but this code is not yet committed.
>
> I suggest you use the DnComparator[1] to sort the entries.
>
> The way I would solve this issue is:
>
> 1. instantiate LdifReader
> 2. instantiate a TreeSet<DnComparator> S
> 3. for each LDIF entry E
>    a. store E into S
>    b. if size of S >= some threshold count N
>        b1. save all the entries in S to a LDIF file
>        b2. clear S
> 4. merge all the entries present in each sorted LDIF file.
>
> It will be much easier if you use a BTree from Mavibot or JDBM this will
> avoid the need to merge
> and also no need to use TreeSet.
>
> [1]
> https://svn.apache.org/repos/asf/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java
>
>> Thanks and regards,
>> Eric
>>
>
>
>
> --
> Kiran Ayyagari
> http://keydap.com
>

Mime
View raw message