directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1245610 - /directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
Date Fri, 17 Feb 2012 15:28:56 GMT
Author: pamarcelot
Date: Fri Feb 17 15:28:56 2012
New Revision: 1245610

URL: http://svn.apache.org/viewvc?rev=1245610&view=rev
Log:
Fix for DIRSTUDIO-772 (Entry UUID Editor can't display eDirectory GUID) and DIRSTUDIO-764
(Image Editor does not work correctly).

Improvements on the binary attribute detector.

Modified:
    directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java

Modified: directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java?rev=1245610&r1=1245609&r2=1245610&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
(original)
+++ directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
Fri Feb 17 15:28:56 2012
@@ -49,6 +49,7 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.exception.InvalidConnectionException;
 import org.apache.directory.shared.ldap.codec.api.BinaryAttributeDetector;
 import org.apache.directory.shared.ldap.codec.api.ConfigurableBinaryAttributeDetector;
+import org.apache.directory.shared.ldap.codec.api.DefaultConfigurableBinaryAttributeDetector;
 import org.apache.directory.shared.ldap.codec.protocol.mina.LdapProtocolCodecActivator;
 import org.apache.directory.shared.ldap.model.cursor.SearchCursor;
 import org.apache.directory.shared.ldap.model.entry.AttributeUtils;
@@ -120,6 +121,9 @@ public class DirectoryApiConnectionWrapp
     /** The LDAP Connection */
     private LdapNetworkConnection ldapConnection;
 
+    /** The binary attribute detector */
+    private DefaultConfigurableBinaryAttributeDetector binaryAttributeDetector;
+
     /** Indicates if the wrapper is connected */
     private boolean isConnected = false;
 
@@ -180,6 +184,8 @@ public class DirectoryApiConnectionWrapp
         ldapConnectionConfig = new LdapConnectionConfig();
         ldapConnectionConfig.setLdapHost( connection.getHost() );
         ldapConnectionConfig.setLdapPort( connection.getPort() );
+        binaryAttributeDetector = new DefaultConfigurableBinaryAttributeDetector();
+        ldapConnectionConfig.setBinaryAttributeDetector( binaryAttributeDetector );
         if ( ( connection.getEncryptionMethod() == EncryptionMethod.LDAPS )
             || ( connection.getEncryptionMethod() == EncryptionMethod.START_TLS ) )
         {
@@ -239,7 +245,6 @@ public class DirectoryApiConnectionWrapp
                         if ( ldapConnection != null )
                         {
                             ldapConnection.close();
-
                         }
                     }
                     catch ( Exception exception )
@@ -249,6 +254,7 @@ public class DirectoryApiConnectionWrapp
                     finally
                     {
                         ldapConnection = null;
+                        binaryAttributeDetector = null;
                     }
                 }
             }
@@ -286,6 +292,7 @@ public class DirectoryApiConnectionWrapp
                 // ignore
             }
             ldapConnection = null;
+            binaryAttributeDetector = null;
         }
         isConnected = false;
     }
@@ -487,21 +494,15 @@ public class DirectoryApiConnectionWrapp
      */
     public void setBinaryAttributes( Collection<String> binaryAttributes )
     {
-        if ( ldapConnection != null )
+        if ( binaryAttributeDetector != null )
         {
-            BinaryAttributeDetector bad = ldapConnection.getConfig().getBinaryAttributeDetector();
-            if ( bad instanceof ConfigurableBinaryAttributeDetector )
-            {
-                ConfigurableBinaryAttributeDetector configBad = ( ConfigurableBinaryAttributeDetector
) bad;
+            // Clear the initial list
+            binaryAttributeDetector.setBinaryAttributes( new String[0] );
 
-                // Clear the initial list
-                configBad.setBinaryAttributes( new String[0] );
-
-                // Add each binary attribute
-                for ( String binaryAttribute : binaryAttributes )
-                {
-                    configBad.addBinaryAttribute( binaryAttribute );
-                }
+            // Add each binary attribute
+            for ( String binaryAttribute : binaryAttributes )
+            {
+                binaryAttributeDetector.addBinaryAttribute( binaryAttribute );
             }
         }
     }



Mime
View raw message