directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1198829 - /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java
Date Mon, 07 Nov 2011 17:32:34 GMT
Author: pamarcelot
Date: Mon Nov  7 17:32:34 2011
New Revision: 1198829

URL: http://svn.apache.org/viewvc?rev=1198829&view=rev
Log:
Added code to open the connection prior to searching for entries.

Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java?rev=1198829&r1=1198828&r2=1198829&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java
Mon Nov  7 17:32:34 2011
@@ -48,6 +48,10 @@ import org.apache.directory.studio.apach
 import org.apache.directory.studio.apacheds.configuration.v2.editor.ServerConfigurationEditor;
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.common.core.jobs.StudioRunnableWithProgress;
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.IConnectionListener;
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
 import org.apache.directory.studio.connection.core.io.StudioNamingEnumeration;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
 import org.apache.directory.studio.ldapbrowser.core.jobs.SearchRunnable;
@@ -280,6 +284,9 @@ public class LoadConfigurationRunnable i
                 schemaManager );
             configurationPartition.initialize();
 
+            // Opening the connection
+            openConnection( input, monitor );
+
             // Creating the search parameter
             SearchParameter configSearchParameter = new SearchParameter();
             configSearchParameter.setSearchBase( new Dn( "ou=config" ) );
@@ -325,7 +332,6 @@ public class LoadConfigurationRunnable i
                 // Removing the first entry from the list
                 Entry entry = entries.remove( 0 );
 
-
                 // Adding the entry to the partition
                 configurationPartition.addEntry( entry );
 
@@ -366,4 +372,35 @@ public class LoadConfigurationRunnable i
 
         return null;
     }
+
+
+    /**
+     * Opens the connection.
+     *
+     * @param input the input
+     * @param monitor the monitor
+     */
+    private void openConnection( ConnectionServerConfigurationInput input, StudioProgressMonitor
monitor )
+    {
+        Connection connection = input.getConnection();
+
+        if ( connection != null && !connection.getConnectionWrapper().isConnected()
)
+        {
+            connection.getConnectionWrapper().connect( monitor );
+            if ( connection.getConnectionWrapper().isConnected() )
+            {
+                connection.getConnectionWrapper().bind( monitor );
+            }
+
+            if ( connection.getConnectionWrapper().isConnected() )
+            {
+                for ( IConnectionListener listener : ConnectionCorePlugin.getDefault()
+                    .getConnectionListeners() )
+                {
+                    listener.connectionOpened( connection, monitor );
+                }
+                ConnectionEventRegistry.fireConnectionOpened( connection, input );
+            }
+        }
+    }
 }



Mime
View raw message