directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1023747 - /directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
Date Mon, 18 Oct 2010 11:46:55 GMT
Author: pamarcelot
Date: Mon Oct 18 11:46:55 2010
New Revision: 1023747

URL: http://svn.apache.org/viewvc?rev=1023747&view=rev
Log:
Used the Network Provider setting to provide a either a JNDI or a Directory API Connection
Wrapper.

Modified:
    directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java

Modified: directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java?rev=1023747&r1=1023746&r2=1023747&view=diff
==============================================================================
--- directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
(original)
+++ directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
Mon Oct 18 11:46:55 2010
@@ -204,17 +204,57 @@ public class Connection implements Conne
 
 
     /**
-     * Gets the JNDI connection wrapper.
+     * Gets the connection wrapper.
      * 
-     * @return the JNDI connection wrapper
+     * @return the connection wrapper
      */
     public ConnectionWrapper getConnectionWrapper()
     {
-        if ( connectionWrapper == null )
+        switch ( connectionParameter.getNetworkProvider() )
+        {
+            case JNDI:
+                return getJndiConnectionWrapper();
+            case APACHE_DIRECTORY_LDAP_API:
+                return getDirectoryApiConnectionWrapper();
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Gets a JNDI connection wrapper.
+     *
+     * @return
+     *      a JNDI connection wrapper
+     */
+    private JNDIConnectionWrapper getJndiConnectionWrapper()
+    {
+        System.out.println( "getJndiConnectionWrapper" );
+        if ( ( connectionWrapper == null ) || !( connectionWrapper instanceof JNDIConnectionWrapper
) )
+        {
+            connectionWrapper = new JNDIConnectionWrapper( this );
+        }
+
+        return ( JNDIConnectionWrapper ) connectionWrapper;
+    }
+
+
+    /**
+     * Gets a Directory API connection wrapper.
+     *
+     * @return
+     *      a Directory API connection wrapper
+     */
+    private DirectoryApiConnectionWrapper getDirectoryApiConnectionWrapper()
+    {
+        System.out.println( "getDirectoryApiConnectionWrapper" );
+        if ( ( connectionWrapper == null ) || !( connectionWrapper instanceof DirectoryApiConnectionWrapper
) )
         {
             connectionWrapper = new DirectoryApiConnectionWrapper( this );
         }
-        return connectionWrapper;
+
+        return ( DirectoryApiConnectionWrapper ) connectionWrapper;
     }
 
 



Mime
View raw message