You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by gi...@apache.org on 2023/02/12 16:33:06 UTC

[directory-site] branch asf-site updated: Updated site from master (914237203ebf2d0b7de9583fcb8af0b2d6e3ce70)

This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/directory-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new cd25157d Updated site from master (914237203ebf2d0b7de9583fcb8af0b2d6e3ce70)
cd25157d is described below

commit cd25157d3710136727bfc175717f0d11a862c509
Author: jenkins <bu...@apache.org>
AuthorDate: Sun Feb 12 16:33:01 2023 +0000

    Updated site from master (914237203ebf2d0b7de9583fcb8af0b2d6e3ce70)
---
 content/api/index.xml                       |  3 +-
 content/api/internal-design-guide/9-dn.html | 63 ++++++++++++++++++++++++++++-
 content/index.xml                           |  3 +-
 content/sitemap.xml                         |  4 +-
 4 files changed, 67 insertions(+), 6 deletions(-)

diff --git a/content/api/index.xml b/content/api/index.xml
index 46eefc05..4f9c99b8 100644
--- a/content/api/index.xml
+++ b/content/api/index.xml
@@ -1259,7 +1259,8 @@ X.500 related RFCs Obsolete RFCs    Number Description Obsoleted by Status     R
       <guid>https://directory.apache.org/api/internal-design-guide/9-dn.html</guid>
       <description>9 - DN A DN, or Distingusished Name is a data structure that is composed of a list of RDN (Relative DN). Each RDN is composed of a list of AVA (AttributeType And Value).
 In a DN, the list of RDN is ordered from the most significant to the least significant RDN. For instance:
-::: text cn=JohnDoe,ou=apache,dc=com  The most significant RDN is cn=JohnDoe.</description>
+cn=JohnDoe,ou=apache,dc=com  The most significant RDN is cn=JohnDoe.
+RDN A RDN can be composed of mant AVAs, which are ordered in two ways:</description>
     </item>
     
     <item>
diff --git a/content/api/internal-design-guide/9-dn.html b/content/api/internal-design-guide/9-dn.html
index 76a4c676..9992d47b 100644
--- a/content/api/internal-design-guide/9-dn.html
+++ b/content/api/internal-design-guide/9-dn.html
@@ -159,10 +159,69 @@
 	<h1 id="9---dn">9 - DN</h1>
 <p>A <strong>DN</strong>, or <strong>Distingusished Name</strong> is a data structure that is composed of a list of <strong>RDN</strong> (<strong>Relative DN</strong>). Each <strong>RDN</strong> is composed of a list of <strong>AVA</strong> (<strong>AttributeType And Value</strong>).</p>
 <p>In a <strong>DN</strong>, the list of <strong>RDN</strong> is ordered from the most significant to the least significant <strong>RDN</strong>. For instance:</p>
-<pre><code>::: text
-cn=JohnDoe,ou=apache,dc=com
+<pre><code>cn=JohnDoe,ou=apache,dc=com
 </code></pre>
 <p>The most significant <strong>RDN</strong> is <code>cn=JohnDoe</code>.</p>
+<h2 id="rdn">RDN</h2>
+<p>A <strong>RDN</strong> can be composed of mant <strong>AVAs</strong>, which are ordered in two ways:</p>
+<ul>
+<li>Lexicograpgically, if we don&rsquo;t have a schema</li>
+<li>By OID, if we have a schema</li>
+</ul>
+<p>Typically, a <strong>DN</strong> like:</p>
+<pre><code>gn=Kate+cn=Bush,ou=apache,dc=com
+</code></pre>
+<p>will be ordered internally as :</p>
+<pre><code>cn=Bush+gn=Kate,ou=apache,dc=com	
+</code></pre>
+<p>if we don&rsquo;t have a schema (because <code>cn</code> is lexicographically before <code>gn</code>), or if we have a schema (because <code>2.5.4.3</code> is the <code>cn</code> OID and <code>2.5.4.42</code> is the <code>gn</code> OID)</p>
+<h3 id="internal-structure">Internal structure</h3>
+<p>We keep the following data inside a <strong>RDN</strong></p>
+<ul>
+<li><code>upName:</code>: a <code>String</code> containing the <strong>RDN</strong> user provided value</li>
+<li><code>normName</code>: a <code>String</code> containing the normalized <strong>RDN</strong> value</li>
+<li><code>avas</code>: A list of ordered <strong>AVAs</strong></li>
+<li><code>avaTypes</code>: A map of the <strong>RDN</strong> <code>AttributeTypes</code> (each <strong>AVA</strong> has an <code>AttributeType</code>) for a quick search</li>
+<li><code>avaType</code>: If we have only one <strong>AVA</strong>, we store its <code>AttributeType</code> here, not in the Map</li>
+<li><code>ava</code>: If we have only one <strong>AVA</strong>, we store it here, not in the list</li>
+<li><code>nbAvas</code>: The number of <strong>AVAs</strong> in this <strong>RDN</strong>.</li>
+<li><code>normalized</code>: A boolean indicating if the <strong>RDN</strong> has been normalized</li>
+<li><code>h</code>: The integer hascode for this instance</li>
+</ul>
+<p><strong>Note</strong>: When a <strong>RDN</strong> is initially created, we don&rsquo;t allocate the <code>List</code> or <code>Map</code>, because most of the time, the <strong>RDN</strong> contains a single <strong>AVA</strong>. We could extend the <strong>RDN</strong> class to manage those with multiple <strong>AVAs</strong> instead of managing all in one single class, but that would require having a <strong>RdnFactory</strong> class.</p>
+<h3 id="processing">Processing</h3>
+<p>We have two parsers that get called:</p>
+<ul>
+<li>The <code>FastParserRdn</code> for simpler <strong>RDNs</strong></li>
+<li>The <code>ComplexDnParser</code> for composed <strong>RDNs</strong> (or more specific use cases)</li>
+</ul>
+<p>If the first parser fails to parse the <strong>RDN</strong>, we call back to the second parser. That means we are fast in 99,9% of the time, and longer otherwise.</p>
+<p>Here is how it&rsquo;s handled:</p>
+<pre><code>private static void parse( SchemaManager schemaManager, String dn, Rdn rdn ) throws LdapInvalidDnException
+{
+    try
+    {
+        FastDnParser.parseRdn( schemaManager, dn, rdn );
+    }
+    catch ( TooComplexDnException e )
+    {
+        rdn.clear();
+        new ComplexDnParser().parseRdn( schemaManager, dn, rdn );
+    }
+}
+</code></pre>
+<p>The <code>FastDnParser</code> is basically a recursive descent: we consider we have a single <code>AttributeType</code>, an <code>=</code> signe, and the value. If we have a Schema, we will use it to process the <code>AttributeType</code> and the value, normalizing it (that is done at the <code>Ava</code> level). At the end, we get back an <code>Rdn</code> instance, with one <code>Ava</code>, where the following class&rsquo; fields are updated:</p>
+<ul>
+<li><code>upName:</code>: The user provaided form (the provided String)</li>
+<li><code>normName</code>: The normalized form</li>
+<li><code>avas</code>: Empty</li>
+<li><code>avaTypes</code>: Empty</li>
+<li><code>avaType</code>: The <code>AttributeType</code></li>
+<li><code>ava</code>: The <code>Ava</code> instance</li>
+<li><code>nbAvas</code>: 1</li>
+<li><code>normalized</code>: true or false (depends on the schema being present)</li>
+<li><code>h</code>: The integer hascode for this instance</li>
+</ul>
 
 
             
diff --git a/content/index.xml b/content/index.xml
index 34ea6d17..4c8d33a2 100644
--- a/content/index.xml
+++ b/content/index.xml
@@ -3284,7 +3284,8 @@ RFC 4512 defines four different flavors of AttributeType :
       <guid>https://directory.apache.org/api/internal-design-guide/9-dn.html</guid>
       <description>9 - DN A DN, or Distingusished Name is a data structure that is composed of a list of RDN (Relative DN). Each RDN is composed of a list of AVA (AttributeType And Value).
 In a DN, the list of RDN is ordered from the most significant to the least significant RDN. For instance:
-::: text cn=JohnDoe,ou=apache,dc=com  The most significant RDN is cn=JohnDoe.</description>
+cn=JohnDoe,ou=apache,dc=com  The most significant RDN is cn=JohnDoe.
+RDN A RDN can be composed of mant AVAs, which are ordered in two ways:</description>
     </item>
     
     <item>
diff --git a/content/sitemap.xml b/content/sitemap.xml
index 0415ab8a..48b97051 100644
--- a/content/sitemap.xml
+++ b/content/sitemap.xml
@@ -1604,7 +1604,7 @@
   
   <url>
     <loc>https://directory.apache.org/api/internal-design-guide/9-dn.html</loc>
-    <lastmod>2023-02-10T06:23:51+01:00</lastmod>
+    <lastmod>2023-02-12T17:31:02+01:00</lastmod>
   </url>
   
   <url>
@@ -1644,7 +1644,7 @@
   
   <url>
     <loc>https://directory.apache.org/api.html</loc>
-    <lastmod>2023-02-10T06:23:51+01:00</lastmod>
+    <lastmod>2023-02-12T17:31:02+01:00</lastmod>
   </url>
   
   <url>