directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r678756 - /directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java
Date Tue, 22 Jul 2008 13:18:42 GMT
Author: elecharny
Date: Tue Jul 22 06:18:42 2008
New Revision: 678756

URL: http://svn.apache.org/viewvc?rev=678756&view=rev
Log:
Added the code to handle RootDSE search

Modified:
    directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java

Modified: directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java?rev=678756&r1=678755&r2=678756&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-newldap/src/main/java/org/apache/directory/server/newldap/handlers/NewSearchHandler.java
Tue Jul 22 06:18:42 2008
@@ -99,9 +99,58 @@
     }
     
     
-    
+    /**
+     * Deal with RootDE search. 
+     * @param session
+     * @param req
+     * @throws Exception
+     */
     private void handleRootDseSearch( LdapSession session, SearchRequest req ) throws Exception
     {
+        EntryFilteringCursor cursor = null;
+        
+        try
+        {
+            cursor = session.getCoreSession().search( req );
+            
+            // Position the cursor at the beginning
+            cursor.beforeFirst();
+            boolean hasRootDSE = false;
+            
+            while ( cursor.next() )
+            {
+            	if ( hasRootDSE )
+            	{
+            		// This is an error ! We should never find more
+            		// than one rootDSE !
+            		// TODO : handle this error
+            	}
+            	else
+            	{
+            		hasRootDSE = true;
+	                ClonedServerEntry entry = cursor.get();
+	                session.getIoSession().write( generateResponse( req, entry ) );
+            	}
+            }
+    
+            // write the SearchResultDone message
+            session.getIoSession().write( req.getResultResponse() );
+        }
+        finally
+        {
+        	// Close the cursor now.
+            if ( cursor != null )
+            {
+                try
+                {
+                    cursor.close();
+                }
+                catch ( NamingException e )
+                {
+                    LOG.error( "failed on list.close()", e );
+                }
+            }
+        }
     }
     
     



Mime
View raw message