On Thu, Jan 30, 2014 at 8:43 PM, eric tse <[email protected]> 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