directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1023898 - in /websites/staging/directory/trunk/content: ./ api/dev-guide/13-controls.html api/dev-guide/4-asn1.html api/dev-guide/4.1-asn1-tlv.html api/dev-guide/images/controls.graphml api/dev-guide/images/controls.png
Date Tue, 16 Jan 2018 14:34:49 GMT
Author: buildbot
Date: Tue Jan 16 14:34:49 2018
New Revision: 1023898

Log:
Staging update by buildbot for directory

Added:
    websites/staging/directory/trunk/content/api/dev-guide/13-controls.html
    websites/staging/directory/trunk/content/api/dev-guide/images/controls.graphml   (with props)
    websites/staging/directory/trunk/content/api/dev-guide/images/controls.png   (with props)
Modified:
    websites/staging/directory/trunk/content/   (props changed)
    websites/staging/directory/trunk/content/api/dev-guide/4-asn1.html
    websites/staging/directory/trunk/content/api/dev-guide/4.1-asn1-tlv.html

Propchange: websites/staging/directory/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue Jan 16 14:34:49 2018
@@ -1 +1 @@
-1821128
+1821250

Added: websites/staging/directory/trunk/content/api/dev-guide/13-controls.html
==============================================================================
--- websites/staging/directory/trunk/content/api/dev-guide/13-controls.html (added)
+++ websites/staging/directory/trunk/content/api/dev-guide/13-controls.html Tue Jan 16 14:34:49 2018
@@ -0,0 +1,354 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+	<head>
+		<title>13 - Controls &mdash; Apache Directory</title>
+		
+	    <link href="./../../css/common.css" rel="stylesheet" type="text/css">
+	    <link href="./../../css/brown.css" rel="stylesheet" type="text/css">
+    
+        
+        <link rel="shortcut icon" href="./../../images/api-icon_16x16.png">
+    
+        <!-- Google Analytics -->
+        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
+        <script type="text/javascript">
+            _uacct = "UA-1358462-1";
+            urchinTracker();
+        </script>
+	</head>
+	<body>
+	    <div id="container">
+            <div id="header">
+                <div id="subProjectsNavBar">
+                    <a href="./../../">
+                        
+                        Main
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../../apacheds">
+                        
+                        ApacheDS
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../../studio">
+                        
+                        Studio
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../../api">
+                        
+                        <STRONG>LDAP API</STRONG>
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../../mavibot">
+                        
+                        Mavibot
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../../escimo">
+                        
+                        eSCIMo
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../../fortress">
+                        
+                        Fortress
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../../kerby">
+                        
+                        Kerby
+                        
+                    </a>
+                </div><!-- subProjectsNavBar -->
+            </div><!-- header -->
+            <div id="content">
+                <div id="leftColumn">
+                    
+<div id="navigation">
+    
+    <!--ul>
+      <li>
+        <a href="http://bit.ly/1n9YlQT" target="_blank">
+          <img src="./../../images/ApacheConBudapest.png" width="125" height="125" alt="I'm Speaking at ApacheCon Europe 2014! Join me!" title="I'm Speaking at ApacheCon Europe 2014! Join me!" border="0" style="margin-bottom:-3px;"/>
+        </a>
+      </li>
+    </ul-->
+    <h5>LDAP API 1.0</h5>
+    <ul>
+        <li><a href="./../../api/">Home</a></li>
+        <li><a href="./../../api/news.html">News</a></li>
+    </ul>
+    <h5>Downloads</h5>
+    <ul>
+	    <li><a href="./../../api/downloads.html">Version 1.0.0</a>&nbsp;&nbsp;<IMG src="./../../images/new_badge.gif" alt="" style="margin-bottom:-3px;" border="0"></li>
+        <li><a href="./../../api/download-old-versions.html">Older versions</a></li>
+    </ul>
+    <h5>Getting Started</h5>
+    <ul>
+        <li><a href="./../../api/vision.html">Vision</a></li>
+        <li><a href="./../../api/java-api.html">Java API</a></li>
+    </ul>
+    <h5>Documentation</h5>
+    <ul>
+	    <li><a href="./../../api/five-minutes-tutorial.html">Five minutes tutorial</a></li>
+	    <li><a href="./../../api/user-guide.html">User Guide</a></li>
+        <li><a href="./../../api/gen-docs/latest/apidocs/">JavaDocs</a></li>
+        <li><a href="./../../api/gen-docs/latest/xref/">Cross-Reference</a></li>
+        <!--li><a href="./../../api/gen-docs/latest/">Generated Reports</a></li-->
+        <li><a href="./../../api/developer-guide.html">Developer Guide</a></li>
+    </ul>
+    
+    
+    <h5>Support</h5>
+    <ul>
+        <li><a href="./../../mailing-lists-and-irc.html">Mailing Lists &amp; IRC</a></li>
+        <li><a href="./../../sources.html">Sources</a></li>
+        <li><a href="./../../issue-tracking.html">Issue Tracking</a></li>
+        <li><a href="./../../commercial-support.html">Commercial Support</a></li>
+    </ul>
+    <h5>Community</h5>
+    <ul>
+        <li><a href="./../../contribute.html">How to Contribute</a></li>
+        <li><a href="./../../team.html">Team</a></li>
+        <li><a href="./../../original-project-proposal.html">Original Project Proposal</a></li>
+        <li><a href="./../../special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
+    </ul>
+    <h5>About Apache</h5>
+    <ul>
+        <li><a href="http://www.apache.org/">Apache</a></li>
+        <li><a href="http://www.apache.org/licenses/">License</a></li>
+        <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+        <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+        <li><a href="http://www.apache.org/security/">Security</a></li>
+    </ul>
+    
+</div><!-- navigation -->
+
+                </div><!-- leftColumn -->
+                <div id="rightColumn">
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="12-cursor.html">12 - Cursor</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../dev-guide.html">Developer Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="14-extended-operations.html">14 - Extended Operations</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<h1 id="13-controls">13 - Controls<a class="headerlink" href="#13-controls" title="Permanent link">&para;</a></h1>
+<p>Controls are extension to the protocol. They are added in messages, and can contain extra information. A <strong>Control</strong> contains :</p>
+<ul>
+<li>an <strong>OID</strong>, unique to this <strong>Control</strong>, as an identifier</li>
+<li>a <strong>Criticality</strong> flag, which tells if the control can be ignored or not</li>
+<li>a value, which might be <strong>BER</strong> encoded </li>
+</ul>
+<p>We have 21 <strong>Control</strong>s declared in the <strong>LDAP API</strong>, and we can add more.</p>
+<h2 id="implementation">Implementation<a class="headerlink" href="#implementation" title="Permanent link">&para;</a></h2>
+<p>Here is teh <strong>Control</strong> classes and interfaces hierarchy :</p>
+<p><img alt="Control Hierarchy" src="images/controls.png" /></p>
+<p>As we can see, each <em>Impl</em> class is coupled with a <em>Decorator</em> class, used to process teh encoding and decoding of a <strong>Control</strong></p>
+<p>Keep in mind that <strong>Control</strong>s have to be sent within a message, thus be encoded or decoded when the response come back.</p>
+<h2 id="creating-a-new-control">Creating a new Control<a class="headerlink" href="#creating-a-new-control" title="Permanent link">&para;</a></h2>
+<p>The <strong>Control</strong> creation follows a few rules :</p>
+<ul>
+<li>It has to have a unique <strong>OID</strong> (this is generally the case, for <strong>Control</strong>s defined in RFCs)</li>
+<li>It has an <em>Interface</em>, a <em>Decorator</em> and an implementation</li>
+<li>It must be declared</li>
+</ul>
+<p>Let's see how it all works, using an example. We will add the <strong>Transaction Specification Control</strong>, defined in [RFC 5805(https://tools.ietf.org/html/rfc5805)], paragraphe 2.2 :</p>
+<div class="codehilite"><pre>2.2.  Transaction Specification Control
+
+A Transaction Specification Control is an LDAPControl where the
+controlType is 1.3.6.1.1.21.2, the criticality is TRUE, and the
+controlValue is a transaction identifier.  The control is appropriate
+for update requests including Add, Delete, Modify, and ModifyDN
+(Rename) requests [RFC4511], as well as the Password Modify requests
+[RFC3062].
+
+As discussed in Section 4, the Transaction Specification control can
+be used in conjunction with request controls appropriate for the
+update request.
+</pre></div>
+
+
+<p>The <em>Interface</em> will just expose the <em>Transaction Identifier</em>, and store the <strong>Control</strong> <strong>OID</strong> :</p>
+<div class="codehilite"><pre><span class="cm">/**</span>
+<span class="cm"> * The Transaction Specification control. It&#39;s defined in RFC 5805.</span>
+<span class="cm"> * This control is sent with every update once a transaction is started.</span>
+<span class="cm"> * It contains the Transaction ID. </span>
+<span class="cm"> *</span>
+<span class="cm"> * @author &lt;a href=&quot;mailto:dev@directory.apache.org&quot;&gt;Apache Directory Project&lt;/a&gt;</span>
+<span class="cm"> */</span>
+<span class="kd">public</span> <span class="kd">interface</span> <span class="nc">TransactionSpecification</span>
+<span class="o">{</span>
+    <span class="cm">/** The Transaction Specification control OID */</span>
+    <span class="n">String</span> <span class="n">OID</span> <span class="o">=</span> <span class="s">&quot;1.3.6.1.1.21.2&quot;</span><span class="o">;</span>
+
+    <span class="cm">/**</span>
+<span class="cm">     * @return The transaction identifier</span>
+<span class="cm">     */</span>
+    <span class="kt">byte</span><span class="o">[]</span> <span class="nf">getIdentifier</span><span class="o">();</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * Set the transaction ID</span>
+<span class="cm">     * @param The transaction identifier, an opaque byte array</span>
+<span class="cm">     */</span>
+    <span class="kt">void</span> <span class="nf">setIdentifier</span><span class="o">(</span> <span class="kt">byte</span><span class="o">[]</span> <span class="n">identifier</span> <span class="o">);</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>We now need an implementation for this <strong>Control</strong>. It really just a matter of having an instanciable object. Note that this class exteds the <em>AbstractControl</em> class.</p>
+<p>Here is it :</p>
+<div class="codehilite"><pre><span class="cm">/**</span>
+<span class="cm"> * The Transaction Specification control. It&#39;s defined in RFC 5805.</span>
+<span class="cm"> * This control is sent with every update once a transaction is started.</span>
+<span class="cm"> * It contains the Transaction ID. </span>
+<span class="cm"> *</span>
+<span class="cm"> * @author &lt;a href=&quot;mailto:dev@directory.apache.org&quot;&gt;Apache Directory Project&lt;/a&gt;</span>
+<span class="cm"> */</span>
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">TransactionSpecificationImpl</span> <span class="kd">extends</span> <span class="n">AbstractControl</span> <span class="kd">implements</span> <span class="n">TransactionSpecification</span>
+<span class="o">{</span>
+    <span class="cm">/** The Transaction Specification identifier */</span>
+    <span class="kd">private</span> <span class="kt">byte</span><span class="o">[]</span> <span class="n">identifier</span><span class="o">;</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * Default constructor</span>
+<span class="cm">     */</span>
+    <span class="kd">public</span> <span class="nf">TransactionSpecificationImpl</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="kd">super</span><span class="o">(</span> <span class="n">OID</span> <span class="o">);</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="kt">byte</span><span class="o">[]</span> <span class="nf">getIdentifier</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="k">return</span> <span class="n">identifier</span><span class="o">;</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">setIdentifier</span><span class="o">(</span> <span class="kt">byte</span><span class="o">[]</span> <span class="n">identifier</span> <span class="o">)</span>
+    <span class="o">{</span>
+        <span class="c1">// Copy the byte[]</span>
+        <span class="k">if</span> <span class="o">(</span> <span class="n">identifier</span> <span class="o">!=</span> <span class="kc">null</span> <span class="o">)</span>
+        <span class="o">{</span>
+            <span class="k">this</span><span class="o">.</span><span class="na">identifier</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">byte</span><span class="o">[</span><span class="n">identifier</span><span class="o">.</span><span class="na">length</span><span class="o">];</span>
+            <span class="n">System</span><span class="o">.</span><span class="na">arraycopy</span><span class="o">(</span> <span class="n">identifier</span><span class="o">,</span> <span class="mi">0</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="na">identifier</span><span class="o">,</span> <span class="mi">0</span><span class="o">,</span> <span class="n">identifier</span><span class="o">.</span><span class="na">length</span> <span class="o">);</span>
+        <span class="o">}</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * @see Object#toString()</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="n">String</span> <span class="nf">toString</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="k">if</span> <span class="o">(</span> <span class="n">identifier</span> <span class="o">!=</span> <span class="kc">null</span> <span class="o">)</span>
+        <span class="o">{</span>
+            <span class="k">return</span> <span class="s">&quot;Transaction specification ID=null&quot;</span><span class="o">;</span>
+        <span class="o">}</span>
+        <span class="k">else</span>
+        <span class="o">{</span>
+            <span class="k">return</span> <span class="s">&quot;Transaction specification ID=&quot;</span> <span class="o">+</span> <span class="n">Strings</span><span class="o">.</span><span class="na">dumpBytes</span><span class="o">(</span> <span class="n">identifier</span> <span class="o">);</span>
+        <span class="o">}</span>
+    <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>Nothing much to say, except that we have a default constructor that use the <strong>Control</strong>'s <strong>OID</strong> and a <em>toString()</em> method, for convenience. The <em>Identifier</em> is printed in hex format.</p>
+<h3 id="encoding">Encoding<a class="headerlink" href="#encoding" title="Permanent link">&para;</a></h3>
+<h3 id="decoding">Decoding<a class="headerlink" href="#decoding" title="Permanent link">&para;</a></h3>
+<h2 id="adding-a-control-to-the-api">Adding a Control to the API<a class="headerlink" href="#adding-a-control-to-the-api" title="Permanent link">&para;</a></h2>
+<p>When </p>
+
+
+    <div class="nav">
+        <div class="nav_prev">
+        
+            <a href="12-cursor.html">12 - Cursor</a>
+		
+        </div>
+        <div class="nav_up">
+        
+            <a href="../dev-guide.html">Developer Guide</a>
+		
+        </div>
+        <div class="nav_next">
+        
+            <a href="14-extended-operations.html">14 - Extended Operations</a>
+		
+        </div>
+        <div class="clearfix"></div>
+    </div>
+
+
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2015, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="./../../privacy-policy.html">Privacy Policy</a><br />
+                Apache Directory, ApacheDS, Apache Directory Server, Apache Directory Studio, Apache LDAP API, Apache Triplesec, Triplesec, Apache Mavibot, Mavibot, Apache eSCIMo, eSCIMo, Fortress, Apache Fortress, EnMasse, Apache EnMasse, Apache Kerby, Kerby
+                Apache, the Apache feather logo, and the Apache Directory project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
\ No newline at end of file

Modified: websites/staging/directory/trunk/content/api/dev-guide/4-asn1.html
==============================================================================
--- websites/staging/directory/trunk/content/api/dev-guide/4-asn1.html (original)
+++ websites/staging/directory/trunk/content/api/dev-guide/4-asn1.html Tue Jan 16 14:34:49 2018
@@ -237,7 +237,7 @@ h2:hover > .headerlink, h3:hover > .head
 <h3 id="the-state-machine">The state machine<a class="headerlink" href="#the-state-machine" title="Permanent link">&para;</a></h3>
 <p>So we decode a message using a state machine, which basically transit from one state to another, and optionally execute an action in between :</p>
 <p><img alt="State Machine transition" src="images/sm-transition.png" /></p>
-<p>Now, let's see a real example =</p>
+<p>Now, let's see a real example.</p>
 
 
     <div class="nav">

Modified: websites/staging/directory/trunk/content/api/dev-guide/4.1-asn1-tlv.html
==============================================================================
--- websites/staging/directory/trunk/content/api/dev-guide/4.1-asn1-tlv.html (original)
+++ websites/staging/directory/trunk/content/api/dev-guide/4.1-asn1-tlv.html Tue Jan 16 14:34:49 2018
@@ -497,6 +497,248 @@ h2:hover > .headerlink, h3:hover > .head
 
 
 <p>This is pretty much trivial.</p>
+<p>We now need a _Decorator to manipulate this instance. Here is the code :</p>
+<div class="codehilite"><pre><span class="kd">public</span> <span class="kd">class</span> <span class="nc">EntryChangeDecorator</span> <span class="kd">extends</span> <span class="n">ControlDecorator</span><span class="o">&lt;</span><span class="n">EntryChange</span><span class="o">&gt;</span> <span class="kd">implements</span> <span class="n">EntryChange</span>
+<span class="o">{</span>
+    <span class="cm">/** Default value when no change number is provided */</span>
+    <span class="kd">public</span> <span class="kd">static</span> <span class="kd">final</span> <span class="kt">int</span> <span class="n">UNDEFINED_CHANGE_NUMBER</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="o">;</span>
+
+    <span class="cm">/** A temporary storage for the previous Dn */</span>
+    <span class="kd">private</span> <span class="kt">byte</span><span class="o">[]</span> <span class="n">previousDnBytes</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
+
+    <span class="cm">/** The entry change global length */</span>
+    <span class="kd">private</span> <span class="kt">int</span> <span class="n">eccSeqLength</span><span class="o">;</span>
+
+    <span class="cm">/** An instance of this decoder */</span>
+    <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">Asn1Decoder</span> <span class="n">DECODER</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Asn1Decoder</span><span class="o">();</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * Creates a new instance of EntryChangeDecoder wrapping a newly created</span>
+<span class="cm">     * EntryChange Control object.</span>
+<span class="cm">     * </span>
+<span class="cm">     * @param codec The LDAP service instance</span>
+<span class="cm">     */</span>
+    <span class="kd">public</span> <span class="nf">EntryChangeDecorator</span><span class="o">(</span> <span class="n">LdapApiService</span> <span class="n">codec</span> <span class="o">)</span>
+    <span class="o">{</span>
+        <span class="kd">super</span><span class="o">(</span> <span class="n">codec</span><span class="o">,</span> <span class="k">new</span> <span class="n">EntryChangeImpl</span><span class="o">()</span> <span class="o">);</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * Creates a new instance of EntryChangeDecorator wrapping the supplied</span>
+<span class="cm">     * EntryChange Control.</span>
+<span class="cm">     *</span>
+<span class="cm">     * @param codec The LDAP service instance</span>
+<span class="cm">     * @param control The EntryChange Control to be decorated.</span>
+<span class="cm">     */</span>
+    <span class="kd">public</span> <span class="nf">EntryChangeDecorator</span><span class="o">(</span> <span class="n">LdapApiService</span> <span class="n">codec</span><span class="o">,</span> <span class="n">EntryChange</span> <span class="n">control</span> <span class="o">)</span>
+    <span class="o">{</span>
+        <span class="kd">super</span><span class="o">(</span> <span class="n">codec</span><span class="o">,</span> <span class="n">control</span> <span class="o">);</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * Internally used to not have to cast the decorated Control.</span>
+<span class="cm">     *</span>
+<span class="cm">     * @return the decorated Control.</span>
+<span class="cm">     */</span>
+    <span class="kd">private</span> <span class="n">EntryChange</span> <span class="nf">getEntryChange</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="k">return</span> <span class="nf">getDecorated</span><span class="o">();</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * Compute the EntryChangeControl length </span>
+<span class="cm">     * </span>
+<span class="cm">     * &lt;pre&gt;</span>
+<span class="cm">     * 0x30 L1 </span>
+<span class="cm">     *   | </span>
+<span class="cm">     *   +--&amp;gt; 0x0A 0x0(1-4) [1|2|4|8] (changeType) </span>
+<span class="cm">     *  [+--&amp;gt; 0x04 L2 previousDN] </span>
+<span class="cm">     *  [+--&amp;gt; 0x02 0x0(1-4) [0..2^63-1] (changeNumber)]</span>
+<span class="cm">     *  &lt;/pre&gt;</span>
+<span class="cm">     *  </span>
+<span class="cm">     * @return the control length.</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="kt">int</span> <span class="nf">computeLength</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="kt">int</span> <span class="n">changeTypesLength</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span><span class="o">;</span>
+
+        <span class="kt">int</span> <span class="n">previousDnLength</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span>
+        <span class="kt">int</span> <span class="n">changeNumberLength</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span>
+
+        <span class="k">if</span> <span class="o">(</span> <span class="n">getPreviousDn</span><span class="o">()</span> <span class="o">!=</span> <span class="kc">null</span> <span class="o">)</span>
+        <span class="o">{</span>
+            <span class="n">previousDnBytes</span> <span class="o">=</span> <span class="n">Strings</span><span class="o">.</span><span class="na">getBytesUtf8</span><span class="o">(</span> <span class="n">getPreviousDn</span><span class="o">().</span><span class="na">getName</span><span class="o">()</span> <span class="o">);</span>
+            <span class="n">previousDnLength</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">TLV</span><span class="o">.</span><span class="na">getNbBytes</span><span class="o">(</span> <span class="n">previousDnBytes</span><span class="o">.</span><span class="na">length</span> <span class="o">)</span> <span class="o">+</span> <span class="n">previousDnBytes</span><span class="o">.</span><span class="na">length</span><span class="o">;</span>
+        <span class="o">}</span>
+
+        <span class="k">if</span> <span class="o">(</span> <span class="n">getChangeNumber</span><span class="o">()</span> <span class="o">!=</span> <span class="n">UNDEFINED_CHANGE_NUMBER</span> <span class="o">)</span>
+        <span class="o">{</span>
+            <span class="n">changeNumberLength</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">BerValue</span><span class="o">.</span><span class="na">getNbBytes</span><span class="o">(</span> <span class="n">getChangeNumber</span><span class="o">()</span> <span class="o">);</span>
+        <span class="o">}</span>
+
+        <span class="n">eccSeqLength</span> <span class="o">=</span> <span class="n">changeTypesLength</span> <span class="o">+</span> <span class="n">previousDnLength</span> <span class="o">+</span> <span class="n">changeNumberLength</span><span class="o">;</span>
+        <span class="n">valueLength</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">TLV</span><span class="o">.</span><span class="na">getNbBytes</span><span class="o">(</span> <span class="n">eccSeqLength</span> <span class="o">)</span> <span class="o">+</span> <span class="n">eccSeqLength</span><span class="o">;</span>
+
+        <span class="k">return</span> <span class="n">valueLength</span><span class="o">;</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * Encodes the entry change control.</span>
+<span class="cm">     * </span>
+<span class="cm">     * @param buffer The encoded sink</span>
+<span class="cm">     * @return A ByteBuffer that contains the encoded PDU</span>
+<span class="cm">     * @throws EncoderException If anything goes wrong.</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="n">ByteBuffer</span> <span class="nf">encode</span><span class="o">(</span> <span class="n">ByteBuffer</span> <span class="n">buffer</span> <span class="o">)</span> <span class="kd">throws</span> <span class="n">EncoderException</span>
+    <span class="o">{</span>
+        <span class="k">if</span> <span class="o">(</span> <span class="n">buffer</span> <span class="o">==</span> <span class="kc">null</span> <span class="o">)</span>
+        <span class="o">{</span>
+            <span class="k">throw</span> <span class="k">new</span> <span class="nf">EncoderException</span><span class="o">(</span> <span class="n">I18n</span><span class="o">.</span><span class="na">err</span><span class="o">(</span> <span class="n">I18n</span><span class="o">.</span><span class="na">ERR_04023</span> <span class="o">)</span> <span class="o">);</span>
+        <span class="o">}</span>
+
+        <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="n">UniversalTag</span><span class="o">.</span><span class="na">SEQUENCE</span><span class="o">.</span><span class="na">getValue</span><span class="o">()</span> <span class="o">);</span>
+        <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="n">TLV</span><span class="o">.</span><span class="na">getBytes</span><span class="o">(</span> <span class="n">eccSeqLength</span> <span class="o">)</span> <span class="o">);</span>
+
+        <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="n">UniversalTag</span><span class="o">.</span><span class="na">ENUMERATED</span><span class="o">.</span><span class="na">getValue</span><span class="o">()</span> <span class="o">);</span>
+        <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="o">(</span> <span class="kt">byte</span> <span class="o">)</span> <span class="mi">1</span> <span class="o">);</span>
+        <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="n">BerValue</span><span class="o">.</span><span class="na">getBytes</span><span class="o">(</span> <span class="n">getChangeType</span><span class="o">().</span><span class="na">getValue</span><span class="o">()</span> <span class="o">)</span> <span class="o">);</span>
+
+        <span class="k">if</span> <span class="o">(</span> <span class="n">getPreviousDn</span><span class="o">()</span> <span class="o">!=</span> <span class="kc">null</span> <span class="o">)</span>
+        <span class="o">{</span>
+            <span class="n">BerValue</span><span class="o">.</span><span class="na">encode</span><span class="o">(</span> <span class="n">buffer</span><span class="o">,</span> <span class="n">previousDnBytes</span> <span class="o">);</span>
+        <span class="o">}</span>
+
+        <span class="k">if</span> <span class="o">(</span> <span class="n">getChangeNumber</span><span class="o">()</span> <span class="o">!=</span> <span class="n">UNDEFINED_CHANGE_NUMBER</span> <span class="o">)</span>
+        <span class="o">{</span>
+            <span class="n">BerValue</span><span class="o">.</span><span class="na">encode</span><span class="o">(</span> <span class="n">buffer</span><span class="o">,</span> <span class="n">getChangeNumber</span><span class="o">()</span> <span class="o">);</span>
+        <span class="o">}</span>
+
+        <span class="k">return</span> <span class="n">buffer</span><span class="o">;</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="kt">byte</span><span class="o">[]</span> <span class="nf">getValue</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="k">if</span> <span class="o">(</span> <span class="n">value</span> <span class="o">==</span> <span class="kc">null</span> <span class="o">)</span>
+        <span class="o">{</span>
+            <span class="k">try</span>
+            <span class="o">{</span>
+                <span class="n">computeLength</span><span class="o">();</span>
+                <span class="n">ByteBuffer</span> <span class="n">buffer</span> <span class="o">=</span> <span class="n">ByteBuffer</span><span class="o">.</span><span class="na">allocate</span><span class="o">(</span> <span class="n">valueLength</span> <span class="o">);</span>
+
+                <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="n">UniversalTag</span><span class="o">.</span><span class="na">SEQUENCE</span><span class="o">.</span><span class="na">getValue</span><span class="o">()</span> <span class="o">);</span>
+                <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="n">TLV</span><span class="o">.</span><span class="na">getBytes</span><span class="o">(</span> <span class="n">eccSeqLength</span> <span class="o">)</span> <span class="o">);</span>
+
+                <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="n">UniversalTag</span><span class="o">.</span><span class="na">ENUMERATED</span><span class="o">.</span><span class="na">getValue</span><span class="o">()</span> <span class="o">);</span>
+                <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="o">(</span> <span class="kt">byte</span> <span class="o">)</span> <span class="mi">1</span> <span class="o">);</span>
+                <span class="n">buffer</span><span class="o">.</span><span class="na">put</span><span class="o">(</span> <span class="n">BerValue</span><span class="o">.</span><span class="na">getBytes</span><span class="o">(</span> <span class="n">getChangeType</span><span class="o">().</span><span class="na">getValue</span><span class="o">()</span> <span class="o">)</span> <span class="o">);</span>
+
+                <span class="k">if</span> <span class="o">(</span> <span class="n">getPreviousDn</span><span class="o">()</span> <span class="o">!=</span> <span class="kc">null</span> <span class="o">)</span>
+                <span class="o">{</span>
+                    <span class="n">BerValue</span><span class="o">.</span><span class="na">encode</span><span class="o">(</span> <span class="n">buffer</span><span class="o">,</span> <span class="n">previousDnBytes</span> <span class="o">);</span>
+                <span class="o">}</span>
+
+                <span class="k">if</span> <span class="o">(</span> <span class="n">getChangeNumber</span><span class="o">()</span> <span class="o">!=</span> <span class="n">UNDEFINED_CHANGE_NUMBER</span> <span class="o">)</span>
+                <span class="o">{</span>
+                    <span class="n">BerValue</span><span class="o">.</span><span class="na">encode</span><span class="o">(</span> <span class="n">buffer</span><span class="o">,</span> <span class="n">getChangeNumber</span><span class="o">()</span> <span class="o">);</span>
+                <span class="o">}</span>
+
+                <span class="n">value</span> <span class="o">=</span> <span class="n">buffer</span><span class="o">.</span><span class="na">array</span><span class="o">();</span>
+            <span class="o">}</span>
+            <span class="k">catch</span> <span class="o">(</span> <span class="n">Exception</span> <span class="n">e</span> <span class="o">)</span>
+            <span class="o">{</span>
+                <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+            <span class="o">}</span>
+        <span class="o">}</span>
+
+        <span class="k">return</span> <span class="n">value</span><span class="o">;</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="n">ChangeType</span> <span class="nf">getChangeType</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="k">return</span> <span class="nf">getEntryChange</span><span class="o">().</span><span class="na">getChangeType</span><span class="o">();</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">setChangeType</span><span class="o">(</span> <span class="n">ChangeType</span> <span class="n">changeType</span> <span class="o">)</span>
+    <span class="o">{</span>
+        <span class="n">getEntryChange</span><span class="o">().</span><span class="na">setChangeType</span><span class="o">(</span> <span class="n">changeType</span> <span class="o">);</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="n">Dn</span> <span class="nf">getPreviousDn</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="k">return</span> <span class="nf">getEntryChange</span><span class="o">().</span><span class="na">getPreviousDn</span><span class="o">();</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">setPreviousDn</span><span class="o">(</span> <span class="n">Dn</span> <span class="n">previousDn</span> <span class="o">)</span>
+    <span class="o">{</span>
+        <span class="n">getEntryChange</span><span class="o">().</span><span class="na">setPreviousDn</span><span class="o">(</span> <span class="n">previousDn</span> <span class="o">);</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="kt">long</span> <span class="nf">getChangeNumber</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="k">return</span> <span class="nf">getEntryChange</span><span class="o">().</span><span class="na">getChangeNumber</span><span class="o">();</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">setChangeNumber</span><span class="o">(</span> <span class="kt">long</span> <span class="n">changeNumber</span> <span class="o">)</span>
+    <span class="o">{</span>
+        <span class="n">getEntryChange</span><span class="o">().</span><span class="na">setChangeNumber</span><span class="o">(</span> <span class="n">changeNumber</span> <span class="o">);</span>
+    <span class="o">}</span>
+
+
+    <span class="cm">/**</span>
+<span class="cm">     * {@inheritDoc}</span>
+<span class="cm">     */</span>
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="n">Asn1Object</span> <span class="nf">decode</span><span class="o">(</span> <span class="kt">byte</span><span class="o">[]</span> <span class="n">controlBytes</span> <span class="o">)</span> <span class="kd">throws</span> <span class="n">DecoderException</span>
+    <span class="o">{</span>
+        <span class="n">ByteBuffer</span> <span class="n">bb</span> <span class="o">=</span> <span class="n">ByteBuffer</span><span class="o">.</span><span class="na">wrap</span><span class="o">(</span> <span class="n">controlBytes</span> <span class="o">);</span>
+        <span class="n">EntryChangeContainer</span> <span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">EntryChangeContainer</span><span class="o">(</span> <span class="n">getCodecService</span><span class="o">(),</span> <span class="k">this</span> <span class="o">);</span>
+        <span class="n">DECODER</span><span class="o">.</span><span class="na">decode</span><span class="o">(</span> <span class="n">bb</span><span class="o">,</span> <span class="n">container</span> <span class="o">);</span>
+        <span class="k">return</span> <span class="k">this</span><span class="o">;</span>
+    <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
 
 
     <div class="nav">

Added: websites/staging/directory/trunk/content/api/dev-guide/images/controls.graphml
==============================================================================
Binary file - no diff available.

Propchange: websites/staging/directory/trunk/content/api/dev-guide/images/controls.graphml
------------------------------------------------------------------------------
    svn:mime-type = application/xml

Added: websites/staging/directory/trunk/content/api/dev-guide/images/controls.png
==============================================================================
Binary file - no diff available.

Propchange: websites/staging/directory/trunk/content/api/dev-guide/images/controls.png
------------------------------------------------------------------------------
    svn:mime-type = image/png



Mime
View raw message