From commits-return-33809-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Mon Mar 12 10:05:49 2012 Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7613F98D1 for ; Mon, 12 Mar 2012 10:05:49 +0000 (UTC) Received: (qmail 4786 invoked by uid 500); 12 Mar 2012 10:05:49 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 4720 invoked by uid 500); 12 Mar 2012 10:05:48 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 4700 invoked by uid 99); 12 Mar 2012 10:05:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Mar 2012 10:05:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Mar 2012 10:05:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A90112388865 for ; Mon, 12 Mar 2012 10:05:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1299604 - /directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java Date: Mon, 12 Mar 2012 10:05:24 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120312100524.A90112388865@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Mon Mar 12 10:05:24 2012 New Revision: 1299604 URL: http://svn.apache.org/viewvc?rev=1299604&view=rev Log: Added javadoc Modified: directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java Modified: directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java?rev=1299604&r1=1299603&r2=1299604&view=diff ============================================================================== --- directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java (original) +++ directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java Mon Mar 12 10:05:24 2012 @@ -30,7 +30,6 @@ import javax.naming.ldap.LdapName; import org.apache.commons.io.FileUtils; import org.apache.directory.ldap.client.api.LdapConnection; -import org.apache.directory.ldap.client.api.LdapConnectionFactory; import org.apache.directory.ldap.client.api.LdapNetworkConnection; import org.apache.directory.server.constants.ServerDNConstants; import org.apache.directory.server.core.api.CoreSession; @@ -358,7 +357,11 @@ public class IntegrationUtils /** - * gets a LdapConnection bound using the default admin Dn uid=admin,ou=system and password "secret" + * Gets a LdapCoreSessionConnection bound using the default admin Dn uid=admin,ou=system and password "secret" + * + * @param dirService The Directory Service to be connected to + * @return A LdapCoreSessionConnection instance + * @exception If the connection could not be established. */ public static LdapConnection getAdminConnection( DirectoryService dirService ) throws Exception { @@ -366,6 +369,16 @@ public class IntegrationUtils } + /** + * Gets a LdapCoreSessionConnection bound using a user's DN and a password. We will bind using those + * credentials. + * + * @param dirService The Directory Service to be connected to + * @param dn The User's DN as a String + * @param password The User's password as a String + * @return A LdapCoreSessionConnection instance + * @exception If the connection could not be established. + */ public static LdapConnection getConnectionAs( DirectoryService dirService, String dn, String password ) throws Exception { @@ -373,24 +386,43 @@ public class IntegrationUtils } + /** + * Gets a LdapCoreSessionConnection bound using a user's DN and a password. We will bind using those + * credentials. + * + * @param dirService The Directory Service to be connected to + * @param dn The User's DN + * @param password The User's password as a String + * @return A LdapCoreSessionConnection instance + * @exception If the connection could not be established. + */ public static LdapConnection getConnectionAs( DirectoryService dirService, Dn dn, String password ) throws Exception { - Object connectionObj = LdapConnectionFactory.getCoreSessionConnection(); + LdapCoreSessionConnection connection = new LdapCoreSessionConnection(); - LdapCoreSessionConnection coreConnection = ( LdapCoreSessionConnection ) connectionObj; - coreConnection.setDirectoryService( dirService ); + connection.setDirectoryService( dirService ); - coreConnection.bind( dn, password ); + connection.bind( dn, password ); - return coreConnection; + return connection; } + /** + * Gets a LdapNetworkConnection bound using a user's DN and a password. We will bind using those + * credentials. + * + * @param dirService The Directory Service to be connected to + * @param dn The User's DN as a String + * @param password The User's password as a String + * @return A LdapNetworkConnection instance + * @exception If the connection could not be established. + */ public static LdapConnection getNetworkConnectionAs( String host, int port, String dn, String password ) throws Exception { - LdapConnection connection = LdapConnectionFactory.getNetworkConnection( host, port ); + LdapConnection connection = new LdapNetworkConnection( host, port); connection.bind( dn, password ); openConnections.add( connection ); @@ -398,6 +430,13 @@ public class IntegrationUtils } + /** + * Gets a LdapNetworkConnection bound to the Admin user (uid=admin,ou=system). + * + * @param dirService The Directory Service to be connected to + * @return A LdapNetworkConnection instance + * @exception If the connection could not be established. + */ public static LdapConnection getAdminNetworkConnection( LdapServer ldapServer ) throws Exception { LdapConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() ); @@ -411,6 +450,16 @@ public class IntegrationUtils } + /** + * Gets a LdapNetworkConnection bound using a user's DN and a password. We will bind using those + * credentials. We specify a LdapServer instance too. + * + * @param ldapServer The LdapServer to be connected to + * @param dn The User's DN as a String + * @param password The User's password as a String + * @return A LdapNetworkConnection instance + * @exception If the connection could not be established. + */ public static LdapConnection getNetworkConnectionAs( LdapServer ldapServer, String userDn, String password ) throws Exception {