You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/06/06 16:35:54 UTC

svn commit: r1346918 - in /directory/apacheds/branches/apacheds-txns-merge: core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java

Author: elecharny
Date: Wed Jun  6 14:35:54 2012
New Revision: 1346918

URL: http://svn.apache.org/viewvc?rev=1346918&view=rev
Log:
Fixed a bug and merged with rev1299604

Modified:
    directory/apacheds/branches/apacheds-txns-merge/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
    directory/apacheds/branches/apacheds-txns-merge/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java

Modified: directory/apacheds/branches/apacheds-txns-merge/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns-merge/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java?rev=1346918&r1=1346917&r2=1346918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns-merge/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java (original)
+++ directory/apacheds/branches/apacheds-txns-merge/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java Wed Jun  6 14:35:54 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;
@@ -357,7 +356,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
     {
@@ -365,35 +368,71 @@ 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
     {
         return getConnectionAs( dirService, new Dn( dn ), password );
     }
 
 
+    /**
+     * 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 );
-
-        coreConnection.bind( dn, password );
+        connection.setDirectoryService( dirService );
+        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 );
+        
         return connection;
     }
 
 
+    /**
+     * Gets a LdapNetworkConnection bound to the Admin user (uid=admin,ou=system).
+     * 
+     * @param ldapServer The LdapServer 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() );
@@ -407,6 +446,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
     {
         return getNetworkConnectionAs( "localhost", ldapServer.getPort(), userDn, password );

Modified: directory/apacheds/branches/apacheds-txns-merge/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns-merge/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1346918&r1=1346917&r2=1346918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns-merge/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/branches/apacheds-txns-merge/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Wed Jun  6 14:35:54 2012
@@ -377,7 +377,7 @@ public class DefaultOperationManager imp
                 txnManager.applyPendingTxns();
                 
                 directoryService.resetCaches();
-                directoryService.getSchemaManager().reloadAllEnabled();
+                directoryService.getSchemaManager().loadAllEnabled();
                 
                 head.reinitLogicalData( directoryService );
             }
@@ -508,7 +508,7 @@ public class DefaultOperationManager imp
                     if ( startedTxn && isCausedByConflictException( le ) )
                     {
                         // Retry
-                        done = false; 
+                        done = false;
                     }
                     else
                     {
@@ -537,7 +537,7 @@ public class DefaultOperationManager imp
                 }
 
                 //txnManager.applyPendingTxns();
-            } 
+            }
         }
         while ( !done );
 
@@ -876,7 +876,7 @@ public class DefaultOperationManager imp
                 if ( startedTxn && isCausedByConflictException( le ) )
                 {
                     // Retry
-                    done = false; 
+                    done = false;
                 }
                 else
                 {
@@ -1185,7 +1185,7 @@ public class DefaultOperationManager imp
                 // populate the context with the old entry
                 eagerlyPopulateFields( modifyContext );
 
-                // Call the Modify method 
+                // Call the Modify method
                 head.modify( modifyContext );
             }
             catch ( LdapException le )
@@ -1193,7 +1193,7 @@ public class DefaultOperationManager imp
                 if ( startedTxn && isCausedByConflictException( le ) )
                 {
                     // Retry
-                    done = false; 
+                    done = false;
                 }
                 else
                 {
@@ -1380,7 +1380,7 @@ public class DefaultOperationManager imp
                 if ( startedTxn && isCausedByConflictException( le ) )
                 {
                     // Retry
-                    done = false; 
+                    done = false;
                 }
                 else
                 {
@@ -1568,7 +1568,7 @@ public class DefaultOperationManager imp
                 if ( startedTxn && isCausedByConflictException( le ) )
                 {
                     // Retry
-                    done = false; 
+                    done = false;
                 }
                 else
                 {
@@ -1723,7 +1723,7 @@ public class DefaultOperationManager imp
             }
 
             // Unlock the ReferralManager
-            //directoryService.getReferralManager().unlock();    
+            //directoryService.getReferralManager().unlock();
             
             try
             {
@@ -1741,7 +1741,7 @@ public class DefaultOperationManager imp
                 if ( startedTxn && isCausedByConflictException( le ) )
                 {
                     // Retry
-                    done = false; 
+                    done = false;
                 }
                 else
                 {