directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <>
Subject [jira] Resolved: (DIRSERVER-858) Allow subclassing LdapDN
Date Thu, 22 Mar 2007 16:43:32 GMT


Emmanuel Lecharny resolved DIRSERVER-858.

    Resolution: Won't Fix

The LdapDN class is intended for internal use only. It is not supposed to be used out of the

> Allow subclassing LdapDN
> ------------------------
>                 Key: DIRSERVER-858
>                 URL:
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>          Components: ldap
>    Affects Versions: 1.0.1, 1.5.0
>            Reporter: Endi S. Dewata
> Currently when you create an LdapDN object from a given DN string the code will always
parse the string into its RDN components.
>     LdapDN dn = new LdapDN("dc=example,dc=com");
> The parsing code, however, depending on your application, could take up to 5% of the
> For applications that require high performance, it would be great if we could create
a subclass of LdapDN that will bypass the DN parsing code, or lazily parse the DN only when
needed. See the following code:
>     LdapDN dn = new MyLdapDN("dc=example,dc=com");
>     SearchResponseEntry response = new SearchResponseEntryImpl(request.getMessageId());
>     response.setObjectName(dn);
>     response.setAttributes(attributes);
> The MyLdapDN class would be very simple:
>     public class MyLdapDN extends LdapDN {
>         public MyLdapDN(String dn) throws Exception {
>             bytes = StringTools.getBytesUtf8(dn);
>         }
>     }
> Unfortunately this code is currently doesn't work because the the "bytes" field of LdapDN
is private and the LdapDN.getNbBytes() and LdapDN.getBytes() methods require direct access
to the field.
> The solution is simple, here are some alternatives:
> 1. Change the field access to protected.
> 2. Add LdapDN.setBytes() method.
> 3. Add LdapDN.getBytes() that can be overridden by the subclass, and change the LdapDN.getNbBytes()
and LdapDN.getBytes() to call this method.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message