directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1508132 - in /directory/site/trunk/content/api/user-guide: 1.4-preparation-to-code.mdtext 2.1-connection-disconnection.mdtext
Date Mon, 29 Jul 2013 16:50:12 GMT
Author: elecharny
Date: Mon Jul 29 16:50:11 2013
New Revision: 1508132

URL: http://svn.apache.org/r1508132
Log:
Update some part of the user guide

Modified:
    directory/site/trunk/content/api/user-guide/1.4-preparation-to-code.mdtext
    directory/site/trunk/content/api/user-guide/2.1-connection-disconnection.mdtext

Modified: directory/site/trunk/content/api/user-guide/1.4-preparation-to-code.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/user-guide/1.4-preparation-to-code.mdtext?rev=1508132&r1=1508131&r2=1508132&view=diff
==============================================================================
--- directory/site/trunk/content/api/user-guide/1.4-preparation-to-code.mdtext (original)
+++ directory/site/trunk/content/api/user-guide/1.4-preparation-to-code.mdtext Mon Jul 29
16:50:11 2013
@@ -24,16 +24,16 @@ Notice: Licensed to the Apache Software 
 
 # 1.4 - Preparation to code
 
-In order to develop with the **Apache Directory LDAP API**, you first have to use a **Java
5** JDK or higher. 
+In order to develop with the **Apache Directory LDAP API**, you first have to use a **Java
6** JDK or higher. 
 
 Second, you have to download the **[API](http://directory.apache.org/api/downloads.html)**.
This package contains not only the **LDAP API**, but also all the needed jars (like _commons-lang_,
_slf4j_...).
 
-If you are using **Maven**, 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 _shared-all.jar_ :
+If you are using **Maven**, 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 _api-all.jar_ :
 
     :::XML
     <dependency>
       <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-all</artifactId>
+      <artifactId>api-all</artifactId>
     </dependency>
 
 

Modified: directory/site/trunk/content/api/user-guide/2.1-connection-disconnection.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/user-guide/2.1-connection-disconnection.mdtext?rev=1508132&r1=1508131&r2=1508132&view=diff
==============================================================================
--- directory/site/trunk/content/api/user-guide/2.1-connection-disconnection.mdtext (original)
+++ directory/site/trunk/content/api/user-guide/2.1-connection-disconnection.mdtext Mon Jul
29 16:50:11 2013
@@ -24,7 +24,7 @@ Notice: Licensed to the Apache Software 
 
 # 2.1 - Connection and disconnection
 
-**LDAP** 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 **LDAP** protocol different from, say, the **HTTP** protocol is that
the connection must be issued explicitly. Let's see how we do that.
+**LDAP** 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 **LDAP** protocol different from, say, the **HTTP** protocol is that
the connection must be issued explicitly. Let's see how we do that.
 
 ## Opening a connection
 
@@ -50,7 +50,7 @@ Here is an example
     :::Java
     LdapConnection connection = new LdapNetworkConnection( "localhost", 636, true );
 
-h2. Maintaining the connection opened
+## Maintaining the connection opened
 
 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 _setTimeOut()_ method
:
 
@@ -70,3 +70,22 @@ Once you don't need to use the connectio
     LdapConnection connection = new LdapNetworkConnection( "localhost", 389 );
     ...
     connection.close();
+
+## Using a pool of connection
+
+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.
+
+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 :
+
+    :::Java
+    LdapConnectionConfig config = new LdapConnectionConfig();
+    config.setLdapHost( "localhost" );
+    config.setLdapPort( 389 );
+    config.setName( "uid=admin,ou=system" );
+    config.setCredentials( "secret" );
+    PoolableLdapConnectionFactory factory = new PoolableLdapConnectionFactory( config );
+    LdapConnectionPool pool = new LdapConnectionPool( factory );
+    pool.setTestOnBorrow( true );
+
+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.



Mime
View raw message