directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1014636 - in /websites/staging/directory/trunk/content: ./ api/user-guide/2.2-binding-unbinding.html api/user-guide/2.3-searching.html
Date Wed, 28 Jun 2017 06:11:21 GMT
Author: buildbot
Date: Wed Jun 28 06:11:20 2017
New Revision: 1014636

Log:
Staging update by buildbot for directory

Modified:
    websites/staging/directory/trunk/content/   (props changed)
    websites/staging/directory/trunk/content/api/user-guide/2.2-binding-unbinding.html
    websites/staging/directory/trunk/content/api/user-guide/2.3-searching.html

Propchange: websites/staging/directory/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Jun 28 06:11:20 2017
@@ -1 +1 @@
-1799851
+1800122

Modified: websites/staging/directory/trunk/content/api/user-guide/2.2-binding-unbinding.html
==============================================================================
--- websites/staging/directory/trunk/content/api/user-guide/2.2-binding-unbinding.html (original)
+++ websites/staging/directory/trunk/content/api/user-guide/2.2-binding-unbinding.html Wed
Jun 28 06:11:20 2017
@@ -241,7 +241,7 @@ h2:hover > .headerlink, h3:hover > .head
 <h3 id="rebinding">Rebinding<a class="headerlink" href="#rebinding" title="Permanent
link">&para;</a></h3>
 <p>It's possible to issue a <strong>Bind</strong> on an already bound connection
and the existing LDAP session will be terminated, and replaced by a new LDAP session. In any
case, the connection is not dropped when doing so. Note that if the connection was encrypted,
it remains encrypted.</p>
 <div class="codehilite"><pre><span class="nd">@Test</span>
-<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testDoubleSimpleBindValid</span><span class="o">()</span>
<span class="kd">throws</span> <span class="n">Exception</span>
+<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testRebind</span><span class="o">()</span> <span class="kd">throws</span>
<span class="n">Exception</span>
 <span class="o">{</span>
     <span class="n">connection</span><span class="o">.</span><span
class="na">bind</span><span class="o">(</span> <span class="s">&quot;uid=admin,ou=system&quot;</span><span
class="o">,</span> <span class="s">&quot;secret&quot;</span>
<span class="o">);</span>
 
@@ -259,7 +259,7 @@ h2:hover > .headerlink, h3:hover > .head
 <p>This is a trivial operation : you just send an <strong>UnbindRequest</strong>
to the server, which will invalidate your session. </p>
 <p>It's important to know that when you issue an <strong>Unbind</strong>,
the connection is dropped. It's done like this:</p>
 <div class="codehilite"><pre><span class="nd">@Test</span>
-<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testDoubleSimpleBindValid</span><span class="o">()</span>
<span class="kd">throws</span> <span class="n">Exception</span>
+<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testUnbind</span><span class="o">()</span> <span class="kd">throws</span>
<span class="n">Exception</span>
 <span class="o">{</span>
     <span class="n">connection</span><span class="o">.</span><span
class="na">bind</span><span class="o">(</span> <span class="s">&quot;uid=admin,ou=system&quot;</span><span
class="o">,</span> <span class="s">&quot;secret&quot;</span>
<span class="o">);</span>
 

Modified: websites/staging/directory/trunk/content/api/user-guide/2.3-searching.html
==============================================================================
--- websites/staging/directory/trunk/content/api/user-guide/2.3-searching.html (original)
+++ websites/staging/directory/trunk/content/api/user-guide/2.3-searching.html Wed Jun 28
06:11:20 2017
@@ -188,15 +188,19 @@ h2:hover > .headerlink, h3:hover > .head
 <p>The idea is to define a search <strong>API</strong> which is easy to
use in the simplest cases, but provides all the capability to send complex search requests.</p>
 <h2 id="simple-search">Simple search<a class="headerlink" href="#simple-search"
title="Permanent link">&para;</a></h2>
 <p>Let's first look at a simple search. To process a search we need a starting point
in the tree, a filter, and a scope. Here's an example:</p>
-<div class="codehilite"><pre><span class="n">EntryCursor</span> <span
class="n">cursor</span> <span class="o">=</span> <span class="n">connection</span><span
class="o">.</span><span class="na">search</span><span class="o">(</span>
<span class="s">&quot;ou=system&quot;</span><span class="o">,</span>
<span class="s">&quot;(objectclass=*)&quot;</span><span class="o">,</span>
<span class="n">SearchScope</span><span class="o">.</span><span
class="na">ONELEVEL</span> <span class="o">);</span>
-
-<span class="k">for</span> <span class="o">(</span> <span class="n">Entry</span>
<span class="n">entry</span> <span class="o">:</span> <span class="n">cursor</span>
<span class="o">)</span>
+<div class="codehilite"><pre><span class="nd">@Test</span>
+<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testSearch</span><span class="o">()</span> <span class="kd">throws</span>
<span class="n">Exception</span>
 <span class="o">{</span>
-    <span class="n">assertNotNull</span><span class="o">(</span>
<span class="n">entry</span> <span class="o">);</span>
-    <span class="n">System</span><span class="o">.</span><span
class="na">out</span><span class="o">.</span><span class="na">println</span><span
class="o">(</span> <span class="n">entry</span> <span class="o">);</span>
-<span class="o">}</span>
+    <span class="n">EntryCursor</span> <span class="n">cursor</span>
<span class="o">=</span> <span class="n">connection</span><span
class="o">.</span><span class="na">search</span><span class="o">(</span>
<span class="s">&quot;ou=system&quot;</span><span class="o">,</span>
<span class="s">&quot;(objectclass=*)&quot;</span><span class="o">,</span>
<span class="n">SearchScope</span><span class="o">.</span><span
class="na">ONELEVEL</span> <span class="o">);</span>
+
+    <span class="k">for</span> <span class="o">(</span> <span
class="n">Entry</span> <span class="n">entry</span> <span class="o">:</span>
<span class="n">cursor</span> <span class="o">)</span>
+    <span class="o">{</span>
+        <span class="n">assertNotNull</span><span class="o">(</span>
<span class="n">entry</span> <span class="o">);</span>
+        <span class="n">System</span><span class="o">.</span><span
class="na">out</span><span class="o">.</span><span class="na">println</span><span
class="o">(</span> <span class="n">entry</span> <span class="o">);</span>
+    <span class="o">}</span>
 
-<span class="n">cursor</span><span class="o">.</span><span class="na">close</span><span
class="o">();</span>
+    <span class="n">cursor</span><span class="o">.</span><span
class="na">close</span><span class="o">();</span>
+<span class="o">}</span>
 </pre></div>
 
 
@@ -209,17 +213,21 @@ h2:hover > .headerlink, h3:hover > .head
 </blockquote>
 <h3 id="searching-using-a-dn">Searching using a DN<a class="headerlink" href="#searching-using-a-dn"
title="Permanent link">&para;</a></h3>
 <p>In the previous sample, we used a String to define the starting point of the search.
Sometimes it's convenient to start a search with a DN (i.e. because you got the DN from another
operation). In this case, no need to transform the DN into a String before doing your search,
simply use the DN!</p>
-<div class="codehilite"><pre><span class="n">Dn</span> <span class="n">systemDn</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">Dn</span><span
class="o">(</span> <span class="s">&quot;ou=system&quot;</span>
<span class="o">);</span>
-<span class="o">...</span>
-<span class="n">EntryCursor</span> <span class="n">cursor</span>
<span class="o">=</span> <span class="n">connection</span><span
class="o">.</span><span class="na">search</span><span class="o">(</span>
<span class="n">systemDn</span><span class="o">,</span> <span class="s">&quot;(objectclass=*)&quot;</span><span
class="o">,</span> <span class="n">SearchScope</span><span class="o">.</span><span
class="na">ONELEVEL</span> <span class="o">);</span>
-
-<span class="k">for</span> <span class="o">(</span> <span class="n">Entry</span>
<span class="n">entry</span> <span class="o">:</span> <span class="n">cursor</span>
<span class="o">)</span>
+<div class="codehilite"><pre><span class="nd">@Test</span>
+<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testSearchWithDn</span><span class="o">()</span> <span
class="kd">throws</span> <span class="n">Exception</span>
 <span class="o">{</span>
-    <span class="n">assertNotNull</span><span class="o">(</span>
<span class="n">entry</span> <span class="o">);</span>
-    <span class="n">System</span><span class="o">.</span><span
class="na">out</span><span class="o">.</span><span class="na">println</span><span
class="o">(</span> <span class="n">entry</span> <span class="o">);</span>
-<span class="o">}</span>
+    <span class="n">Dn</span> <span class="n">systemDn</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">Dn</span><span
class="o">(</span> <span class="s">&quot;ou=system&quot;</span>
<span class="o">);</span>
+
+    <span class="n">EntryCursor</span> <span class="n">cursor</span>
<span class="o">=</span> <span class="n">connection</span><span
class="o">.</span><span class="na">search</span><span class="o">(</span>
<span class="n">systemDn</span><span class="o">,</span> <span class="s">&quot;(objectclass=*)&quot;</span><span
class="o">,</span> <span class="n">SearchScope</span><span class="o">.</span><span
class="na">ONELEVEL</span> <span class="o">);</span>
 
-<span class="n">cursor</span><span class="o">.</span><span class="na">close</span><span
class="o">();</span>
+    <span class="k">for</span> <span class="o">(</span> <span
class="n">Entry</span> <span class="n">entry</span> <span class="o">:</span>
<span class="n">cursor</span> <span class="o">)</span>
+    <span class="o">{</span>
+        <span class="n">assertNotNull</span><span class="o">(</span>
<span class="n">entry</span> <span class="o">);</span>
+        <span class="n">System</span><span class="o">.</span><span
class="na">out</span><span class="o">.</span><span class="na">println</span><span
class="o">(</span> <span class="n">entry</span> <span class="o">);</span>
+    <span class="o">}</span>
+
+    <span class="n">cursor</span><span class="o">.</span><span
class="na">close</span><span class="o">();</span>
+<span class="o">}</span>
 </pre></div>
 
 
@@ -274,26 +282,30 @@ h2:hover > .headerlink, h3:hover > .head
 <li>The controls</li>
 </ul>
 <p>In both cases, you should fill the <em>SearchRequest</em> message and
send it to the server:</p>
-<div class="codehilite"><pre><span class="c1">// Create the SearchRequest
object</span>
-<span class="n">SearchRequest</span> <span class="n">req</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">SearchRequestImpl</span><span
class="o">();</span>
-<span class="n">req</span><span class="o">.</span><span class="na">setScope</span><span
class="o">(</span> <span class="n">SearchScope</span><span class="o">.</span><span
class="na">SUBTREE</span> <span class="o">);</span>
-<span class="n">req</span><span class="o">.</span><span class="na">addAttributes</span><span
class="o">(</span> <span class="s">&quot;*&quot;</span> <span
class="o">);</span>
-<span class="n">req</span><span class="o">.</span><span class="na">setTimeLimit</span><span
class="o">(</span> <span class="mi">0</span> <span class="o">);</span>
-<span class="n">req</span><span class="o">.</span><span class="na">setBase</span><span
class="o">(</span> <span class="k">new</span> <span class="n">Dn</span><span
class="o">(</span> <span class="s">&quot;ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
-<span class="n">req</span><span class="o">.</span><span class="na">setFilter</span><span
class="o">(</span> <span class="s">&quot;(cn=user1)&quot;</span>
<span class="o">);</span>
-
-<span class="c1">// Process the request</span>
-<span class="n">SearchCursor</span> <span class="n">searchCursor</span>
<span class="o">=</span> <span class="n">connection</span><span
class="o">.</span><span class="na">search</span><span class="o">(</span>
<span class="n">req</span> <span class="o">);</span>
-
-<span class="k">while</span> <span class="o">(</span> <span class="n">searchCursor</span><span
class="o">.</span><span class="na">next</span><span class="o">()</span>
<span class="o">)</span>
+<div class="codehilite"><pre><span class="nd">@Test</span>
+<span class="kd">public</span> <span class="kt">void</span> <span
class="nf">testSearchWithSearchRequest</span><span class="o">()</span>
<span class="kd">throws</span> <span class="n">Exception</span>
 <span class="o">{</span>
-    <span class="n">Response</span> <span class="n">response</span>
<span class="o">=</span> <span class="n">searchCursor</span><span
class="o">.</span><span class="na">get</span><span class="o">();</span>
+    <span class="c1">// Create the SearchRequest object</span>
+    <span class="n">SearchRequest</span> <span class="n">req</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">SearchRequestImpl</span><span
class="o">();</span>
+    <span class="n">req</span><span class="o">.</span><span class="na">setScope</span><span
class="o">(</span> <span class="n">SearchScope</span><span class="o">.</span><span
class="na">SUBTREE</span> <span class="o">);</span>
+    <span class="n">req</span><span class="o">.</span><span class="na">addAttributes</span><span
class="o">(</span> <span class="s">&quot;*&quot;</span> <span
class="o">);</span>
+    <span class="n">req</span><span class="o">.</span><span class="na">setTimeLimit</span><span
class="o">(</span> <span class="mi">0</span> <span class="o">);</span>
+    <span class="n">req</span><span class="o">.</span><span class="na">setBase</span><span
class="o">(</span> <span class="k">new</span> <span class="n">Dn</span><span
class="o">(</span> <span class="s">&quot;ou=system&quot;</span>
<span class="o">)</span> <span class="o">);</span>
+    <span class="n">req</span><span class="o">.</span><span class="na">setFilter</span><span
class="o">(</span> <span class="s">&quot;(cn=user1)&quot;</span>
<span class="o">);</span>
 
-    <span class="c1">// process the SearchResultEntry</span>
-    <span class="k">if</span> <span class="o">(</span> <span class="n">response</span>
<span class="k">instanceof</span> <span class="n">SearchResultEntry</span>
<span class="o">)</span>
+    <span class="c1">// Process the request</span>
+    <span class="n">SearchCursor</span> <span class="n">searchCursor</span>
<span class="o">=</span> <span class="n">connection</span><span
class="o">.</span><span class="na">search</span><span class="o">(</span>
<span class="n">req</span> <span class="o">);</span>
+
+    <span class="k">while</span> <span class="o">(</span> <span
class="n">searchCursor</span><span class="o">.</span><span class="na">next</span><span
class="o">()</span> <span class="o">)</span>
     <span class="o">{</span>
-        <span class="n">Entry</span> <span class="n">resultEntry</span>
<span class="o">=</span> <span class="o">(</span> <span class="o">(</span>
<span class="n">SearchResultEntry</span> <span class="o">)</span>
<span class="n">response</span> <span class="o">).</span><span
class="na">getEntry</span><span class="o">();</span>
-        <span class="o">...</span>
+        <span class="n">Response</span> <span class="n">response</span>
<span class="o">=</span> <span class="n">searchCursor</span><span
class="o">.</span><span class="na">get</span><span class="o">();</span>
+
+        <span class="c1">// process the SearchResultEntry</span>
+        <span class="k">if</span> <span class="o">(</span> <span
class="n">response</span> <span class="k">instanceof</span> <span
class="n">SearchResultEntry</span> <span class="o">)</span>
+        <span class="o">{</span>
+            <span class="n">Entry</span> <span class="n">resultEntry</span>
<span class="o">=</span> <span class="o">(</span> <span class="o">(</span>
<span class="n">SearchResultEntry</span> <span class="o">)</span>
<span class="n">response</span> <span class="o">).</span><span
class="na">getEntry</span><span class="o">();</span>
+            <span class="n">System</span><span class="o">.</span><span
class="na">out</span><span class="o">.</span><span class="na">println</span><span
class="o">(</span> <span class="n">resultEntry</span> <span class="o">);</span>
+        <span class="o">}</span>
     <span class="o">}</span>
 <span class="o">}</span>
 </pre></div>



Mime
View raw message