directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucasthei...@apache.org
Subject svn commit: r1595466 - /directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext
Date Sat, 17 May 2014 12:49:58 GMT
Author: lucastheisen
Date: Sat May 17 12:49:58 2014
New Revision: 1595466

URL: http://svn.apache.org/r1595466
Log:
testing

Modified:
    directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext

Modified: directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext?rev=1595466&r1=1595465&r2=1595466&view=diff
==============================================================================
--- directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext (original)
+++ directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext Sat May
17 12:49:58 2014
@@ -27,9 +27,9 @@ Notice: Licensed to the Apache Software 
 
 The LdapConnectionTemplate provides simplified access to the API functions.  It does so by
  
-* [Managing Connections]
-* [Providing Factory Methods For Model Objects]
-* Providing CRUD Methods
+* [Managing Connections](#managing-connections)
+* [Providing Factory Methods For Model Objects](#providing-factory-methods-for-model-objects)
+* [Providing CRUD Methods](#providing-crud-methods)
 * Handling Search Result Iteration
 * Providing Simplified, Password Policy Aware, Authentication/Password Modification Methods
 
@@ -81,60 +81,12 @@ The connection template implements an in
     ModelFactory modelFactory = new MyCustomModelFactory();
     ldapConnectionTemplate.setModelFactory( modelFactory );
 
+Providing CRUD Methods
+----------------------
 
+Handling Search Result Iteration
+--------------------------------
 
-    :::Java
-    LdapConnection connection = new LdapNetworkConnection( "localhost", 389 );
-
-Here, we just created an unsafe connection locally, using the 389 port. Quite simple...
-
-### Secure connection
-
-Although the **LDAPS** (**LDAP** over **SSL**) is now considered as deprecated, many people
continue to use it. The big advantage of not using **LDAPS** is that you don't need to setup
two different listening ports (one for **LDAP** -389- and another one for **LDAPS** -636-
).
-
-The only difference with the previous example is that we have to tell the connection that
it has to use **SSL**, by passing **_true_** as a third parameter (incidentally, passing **_false_**
set a unsafe connection).
-
-Here is an example
-
-    :::Java
-    LdapConnection connection = new LdapNetworkConnection( "localhost", 636, true );
-
-## 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
:
-
-    :::Java
-    LdapConnection connection = new LdapNetworkConnection( "localhost", 389 );
-    connection.setTimeOut( 0 );
-    ...
-    connection.close();
-
->**Note:** Setting a value equal or below 0 will keep the connection opened for ever (or
a soon as the connection is not explicitly closed).
-
-## Closing the connection
-
-Once you don't need to use the connection anymore (remember that hodling a connection keeps
a session opened on the server, and a socket opened between the client and the server), then
you have to close it. This is done by calling the _close()_ method :
-
-    :::Java
-    LdapConnection connection = new LdapNetworkConnection( "localhost", 389 );
-    ...
-    connection.close();
-
-## Using a pool of connections
-
-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 );
+Providing Simplified, Password Policy Aware, Authentication/Password Modification Methods
+-----------------------------------------------------------------------------------------
 
-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