directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r585059 - in /directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core: internal/model/ jobs/ model/
Date Tue, 16 Oct 2007 06:47:19 GMT
Author: seelmann
Date: Mon Oct 15 23:47:17 2007
New Revision: 585059

URL: http://svn.apache.org/viewvc?rev=585059&view=rev
Log:
DIRSTUDIO-123: Moved delete entry code from BrowserConnection to DeleteEntriesJob.

Modified:
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionModifyHandler.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/DummyConnection.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBrowserConnection.java

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java?rev=585059&r1=585058&r2=585059&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
Mon Oct 15 23:47:17 2007
@@ -846,12 +846,6 @@
     }
 
 
-    public void delete( IEntry entry, StudioProgressMonitor monitor )
-    {
-        modifyHandler.delete( entry, monitor );
-    }
-
-
     public void importLdif( LdifEnumeration enumeration, Writer logWriter, boolean continueOnError,
         StudioProgressMonitor monitor )
     {

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionModifyHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionModifyHandler.java?rev=585059&r1=585058&r2=585059&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionModifyHandler.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionModifyHandler.java
Mon Oct 15 23:47:17 2007
@@ -80,27 +80,6 @@
     }
 
 
-    void delete( IEntry entry, StudioProgressMonitor monitor )
-    {
-        try
-        {
-            LdifChangeDeleteRecord cdr = new LdifChangeDeleteRecord( LdifDnLine.create( entry.getDn().toString()
) );
-            ModelConverter.addControls( cdr, entry );
-            cdr.setChangeType( LdifChangeTypeLine.createDelete() );
-            cdr.finish( LdifSepLine.create() );
-
-            this.applyModificationAndLog( cdr, monitor );
-
-            browserConnection.uncacheEntry( entry );
-
-        }
-        catch ( ConnectionException e )
-        {
-            monitor.reportError( e );
-        }
-    }
-
-
     void importLdif( LdifEnumeration enumeration, Writer logWriter, boolean continueOnError,
         StudioProgressMonitor monitor )
     {

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/DummyConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/DummyConnection.java?rev=585059&r1=585058&r2=585059&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/DummyConnection.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/DummyConnection.java
Mon Oct 15 23:47:17 2007
@@ -54,11 +54,6 @@
     }
 
 
-    public void delete( IEntry entryToDelete, StudioProgressMonitor monitor )
-    {
-    }
-
-
     public boolean existsEntry( DN dn, StudioProgressMonitor monitor )
     {
         return false;

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java?rev=585059&r1=585058&r2=585059&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
Mon Oct 15 23:47:17 2007
@@ -28,6 +28,11 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.ldap.Control;
+import javax.naming.ldap.ManageReferralControl;
+
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
@@ -41,6 +46,7 @@
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
 import org.apache.directory.studio.ldapbrowser.core.model.SearchParameter;
 
 
@@ -203,12 +209,17 @@
                     }
                 }
 
-                entry.getBrowserConnection().delete( entry, monitor );
+                int errorStatusSize1 = monitor.getErrorStatus( "" ).getChildren().length;
//$NON-NLS-1$
+                deleteEntry( entry.getBrowserConnection(), entry, monitor );
+                int errorStatusSize2 = monitor.getErrorStatus( "" ).getChildren().length;
//$NON-NLS-1$
 
-                numberOfDeletedEntries++;
-                monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.model__deleted_n_entries,
-                    new String[]
-                        { "" + numberOfDeletedEntries } ) ); //$NON-NLS-1$
+                if ( errorStatusSize1 == errorStatusSize2 )
+                {
+                    numberOfDeletedEntries++;
+                    monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.model__deleted_n_entries,
+                        new String[]
+                            { "" + numberOfDeletedEntries } ) ); //$NON-NLS-1$
+                }
             }
 
         }
@@ -247,4 +258,20 @@
             : BrowserCoreMessages.jobs__delete_entries_error_n;
     }
 
+    static void deleteEntry( IBrowserConnection browserConnection, IEntry entry, StudioProgressMonitor
monitor )
+    {
+        // dn
+        String dn = entry.getDn().toString();
+
+        // controls
+        Control[] controls = null;
+        if ( entry.isReferral() )
+        {
+            controls = new Control[]
+                { new ManageReferralControl() };
+        }
+
+        browserConnection.getConnection().getJNDIConnectionWrapper()
+            .deleteEntry( dn, controls, monitor );
+    }
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBrowserConnection.java?rev=585059&r1=585058&r2=585059&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBrowserConnection.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBrowserConnection.java
Mon Oct 15 23:47:17 2007
@@ -154,9 +154,6 @@
     public abstract void search( ISearch searchRequest, StudioProgressMonitor monitor );
 
 
-    public abstract void delete( IEntry entryToDelete, StudioProgressMonitor monitor );
-
-
     public abstract void importLdif( LdifEnumeration enumeration, Writer logWriter, boolean
continueOnError,
         StudioProgressMonitor monitor );
 



Mime
View raw message