[Date Prev][Date Next] [Chronological] [Thread] [Top]

sorting results in JLDAP



I have just begun working with the JLDAP library, and thus far am able to connect and search without problem. As someone familiar with the Netscape LDAP library, I like many of the changes I'm finding in the newer IETF and JLDAP APIs and would like to continue, but...

I noticed the deprecation of the sort() method in the LDAPSearchResults class this morning. Are there any examples of sorting search results using the Comparable interface?

My understanding is that if I get some search results and would like to sort them client side, I would first need to convert them to a collection of LDAPEntry instances. Then calling the sort() method on the collection would order the entries by dn. Great, but that's actually not really something I would likely want. If I instead want to sort by a given attribute value, it appears I would have to subclass LDAPEntry and override the compareTo() method with my own class/routine that extracts and compares the attribute values. Doesn't that pretty much preclude defining a sort order at run time?

I would appreciate any guidance on this, whether it be to point me to an example, give me a clue about what I'm missing, give me a suggestion on how to circumvent the issue, or fill me in on future plans on this requirement. I accept that there may be good reasons for the change, but the elimination of effective sorting would be a serious deficiency weighing against my effort to migrate to the otherwise advantageous Novell library.

Jon Roberts
www.mentata.com