directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r871744 - in /websites/staging/directory/trunk/content: ./ api/user-guide/1.4-preparation-to-code.html api/user-guide/2.1-connection-disconnection.html
Date Mon, 29 Jul 2013 16:50:22 GMT
Author: buildbot
Date: Mon Jul 29 16:50:22 2013
New Revision: 871744

Log:
Staging update by buildbot for directory

Modified:
    websites/staging/directory/trunk/content/   (props changed)
    websites/staging/directory/trunk/content/api/user-guide/1.4-preparation-to-code.html
    websites/staging/directory/trunk/content/api/user-guide/2.1-connection-disconnection.html

Propchange: websites/staging/directory/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Jul 29 16:50:22 2013
@@ -1 +1 @@
-1507153
+1508132

Modified: websites/staging/directory/trunk/content/api/user-guide/1.4-preparation-to-code.html
==============================================================================
--- websites/staging/directory/trunk/content/api/user-guide/1.4-preparation-to-code.html (original)
+++ websites/staging/directory/trunk/content/api/user-guide/1.4-preparation-to-code.html Mon
Jul 29 16:50:22 2013
@@ -138,12 +138,12 @@
 
 
 <h1 id="14-preparation-to-code">1.4 - Preparation to code</h1>
-<p>In order to develop with the <strong>Apache Directory LDAP API</strong>,
you first have to use a <strong>Java 5</strong> JDK or higher. </p>
+<p>In order to develop with the <strong>Apache Directory LDAP API</strong>,
you first have to use a <strong>Java 6</strong> JDK or higher. </p>
 <p>Second, you have to download the <strong><a href="http://directory.apache.org/api/downloads.html">API</a></strong>.
This package contains not only the <strong>LDAP API</strong>, but also all the
needed jars (like <em>commons-lang</em>, <em>slf4j</em>...).</p>
-<p>If you are using <strong>Maven</strong>, you don't even have to refer
all the libraries that are found in the package, they will be deduced automatically. You will
just have to add a dependency on <em>shared-all.jar</em> :</p>
+<p>If you are using <strong>Maven</strong>, you don't even have to refer
all the libraries that are found in the package, they will be deduced automatically. You will
just have to add a dependency on <em>api-all.jar</em> :</p>
 <div class="codehilite"><pre><span class="nt">&lt;dependency&gt;</span>
   <span class="nt">&lt;groupId&gt;</span>org.apache.directory.shared<span
class="nt">&lt;/groupId&gt;</span>
-  <span class="nt">&lt;artifactId&gt;</span>shared-all<span class="nt">&lt;/artifactId&gt;</span>
+  <span class="nt">&lt;artifactId&gt;</span>api-all<span class="nt">&lt;/artifactId&gt;</span>
 <span class="nt">&lt;/dependency&gt;</span>
 </pre></div>
 

Modified: websites/staging/directory/trunk/content/api/user-guide/2.1-connection-disconnection.html
==============================================================================
--- websites/staging/directory/trunk/content/api/user-guide/2.1-connection-disconnection.html
(original)
+++ websites/staging/directory/trunk/content/api/user-guide/2.1-connection-disconnection.html
Mon Jul 29 16:50:22 2013
@@ -138,7 +138,7 @@
 
 
 <h1 id="21-connection-and-disconnection">2.1 - Connection and disconnection</h1>
-<p><strong>LDAP</strong> is a protocol which requires the user to be connected
- and eventually identified - in order to be able to send requests to the server. We maintain
this connection potentially forever. What make the <strong>LDAP</strong> protocol
different from, say, the <strong>HTTP</strong> protocol is that the connection
must be issued explicitly. Let's see how we do that.</p>
+<p><strong>LDAP</strong> is a protocol which requires the user to be connected
- and likely identified - in order to be able to send requests to the server. We maintain
this connection potentially forever. What make the <strong>LDAP</strong> protocol
different from, say, the <strong>HTTP</strong> protocol is that the connection
must be issued explicitly. Let's see how we do that.</p>
 <h2 id="opening-a-connection">Opening a connection</h2>
 <p>We can open a secure or a standard connection. </p>
 <h3 id="standard-connection">Standard connection</h3>
@@ -156,7 +156,7 @@
 </pre></div>
 
 
-<p>h2. Maintaining the connection opened</p>
+<h2 id="maintaining-the-connection-opened">Maintaining the connection opened</h2>
 <p>We keep the connection opened for a limited period of time, defaulting to 30 seconds.
This might be not long enough, so one can change this delay by calling the <em>setTimeOut()</em>
method :</p>
 <div class="codehilite"><pre><span class="n">LdapConnection</span>
<span class="n">connection</span> <span class="o">=</span> <span
class="k">new</span> <span class="n">LdapNetworkConnection</span><span
class="o">(</span> <span class="s">&quot;localhost&quot;</span><span
class="o">,</span> <span class="mi">389</span> <span class="o">);</span>
 <span class="n">connection</span><span class="o">.</span><span
class="na">setTimeOut</span><span class="o">(</span> <span class="mi">0</span>
<span class="o">);</span>
@@ -176,6 +176,24 @@
 </pre></div>
 
 
+<h2 id="using-a-pool-of-connection">Using a pool of connection</h2>
+<p>Creating a connection is expensive. If you are to reuse a connection over and over,
or if you are writing an application that will need many LDAP conenctions, you may want to
use a pool of connections.</p>
+<p>This is slightly more complex than simply opening a new connection, as you have
a lot of parametrs that can come into play when creating a pool.
+Here is an example of creation of a pool of connections :</p>
+<div class="codehilite"><pre><span class="n">LdapConnectionConfig</span>
<span class="n">config</span> <span class="o">=</span> <span class="k">new</span>
<span class="n">LdapConnectionConfig</span><span class="o">();</span>
+<span class="n">config</span><span class="o">.</span><span class="na">setLdapHost</span><span
class="o">(</span> <span class="s">&quot;localhost&quot;</span>
<span class="o">);</span>
+<span class="n">config</span><span class="o">.</span><span class="na">setLdapPort</span><span
class="o">(</span> <span class="mi">389</span> <span class="o">);</span>
+<span class="n">config</span><span class="o">.</span><span class="na">setName</span><span
class="o">(</span> <span class="s">&quot;uid=admin,ou=system&quot;</span>
<span class="o">);</span>
+<span class="n">config</span><span class="o">.</span><span class="na">setCredentials</span><span
class="o">(</span> <span class="s">&quot;secret&quot;</span>
<span class="o">);</span>
+<span class="n">PoolableLdapConnectionFactory</span> <span class="n">factory</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">PoolableLdapConnectionFactory</span><span
class="o">(</span> <span class="n">config</span> <span class="o">);</span>
+<span class="n">LdapConnectionPool</span> <span class="n">pool</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">LdapConnectionPool</span><span
class="o">(</span> <span class="n">factory</span> <span class="o">);</span>
+<span class="n">pool</span><span class="o">.</span><span class="na">setTestOnBorrow</span><span
class="o">(</span> <span class="kc">true</span> <span class="o">);</span>
+</pre></div>
+
+
+<p>Here, we just have created a pool of connections which all are unthenticated using
the administrator user. You can create anonymous connections, it's just a matter of not setting
any name or credentials in the config.</p>
+
+
     <div class="nav">
         <div class="nav_prev">
         



Mime
View raw message