You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Jim Willeke (Created) (JIRA)" <ji...@apache.org> on 2012/04/04 17:25:25 UTC

[jira] [Created] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

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

        

[jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281280#comment-13281280 ] 

Emmanuel Lecharny commented on DIRSTUDIO-801:
---------------------------------------------

Regarding DN ordering :
- first of all, the RDN must be ordered, which means we must be able to order the single elements in a RDN. That mens we do have an ORDERING matching rule associated with teh AttributeType, which is not always the case. Then you have to decide how composed RDN should be ordered. Last, not least, all of the AVAs in a RDN must have a ORDERING MatchingRule
- second, if we want to order the DN itself, beside the RDN, then we have to propagate those rules all along the DN's RDNs
- third, the client must be schema aware, otherwise the client will have no idea on how to apply the MatchingRules it does not have access to

Regarding the memory consumption : if you have millions of entries to sort, then it will not only eat a hell lot of memory, but it will be time consuming : comparing DN is not a free operation. If you add that you'll probably have to store on a local disk the entries, then you add some extra complexity.

Sorting data is really far from being obvious in LDAP...

The SORT control is not yet implemented in ApachDS for the exact same reasons. As 2.0 is not out yet, and as we already have a lot in our plate to get it ready, frankly, we prefer focusing on the missing critical features atm... Sorry for that !
                
> 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

        

[jira] [Comment Edited] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Hendy Irawan (JIRA)" <ji...@apache.org>.
    [ 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:50 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
# Note: ActiveLdap can't read Extended LDIF format, use ldapsearch with -L
# 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:

#!/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?
                  
> 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

        

[jira] [Comment Edited] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Hendy Irawan (JIRA)" <ji...@apache.org>.
    [ 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:42 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:

{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?
                
      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=ruby}
#!/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

        

[jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Hendy Irawan (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246483#comment-13246483 ] 

Hendy Irawan commented on DIRSTUDIO-801:
----------------------------------------

+1 for this.

Additionally, I need this "sorted export" functionality for exporting LDIF files from an embedded ApacheDS, so please make this functionality available as shared, not just in Studio.

Thank you :-)
                
> 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

        

[jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Hendy Irawan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281311#comment-13281311 ] 

Hendy Irawan commented on DIRSTUDIO-801:
----------------------------------------

Thank you Emmanuel. Yes I wasn't aware of the complexities you mentioned. Thank you for explaining that.

For those lucky enough to have repositories with limited complexity, like mine, the Ruby script above works wonders.

BTW, I've just exported my ApacheDS 2.0.0-M6 content to LDIF, sorted it, then imported it into ApacheDS 2.0.0-M7 without any troubles. Yaaay! :-) Feels good :)
                
> 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

        

[jira] [Comment Edited] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Hendy Irawan (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Jim Willeke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261618#comment-13261618 ] 

Jim Willeke commented on DIRSTUDIO-801:
---------------------------------------

The http://www.unboundid.com/products/ldap-sdk/ makes this operation easy:
    public static void sortedSearch(String baseDN, String filter, LDAPConnection connection, String[] attributes) throws LDAPException
    {
	SearchRequest searchRequest = new SearchRequest(baseDN, SearchScope.SUB, filter, attributes);
	SearchResult searchResult = connection.search(searchRequest);
	EntrySorter entrySorter = new EntrySorter();
	SortedSet<Entry> sortedEntries = entrySorter.sort(searchResult.getSearchEntries());
	for (Iterator<Entry> iterator = sortedEntries.iterator(); iterator.hasNext();)
	{
	    Entry entry = iterator.next();
	    System.out.println(entry.toLDIFString());
	}
    }
                
> 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

        

[jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Pierre-Arnaud Marcelot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261631#comment-13261631 ] 

Pierre-Arnaud Marcelot commented on DIRSTUDIO-801:
--------------------------------------------------

Hi Jim,

Indeed, it seems pretty simple to use.

We could probably build the same thing in the Apache Directory LDAP API (and on top of JNDI too, since Studio uses both APIs).
I'm going to open a new JIRA about this for implementing this in the Apache Directory LDAP API.
                
> 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

        

[jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Hendy Irawan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281232#comment-13281232 ] 

Hendy Irawan commented on DIRSTUDIO-801:
----------------------------------------

This has been requested since January 2009 :

http://mail-archives.apache.org/mod_mbox/directory-users/200901.mbox/%3C98d8c0860901230228m334cf30fjd41d3e5fec32fcfe@mail.gmail.com%3E
                
> 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

        

[jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Hendy Irawan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281265#comment-13281265 ] 

Hendy Irawan commented on DIRSTUDIO-801:
----------------------------------------

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=ruby}
#!/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

        

[jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281247#comment-13281247 ] 

Emmanuel Lecharny commented on DIRSTUDIO-801:
---------------------------------------------

I think you have no idea of the implication of such a feature, client side. The fact that it's "requested" since 2009 is irrelevant. There is nothing in LDAP specification that requires the data to be sorted in any way. Add that ordering DNs is all but obvious, and sometime impossible.

Yes, it would be cool to have such a feature, but, no, it's not easy to implement, and it's not easy to use either.

There already exists some control that ask the server to order the returned entries on the server, not all servers support them.
                
> 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

        

[jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing

Posted by "Hendy Irawan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281235#comment-13281235 ] 

Hendy Irawan commented on DIRSTUDIO-801:
----------------------------------------

Note that as of 2.0.0-M6, even when the partition is indexed in the objectClass attribute, the returned entries order is still arbitrary.

This is contrast (a regression?) compared to the behavior described in:
http://mail-archives.apache.org/mod_mbox/directory-users/200901.mbox/%3C497925E4.1080209@greenfossil.com%3E

> For the purpose of the test I created the exact same partition but added
> basic indices on it, I imported the very same data and the LDIF export was
> correctly ordered.
                
> 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