directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hendy Irawan (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing
Date Tue, 22 May 2012 22:43:41 GMT

    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281265#comment-13281265
] 

Hendy Irawan edited comment on DIRSTUDIO-801 at 5/22/12 10:43 PM:
------------------------------------------------------------------

I'm not going to argue about LDAP spec, but users will appreciate when implementations make
their lives easier when possible.

As for ordering, from parent to children always works in my cases. In which particular cases
are the DN ordering not obvious?

I'm not aware how difficult it is to implement this feature in Apache LDAP libraries, but
I'll post the Ruby code to do this. Hopefully someone else will find this helpful:

#!/usr/bin/env ruby
# sudo gem install activeldap
require 'active_ldap'

ldif_data = ARGF.read
parsed = ActiveLdap::Ldif.parse(ldif_data)
sorted = parsed.sort_by { |entry| entry.dn.count(',') }
sorted.each { |entry|
  puts entry
  puts
}

(credit: http://rubyforge.org/pipermail/ruby-activeldap-discuss/2008-June/000660.html )

Usage is simple:

./ldifsort.rb dc\=aksimata\,dc\=com.ldif

You can pipe or redirect the output to another file.

Granted, there are definitely cases where this simplistic tool will not work properly or use
too much memory. But at least for now, for all my use cases it's working very well, luckily
I haven't yet had an LDIF export bigger than the installed RAM :-D Hopefully someone finds
it useful too.

I still am curious about the ApacheDS Server ordering. It seems that previous ApacheDS versions
(1.5.x?) sorted the entries when the partition is indexed on objectClass, but it's not the
case in 2.0.0-M6, or perhaps I'm missing something. Shall I file another bug for this issue?
                
      was (Author: ceefour):
    I'm not going to argue about LDAP spec, but users will appreciate when implementations
make their lives easier when possible.

As for ordering, from parent to children always works in my cases. In which particular cases
are the DN ordering not obvious?

I'm not aware how difficult it is to implement this feature in Apache LDAP libraries, but
I'll post the Ruby code to do this. Hopefully someone else will find this helpful:

{code}
#!/usr/bin/env ruby
# sudo gem install activeldap
require 'active_ldap'

ldif_data = ARGF.read
parsed = ActiveLdap::Ldif.parse(ldif_data)
sorted = parsed.sort_by { |entry| entry.dn.count(',') }
sorted.each { |entry|
  puts entry
  puts
}
{code}
(credit: http://rubyforge.org/pipermail/ruby-activeldap-discuss/2008-June/000660.html )

Usage is simple:

{code=bash}
./ldifsort.rb dc\=aksimata\,dc\=com.ldif
{code}

You can pipe or redirect the output to another file.

Granted, there are definitely cases where this simplistic tool will not work properly or use
too much memory. But at least for now, for all my use cases it's working very well, luckily
I haven't yet had an LDIF export bigger than the installed RAM :-D Hopefully someone finds
it useful too.

I still am curious about the ApacheDS Server ordering. It seems that previous ApacheDS versions
(1.5.x?) sorted the entries when the partition is indexed on objectClass, but it's not the
case in 2.0.0-M6, or perhaps I'm missing something. Shall I file another bug for this issue?
                  
> Allow sorting of LDIF files when Exporting and/or Importing
> -----------------------------------------------------------
>
>                 Key: DIRSTUDIO-801
>                 URL: https://issues.apache.org/jira/browse/DIRSTUDIO-801
>             Project: Directory Studio
>          Issue Type: Improvement
>          Components: studio-ldapbrowser
>    Affects Versions: 2.0.0-M3
>            Reporter: Jim Willeke
>            Priority: Minor
>
> When exporting to LDIF the entries may or may not be in the proper order for importing.
> A nice feature would be to sort the entries in a "parent-first" fashion so when importing
the Parents would always be in the file before any of the children.
> This could be done on an export or perhaps an import also.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message