directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1051499 - /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
Date Tue, 21 Dec 2010 14:05:22 GMT
Author: pamarcelot
Date: Tue Dec 21 14:05:21 2010
New Revision: 1051499

URL: http://svn.apache.org/viewvc?rev=1051499&view=rev
Log:
When saving the server configuration, the computed ldif entries modifications are now sent
back to the server via the connection through LDAP.

Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.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=1051499&r1=1051498&r2=1051499&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
Tue Dec 21 14:05:21 2010
@@ -38,6 +38,9 @@ import org.apache.directory.studio.apach
 import org.apache.directory.studio.common.core.jobs.StudioJob;
 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.model.IBrowserConnection;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
@@ -183,6 +186,7 @@ public class ServerConfigurationEditor e
             }
             catch ( Exception e )
             {
+                // TODO
                 e.printStackTrace();
             }
         }
@@ -212,6 +216,9 @@ public class ServerConfigurationEditor e
      *      the connection server configuration input
      * @param monitor
      *      the monitor
+     * @return
+     *      <code>true</code> if the operation is successful,
+     *      <code>false</code> if not
      * @throws ConfigurationException 
      * @throws Exception
      */
@@ -240,6 +247,32 @@ public class ServerConfigurationEditor e
             { "*" } );
 
         System.out.println( modificationsList );
+
+        // Building the resulting LDIF
+        StringBuilder modificationsLdif = new StringBuilder();
+        for ( LdifEntry ldifEntry : modificationsList )
+        {
+            modificationsLdif.append( ldifEntry.toString() );
+        }
+
+        // Getting the browser connection associated with the 
+        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();
+
+        // Waiting for the runnable to finish
+        job.join();
+        
+        System.out.println( "swapping partition");
+
+        // Swapping the new configuration partition
+        input.setOriginalPartition( newconfigurationPartition );
     }
 
 



Mime
View raw message