You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2009/08/02 08:03:40 UTC

svn commit: r799997 - in /directory: apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/

Author: kayyagari
Date: Sun Aug  2 06:03:39 2009
New Revision: 799997

URL: http://svn.apache.org/viewvc?rev=799997&view=rev
Log:
o removed the 'deleteChildren' flag, renamed the method to deleteTree and added overloaded this method
o updated the corresponding testcase

Modified:
    directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
    directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java

Modified: directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java?rev=799997&r1=799996&r2=799997&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java (original)
+++ directory/apacheds/trunk/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java Sun Aug  2 06:03:39 2009
@@ -153,7 +153,7 @@
         
         assertTrue( session.exists( dn ) );
         
-        DeleteResponse response = connection.delete( dn, true );
+        DeleteResponse response = connection.deleteTree( dn );
         assertNotNull( response );
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
         

Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java?rev=799997&r1=799996&r2=799997&view=diff
==============================================================================
--- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java (original)
+++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java Sun Aug  2 06:03:39 2009
@@ -2004,7 +2004,7 @@
      */
     public DeleteResponse delete( LdapDN dn ) throws LdapException
     {
-        return delete( dn, false, null ); 
+        return delete( dn, null ); 
     }
 
 
@@ -2052,45 +2052,51 @@
      * @return operation's response, null if a non-null listener value is provided
      * @throws LdapException
      */
-    public DeleteResponse delete( LdapDN dn, boolean deleteChildren, DeleteListener listener )  throws LdapException
+    public DeleteResponse deleteTree( LdapDN dn, DeleteListener listener )  throws LdapException
     {
-        DeleteRequest delRequest = null;
-        
-        if( deleteChildren )
+        String treeDeleteOid = "1.2.840.113556.1.4.805";
+        if( isControlSupported( treeDeleteOid ) ) 
         {
-            String treeDeleteOid = "1.2.840.113556.1.4.805";
-            if( isControlSupported( treeDeleteOid ) ) 
-            {
-                delRequest = new DeleteRequest( dn );
-                delRequest.add( new BasicControl( treeDeleteOid ) );
-            }
-            else
-            {
-                return deleteRecursive( dn, new HashMap(), listener );
-            }
+            DeleteRequest delRequest = new DeleteRequest( dn );
+            delRequest.add( new BasicControl( treeDeleteOid ) );
+            return delete( delRequest, listener ); 
         }
         else
         {
-            delRequest = new DeleteRequest( dn );
+            return deleteRecursive( dn, null, listener );
         }
-        
-        return delete( delRequest, listener ); 
     }
     
+
+    /**
+     * @see #deleteTree(LdapDN)
+     */
+    public DeleteResponse deleteTree( String dn )  throws LdapException
+    {
+        try
+        {
+            return deleteTree( new LdapDN( dn ) );
+        }
+        catch( InvalidNameException e )
+        {
+            LOG.error( e.getMessage(), e );
+            throw new LdapException( e.getMessage(), e );
+        }
+    }
+
     
     /**
      * deletes the entry with the given DN and all its children
      * 
      * @param dn the target entry DN
-     * @param deleteChildren flag to indicate whether to delete the children
      * @return delete operation's response
      * @throws LdapException
      */
-    public DeleteResponse delete( LdapDN dn, boolean deleteChildren )  throws LdapException
+    public DeleteResponse deleteTree( LdapDN dn )  throws LdapException
     {
-        return delete( dn, deleteChildren, null );
+        return deleteTree( dn, null );
     }
-
+    
     
     /**
      * removes all child entries present under the given DN and finally the DN itself