Norbet Reilly a écrit :
My apologies, reinstating the normalisation service did remove the
problems resolving ou=system.
I now need to work out how to most efficiently get hold of the
un-normalised name I need to drive my custom partition mapping, will
most probably need to do:
LdapDN origDN = new LdapDN(dn.getUpName());
This will produce the very same DN. LdapDN stores two forms of the DN :
- a normalized DN form
- a user provided DN, and you get this form using dn.getUpName(), but
it's a String.
For instance, if you do :
LdapDN dn = new LdapDN( "Ou = SySteM" )
then
dn.toString() produce "ou=system"
and
dn.getUpName produce "Ou = SySteM"
The LdapDN.normalize() does something a little bit different : it
creates an internal form acceptable by the server, where all attribute
types are transformed into OIDs, and attribute values are mdified in
respect with their MatchingRule.
which doesn't seem that efficient. Would it make sense to have
LdapDN.normalise() cache the original value and make it available via
say LdapDN.getUpDN() to make this case more efficient. Any custom
partitions doing DN mapping will need access to the original text
rather then OIDs.
Th eoriginal text is available thorugh LdapDN.getUpName().
In particular I've already found LdapDN.getUpNamePrefix()/Suffix()
useful, is there any objection to making them public (they're
currently private)?
I didn't wrote thos classes, because there was a problem : doing so mean
you keep a track of each RDN position in UPName in order to truncate the
string correctly :
if UPname : dC = Example, Ou = coM
to get the prefix (ou=com), you will have to 'remember' the position of
the coma. We do not store that information.
If needed, we can extend LdapDN to do so.
However, if you do a getPrefix(), a new UPName will be created from each
RDN UPName stored (we also store UPnames for each RDN, but it may be
trimmed), so doing :
dn.getPrefix() produce : " Ou = coM" I guess.
Emmanuel