directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1051969 - in /directory/studio/trunk/plugins: apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/
Date Wed, 22 Dec 2010 16:15:11 GMT
Author: pamarcelot
Date: Wed Dec 22 16:15:11 2010
New Revision: 1051969

URL: http://svn.apache.org/viewvc?rev=1051969&view=rev
Log:
Used the ExecuteLdifRunnable.executeLdif() method to update the configuration.

Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java?rev=1051969&r1=1051968&r2=1051969&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
Wed Dec 22 16:15:11 2010
@@ -36,10 +36,12 @@ import org.apache.directory.studio.apach
 import org.apache.directory.studio.apacheds.configuration.v2.jobs.LoadConfigurationRunnable;
 import org.apache.directory.studio.apacheds.configuration.v2.jobs.PartitionsDiffComputer;
 import org.apache.directory.studio.common.core.jobs.StudioJob;
+import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.common.core.jobs.StudioRunnableWithProgress;
 import org.apache.directory.studio.common.ui.CommonUIUtils;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
 import org.apache.directory.studio.ldapbrowser.core.jobs.ExecuteLdifRunnable;
+import org.apache.directory.studio.ldapbrowser.core.jobs.ImportLdifRunnable;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.ResourcesPlugin;
@@ -259,20 +261,25 @@ public class ServerConfigurationEditor e
         IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
             .getBrowserConnection( input.getConnection() );
 
-        // Creating and scheduling the job to update the configuration with the resulting
LDIF
-        ExecuteLdifRunnable executeLdifRunnable = new ExecuteLdifRunnable( browserConnection,
-            modificationsLdif.toString(), true,
-            true );
-        StudioJob<StudioRunnableWithProgress> job = new StudioJob<StudioRunnableWithProgress>(
executeLdifRunnable );
-        job.schedule();
+        // Creating a StudioProgressMonitor to run the LDIF with
+        StudioProgressMonitor studioProgressMonitor = new StudioProgressMonitor( monitor
);
 
-        // Waiting for the runnable to finish
-        job.join();
-        
-        System.out.println( "swapping partition");
+        // Updating the configuration with the resulting LDIF
+        ExecuteLdifRunnable.executeLdif( browserConnection, modificationsLdif.toString(),
true, true,
+            studioProgressMonitor );
 
-        // Swapping the new configuration partition
-        input.setOriginalPartition( newconfigurationPartition );
+        // Checking if there were errors during the execution of the LDIF
+        if ( studioProgressMonitor.errorsReported() )
+        {
+            
+        }
+        else
+        {
+            System.out.println( "swapping partition" );
+
+            // Swapping the new configuration partition
+            input.setOriginalPartition( newconfigurationPartition );
+        }
     }
 
 

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java?rev=1051969&r1=1051968&r2=1051969&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java
Wed Dec 22 16:15:11 2010
@@ -120,13 +120,20 @@ public class ExecuteLdifRunnable impleme
      */
     public void run( StudioProgressMonitor monitor )
     {
+        executeLdif( browserConnection, ldif, updateIfEntryExists, continueOnError, monitor
);
+    }
+
+
+    public static void executeLdif( IBrowserConnection browserConnection, String ldif, boolean
updateIfEntryExists,
+        boolean continueOnError, StudioProgressMonitor monitor )
+    {
         monitor.beginTask( BrowserCoreMessages.jobs__execute_ldif_task, 2 );
         monitor.reportProgress( " " ); //$NON-NLS-1$
         monitor.worked( 1 );
 
         try
         {
-            Reader ldifReader = new StringReader( this.ldif );
+            Reader ldifReader = new StringReader( ldif );
             LdifParser parser = new LdifParser();
             LdifEnumeration enumeration = parser.parse( ldifReader );
 



Mime
View raw message