directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Endi S. Dewata (JIRA)" <j...@apache.org>
Subject [jira] Created: (DIRSERVER-858) Allow subclassing LdapDN
Date Fri, 23 Feb 2007 19:21:06 GMT
Allow subclassing LdapDN
------------------------

                 Key: DIRSERVER-858
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-858
             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 time.

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.


Mime
View raw message