directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r985694 - in /directory: apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/ apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations...
Date Sun, 15 Aug 2010 15:46:52 GMT
Author: elecharny
Date: Sun Aug 15 15:46:52 2010
New Revision: 985694

URL: http://svn.apache.org/viewvc?rev=985694&view=rev
Log:
Merged the DeleteRequest casses

Removed:
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/DeleteRequest.java
Modified:
    directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
    directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java

Modified: directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java?rev=985694&r1=985693&r2=985694&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
(original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
Sun Aug 15 15:46:52 2010
@@ -31,7 +31,6 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.message.AbandonRequest;
 import org.apache.directory.ldap.client.api.message.AddRequest;
 import org.apache.directory.ldap.client.api.message.CompareRequest;
-import org.apache.directory.ldap.client.api.message.DeleteRequest;
 import org.apache.directory.ldap.client.api.message.ExtendedRequest;
 import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
 import org.apache.directory.ldap.client.api.message.ModifyRequest;
@@ -335,19 +334,16 @@ public class LdapCoreSessionConnection i
     /**
      * {@inheritDoc}
      */
-    public DeleteResponse delete( DeleteRequest deleteRequest ) throws LdapException
+    public DeleteResponse delete( InternalDeleteRequest deleteRequest ) throws LdapException
     {
         int newId = messageId.incrementAndGet();
 
         DeleteResponse resp = new DeleteResponseImpl( newId );
         resp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
 
-        InternalDeleteRequest idelete = new DeleteRequestImpl( newId );
-
         try
         {
-            idelete.setName( deleteRequest.getTargetDn() );
-            session.delete( idelete );
+            session.delete( deleteRequest );
         }
         catch ( LdapException e )
         {
@@ -357,7 +353,8 @@ public class LdapCoreSessionConnection i
             resp.getLdapResult().setErrorMessage( e.getMessage() );
         }
 
-        addResponseControls( idelete, resp );
+        addResponseControls( deleteRequest, resp );
+
         return resp;
     }
 
@@ -367,8 +364,10 @@ public class LdapCoreSessionConnection i
      */
     public DeleteResponse delete( DN dn ) throws LdapException
     {
-        DeleteRequest delReq = new DeleteRequest( dn );
-        return delete( delReq );
+        InternalDeleteRequest deleteRequest = new DeleteRequestImpl();
+        deleteRequest.setName( dn );
+
+        return delete( deleteRequest );
     }
 
 

Modified: directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java?rev=985694&r1=985693&r2=985694&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
(original)
+++ directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
Sun Aug 15 15:46:52 2010
@@ -37,7 +37,6 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.ldap.client.api.future.DeleteFuture;
 import org.apache.directory.ldap.client.api.listener.DeleteListener;
-import org.apache.directory.ldap.client.api.message.DeleteRequest;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.CoreSession;
@@ -45,8 +44,10 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.name.DN;
 import org.junit.After;
 import org.junit.Before;
@@ -193,8 +194,7 @@ public class ClientDeleteRequestTest ext
             DeleteListener.class );
         deleteChildrenMethod.setAccessible( true );
 
-        DeleteResponse response = ( DeleteResponse ) deleteChildrenMethod.invoke( connection,
dn, null,
-            null );
+        DeleteResponse response = ( DeleteResponse ) deleteChildrenMethod.invoke( connection,
dn, null, null );
         assertNotNull( response );
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
@@ -221,8 +221,7 @@ public class ClientDeleteRequestTest ext
 
         DeleteListener listener = new DeleteListener()
         {
-            public void entryDeleted( LdapAsyncConnection connection, DeleteResponse response
)
-                throws LdapException
+            public void entryDeleted( LdapAsyncConnection connection, DeleteResponse response
) throws LdapException
             {
                 assertNotNull( response );
                 assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode()
);
@@ -249,7 +248,10 @@ public class ClientDeleteRequestTest ext
 
         assertTrue( session.exists( dn ) );
 
-        DeleteFuture deleteFuture = connection.deleteAsync( new DeleteRequest( dn ) );
+        InternalDeleteRequest deleteRequest = new DeleteRequestImpl();
+        deleteRequest.setName( dn );
+
+        DeleteFuture deleteFuture = connection.deleteAsync( deleteRequest );
 
         try
         {

Modified: directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java?rev=985694&r1=985693&r2=985694&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java
(original)
+++ directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java
Sun Aug 15 15:46:52 2010
@@ -13,7 +13,6 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.future.SearchFuture;
 import org.apache.directory.ldap.client.api.message.AddRequest;
 import org.apache.directory.ldap.client.api.message.CompareRequest;
-import org.apache.directory.ldap.client.api.message.DeleteRequest;
 import org.apache.directory.ldap.client.api.message.ExtendedRequest;
 import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
 import org.apache.directory.ldap.client.api.message.ModifyRequest;
@@ -22,6 +21,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.name.DN;
 
 
@@ -155,7 +155,7 @@ public interface LdapAsyncConnection ext
      * @return delete operation's response, null if a non-null listener value is provided
      * @throws LdapException If the DN is not valid or if the deletion failed
      */
-    DeleteFuture deleteAsync( DeleteRequest delRequest ) throws LdapException;
+    DeleteFuture deleteAsync( InternalDeleteRequest delRequest ) throws LdapException;
 
 
     /**

Modified: directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java?rev=985694&r1=985693&r2=985694&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
(original)
+++ directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
Sun Aug 15 15:46:52 2010
@@ -7,7 +7,6 @@ import java.util.List;
 import org.apache.directory.ldap.client.api.message.AbandonRequest;
 import org.apache.directory.ldap.client.api.message.AddRequest;
 import org.apache.directory.ldap.client.api.message.CompareRequest;
-import org.apache.directory.ldap.client.api.message.DeleteRequest;
 import org.apache.directory.ldap.client.api.message.ExtendedRequest;
 import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
 import org.apache.directory.ldap.client.api.message.ModifyRequest;
@@ -26,6 +25,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.ModifyDnResponse;
 import org.apache.directory.shared.ldap.message.internal.ModifyResponse;
 import org.apache.directory.shared.ldap.message.internal.Response;
@@ -398,7 +398,7 @@ public interface LdapConnection
      * @return delete operation's response, null if a non-null listener value is provided
      * @throws LdapException If the DN is not valid or if the deletion failed
      */
-    public abstract DeleteResponse delete( DeleteRequest deleteRequest ) throws LdapException;
+    public abstract DeleteResponse delete( InternalDeleteRequest deleteRequest ) throws LdapException;
 
 
     /**

Modified: directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=985694&r1=985693&r2=985694&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Sun Aug 15 15:46:52 2010
@@ -54,7 +54,6 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.message.AbandonRequest;
 import org.apache.directory.ldap.client.api.message.AddRequest;
 import org.apache.directory.ldap.client.api.message.CompareRequest;
-import org.apache.directory.ldap.client.api.message.DeleteRequest;
 import org.apache.directory.ldap.client.api.message.ExtendedRequest;
 import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
 import org.apache.directory.ldap.client.api.message.ModifyRequest;
@@ -2224,7 +2223,8 @@ public class LdapNetworkConnection exten
      */
     public DeleteResponse delete( DN dn ) throws LdapException
     {
-        DeleteRequest deleteRequest = new DeleteRequest( dn );
+        InternalDeleteRequest deleteRequest = new DeleteRequestImpl();
+        deleteRequest.setName( dn );
 
         return delete( deleteRequest );
     }
@@ -2243,9 +2243,10 @@ public class LdapNetworkConnection exten
 
         if ( isControlSupported( treeDeleteOid ) )
         {
-            DeleteRequest delRequest = new DeleteRequest( dn );
-            delRequest.add( new ControlImpl( treeDeleteOid ) );
-            return delete( delRequest );
+            InternalDeleteRequest deleteRequest = new DeleteRequestImpl();
+            deleteRequest.setName( dn );
+            deleteRequest.addControl( new ControlImpl( treeDeleteOid ) );
+            return delete( deleteRequest );
         }
         else
         {
@@ -2273,9 +2274,10 @@ public class LdapNetworkConnection exten
 
             if ( isControlSupported( treeDeleteOid ) )
             {
-                DeleteRequest delRequest = new DeleteRequest( newDn );
-                delRequest.add( new ControlImpl( treeDeleteOid ) );
-                return delete( delRequest );
+                InternalDeleteRequest deleteRequest = new DeleteRequestImpl();
+                deleteRequest.setName( newDn );
+                deleteRequest.addControl( new ControlImpl( treeDeleteOid ) );
+                return delete( deleteRequest );
             }
             else
             {
@@ -2352,7 +2354,9 @@ public class LdapNetworkConnection exten
                 LOG.debug( "deleting {}", dn.getName() );
                 cursorMap.remove( dn );
                 cursor.close();
-                delResponse = delete( new DeleteRequest( dn ) );
+                InternalDeleteRequest deleteRequest = new DeleteRequestImpl();
+                deleteRequest.setName( dn );
+                delResponse = delete( deleteRequest );
             }
             else
             {
@@ -2371,7 +2375,9 @@ public class LdapNetworkConnection exten
                 cursorMap.remove( dn );
                 cursor.close();
                 LOG.debug( "deleting {}", dn.getName() );
-                delResponse = delete( new DeleteRequest( dn ) );
+                InternalDeleteRequest deleteRequest = new DeleteRequestImpl();
+                deleteRequest.setName( dn );
+                delResponse = delete( deleteRequest );
             }
         }
         catch ( Exception e )
@@ -2388,7 +2394,7 @@ public class LdapNetworkConnection exten
     /**
      * {@inheritDoc}
      */
-    public DeleteResponse delete( DeleteRequest deleteRequest ) throws LdapException
+    public DeleteResponse delete( InternalDeleteRequest deleteRequest ) throws LdapException
     {
         DeleteFuture deleteFuture = deleteAsync( deleteRequest );
 
@@ -2396,10 +2402,8 @@ public class LdapNetworkConnection exten
         try
         {
             // Read the response, waiting for it if not available immediately
-            long timeout = getTimeout( deleteRequest.getTimeout() );
-
             // Get the response, blocking
-            DeleteResponse delResponse = deleteFuture.get( timeout, TimeUnit.MILLISECONDS
);
+            DeleteResponse delResponse = deleteFuture.get( timeOut, TimeUnit.MILLISECONDS
);
 
             if ( delResponse == null )
             {
@@ -2454,24 +2458,19 @@ public class LdapNetworkConnection exten
     /**
      * {@inheritDoc}
      */
-    public DeleteFuture deleteAsync( DeleteRequest delRequest ) throws LdapException
+    public DeleteFuture deleteAsync( InternalDeleteRequest delRequest ) throws LdapException
     {
         checkSession();
 
         int newId = messageId.incrementAndGet();
 
-        InternalDeleteRequest internalDelRequest = new DeleteRequestImpl( newId );
-
         delRequest.setMessageId( newId );
 
-        internalDelRequest.setName( delRequest.getTargetDn() );
-        setControls( delRequest.getControls(), internalDelRequest );
-
         DeleteFuture deleteFuture = new DeleteFuture( this, newId );
         addToFutureMap( newId, deleteFuture );
 
         // Send the request to the server
-        WriteFuture writeFuture = ldapSession.write( internalDelRequest );
+        WriteFuture writeFuture = ldapSession.write( delRequest );
 
         // Wait for the message to be sent to the server
         if ( !writeFuture.awaitUninterruptibly( getTimeout( 0 ) ) )

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java?rev=985694&r1=985693&r2=985694&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java
Sun Aug 15 15:46:52 2010
@@ -50,6 +50,16 @@ public class DeleteRequestImpl extends A
     /**
      * Creates a DeleteRequest implementing object used to delete a
      * leaf entry from the DIT.
+     */
+    public DeleteRequestImpl()
+    {
+        super( -1, TYPE );
+    }
+
+
+    /**
+     * Creates a DeleteRequest implementing object used to delete a
+     * leaf entry from the DIT.
      * 
      * @param id the sequential message identifier
      */



Mime
View raw message