directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1073878 - in /directory/studio/trunk/plugins: apacheds.configuration.v2/ connection.core/ connection.core/src/main/java/org/apache/directory/studio/connection/core/ ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/cor...
Date Wed, 23 Feb 2011 18:41:34 GMT
Author: pamarcelot
Date: Wed Feb 23 18:41:34 2011
New Revision: 1073878

URL: http://svn.apache.org/viewvc?rev=1073878&view=rev
Log:
o Added a set of classes to store detected information about the connection (like vendor name,
version and supported OIDs for controls, extended operations and features).
o Added an ActionFilterAdapter class to the Connection class to be able to activate/deactivate
actions based on properties of a connection.
o Added a condition for the "Open Configuration" action of the ApacheDS v2 Configuration Editor
to show only up in the context menu when a correct connection is select (vendorName="Apache
Software Foundation" and vendorVersion="1.5.8-SNAPSHOT").

Added:
    directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionActionFilterAdapter.java
    directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DetectedConnectionProperties.java
Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/plugin.xml
    directory/studio/trunk/plugins/connection.core/pom.xml
    directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
    directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/plugin.xml?rev=1073878&r1=1073877&r2=1073878&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/plugin.xml (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/plugin.xml Wed Feb 23 18:41:34
2011
@@ -52,12 +52,18 @@
                id="%OpenConfigurationAction_id"
                label="%OpenConfigurationAction_label">
          </action>
-         <!--<visibility>
+         <visibility>
+            <and>
                <objectState
-                     name="name"
-                     value="value">
-               </objectState>
-         </visibility>-->
+         	      name="vendorName"
+         	      value="Apache Software Foundation">
+         	   </objectState>
+               <objectState
+         	      name="vendorVersion"
+         	      value="1.5.8-SNAPSHOT">
+         	   </objectState>
+         	</and>
+         </visibility>
       </objectContribution>
    </extension>
    <extension
@@ -75,4 +81,5 @@
             name="%NewWizards_NewApacheDSConfigurationFileWizard_name"
             project="false"/>
    </extension>
+
 </plugin>

Modified: directory/studio/trunk/plugins/connection.core/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.core/pom.xml?rev=1073878&r1=1073877&r2=1073878&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.core/pom.xml (original)
+++ directory/studio/trunk/plugins/connection.core/pom.xml Wed Feb 23 18:41:34 2011
@@ -118,7 +118,8 @@
  org.apache.httpcomponents.httpclient;bundle-version="${org.apache.httpcomponents.version}",
  org.apache.mina.core;bundle-version="${org.apache.mina.core.version}",
  org.dom4j.dom4j;bundle-version="${org.dom4j.version}",
- org.eclipse.core.runtime</Require-Bundle>
+ org.eclipse.core.runtime,
+ org.eclipse.ui</Require-Bundle>
             <Export-Package>org.apache.directory.studio.connection.core.*</Export-Package>
             <Import-Package>!</Import-Package>
             <Private-Package>!</Private-Package>
@@ -207,6 +208,11 @@
     
 	<!-- Eclipse plugins dependencies -->
     <dependency>
+      <groupId>org.eclipse.ui</groupId>
+      <artifactId>workbench</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
       <groupId>org.eclipse</groupId>
       <artifactId>osgi</artifactId>
       <scope>provided</scope>

Modified: directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java?rev=1073878&r1=1073877&r2=1073878&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
(original)
+++ directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
Wed Feb 23 18:41:34 2011
@@ -21,15 +21,20 @@
 package org.apache.directory.studio.connection.core;
 
 
+import org.apache.directory.shared.ldap.model.constants.SaslQoP;
+import org.apache.directory.shared.ldap.model.constants.SaslSecurityStrength;
 import org.apache.directory.shared.ldap.model.filter.LdapURL;
 import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
 import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
+import org.apache.directory.studio.connection.core.ConnectionParameter.Krb5Configuration;
+import org.apache.directory.studio.connection.core.ConnectionParameter.Krb5CredentialConfiguration;
 import org.apache.directory.studio.connection.core.ConnectionParameter.NetworkProvider;
 import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
 import org.apache.directory.studio.connection.core.io.ConnectionWrapper;
 import org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper;
 import org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper;
 import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ui.IActionFilter;
 
 
 /**
@@ -167,11 +172,15 @@ public class Connection implements Conne
         }
     }
 
+    /** The connection parameter */
     private ConnectionParameter connectionParameter;
 
     /** The connection wrapper */
     private ConnectionWrapper connectionWrapper;
 
+    /** The detected connection properties */
+    private DetectedConnectionProperties detectedConnectionProperties;
+
 
     /**
      * Creates a new instance of Connection.
@@ -181,6 +190,7 @@ public class Connection implements Conne
     public Connection( ConnectionParameter connectionParameter )
     {
         this.connectionParameter = connectionParameter;
+        detectedConnectionProperties = new DetectedConnectionProperties( this );
     }
 
 
@@ -276,6 +286,28 @@ public class Connection implements Conne
 
 
     /**
+     * Gets the detected connection properties.
+     *
+     * @return the detected connection properties
+     */
+    public DetectedConnectionProperties getDetectedConnectionProperties()
+    {
+        return detectedConnectionProperties;
+    }
+
+
+    /**
+     * Sets the detected connection properties.
+     *
+     * @param detectedConnectionProperties  the detected connection properties
+     */
+    public void setDetectedConnectionProperties( DetectedConnectionProperties detectedConnectionProperties
)
+    {
+        this.detectedConnectionProperties = detectedConnectionProperties;
+    }
+
+
+    /**
      * Gets the auth method.
      * 
      * @return the auth method
@@ -386,6 +418,105 @@ public class Connection implements Conne
 
 
     /**
+     * Gets the SASL quality of protection.
+     * 
+     * @return the SASL quality of protection
+     */
+    public SaslQoP getSaslQop()
+    {
+        return connectionParameter.getSaslQop();
+    }
+
+
+    /**
+     * Gets the SASL security strength.
+     * 
+     * @return the SASL security strength
+     */
+    public SaslSecurityStrength getSaslSecurityStrength()
+    {
+        return connectionParameter.getSaslSecurityStrength();
+    }
+
+
+    /**
+     * Checks if is SASL mutual authentication.
+     * 
+     * @return true, if is SASL mutual authentication
+     */
+    public boolean isSaslMutualAuthentication()
+    {
+        return connectionParameter.isSaslMutualAuthentication();
+    }
+
+
+    /**
+     * Gets the Kerberos credential configuration.
+     * 
+     * @return the Kerberos credential configuration
+     */
+    public Krb5CredentialConfiguration getKrb5CredentialConfiguration()
+    {
+        return connectionParameter.getKrb5CredentialConfiguration();
+    }
+
+
+    /**
+     * Gets the Kerberos configuration.
+     * 
+     * @return the Kerberos configuration
+     */
+    public Krb5Configuration getKrb5Configuration()
+    {
+        return connectionParameter.getKrb5Configuration();
+    }
+
+
+    /**
+     * Gets the Kerberos configuration file.
+     * 
+     * @return the Kerberos configuration file
+     */
+    public String getKrb5ConfigurationFile()
+    {
+        return connectionParameter.getKrb5ConfigurationFile();
+    }
+
+
+    /**
+     * Gets the Kerberos realm.
+     * 
+     * @return the Kerberos realm
+     */
+    public String getKrb5Realm()
+    {
+        return connectionParameter.getKrb5Realm();
+    }
+
+
+    /**
+     * Gets the Kerberos KDC host.
+     * 
+     * @return the Kerberos KDC host
+     */
+    public String getKrb5KdcHost()
+    {
+        return connectionParameter.getKrb5KdcHost();
+    }
+
+
+    /**
+     * Gets the Kerberos KDC port.
+     * 
+     * @return the Kerberos KDCport
+     */
+    public int getKrb5KdcPort()
+    {
+        return connectionParameter.getKrb5KdcPort();
+    }
+
+
+    /**
      * Checks if this connection is read only.
      * 
      * @return true, if this connection is read only
@@ -518,6 +649,10 @@ public class Connection implements Conne
         {
             return this;
         }
+        else if ( adapter.isAssignableFrom( IActionFilter.class ) )
+        {
+            return ConnectionActionFilterAdapter.getInstance();
+        }
 
         return null;
     }

Added: directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionActionFilterAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionActionFilterAdapter.java?rev=1073878&view=auto
==============================================================================
--- directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionActionFilterAdapter.java
(added)
+++ directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionActionFilterAdapter.java
Wed Feb 23 18:41:34 2011
@@ -0,0 +1,230 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.core;
+
+
+import org.eclipse.ui.IActionFilter;
+
+
+/**
+ * This class implements an {@link IActionFilter} adapter for the {@link LdapServer} class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ConnectionActionFilterAdapter implements IActionFilter
+{
+    // Identifier and value strings
+    private static final String ID = "id";
+    private static final String NAME = "name";
+    private static final String HOST = "host";
+    private static final String PORT = "port";
+    private static final String ENCRYPTION_METHOD = "encryptionMethod";
+    private static final String NETWORK_PROVIDER = "networkProvider";
+    private static final String AUTH_METHOD = "authMethod";
+    private static final String BIND_PRINCIPAL = "bindPrincipal";
+    private static final String BIND_PASSWORD = "bindPassword";
+    private static final String SASL_REALM = "saslRealm";
+    private static final String SASL_QOP = "saslQop";
+    private static final String SASL_SECURITY_STRENGTH = "saslSecurityStrength";
+    private static final String SASL_MUTUAL_AUTHENTICATION = "saslMutualAuthentication";
+    private static final String KRB5_CREDENTIAL_CONFIGURATION = "krb5CredentialConfiguration";
+    private static final String KRB5_CONFIGURATION = "krb5Configuration";
+    private static final String KRB5_CONFIGURATION_FILE = "krb5ConfigurationFile";
+    private static final String KRB5_REALM = "krb5Realm";
+    private static final String KRB5_KDC_HOST = "krb5KdcHost";
+    private static final String KRB5_KDC_PORT = "krb5KdcPort";
+    private static final String VENDOR_NAME = "vendorName";
+    private static final String VENDOR_VERSION = "vendorVersion";
+    private static final String SERVER_TYPE = "serverType";
+    private static final String SUPPORTED_LDAP_VERSIONS = "supportedLdapVersions";
+    private static final String SUPPORTED_CONTROLS = "supportedControls";
+    private static final String SUPPORTED_EXTENSIONS = "supportedExtensions";
+    private static final String SUPPORTED_FEATURES = "supportedFeatures";
+
+    /** The class instance */
+    private static ConnectionActionFilterAdapter INSTANCE = new ConnectionActionFilterAdapter();
+
+
+    /**
+     * Private constructor.
+     */
+    private ConnectionActionFilterAdapter()
+    {
+        // Nothing to initialize
+    }
+
+
+    /**
+     * Returns an instance of {@link ConnectionActionFilterAdapter}.
+     *
+     * @return
+     *      an instance of {@link ConnectionActionFilterAdapter}
+     */
+    public static ConnectionActionFilterAdapter getInstance()
+    {
+        return INSTANCE;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean testAttribute( Object target, String name, String value )
+    {
+        if ( target instanceof Connection )
+        {
+            Connection connection = ( Connection ) target;
+
+            // ID
+            if ( ID.equals( name ) )
+            {
+                return value.equals( connection.getId() );
+            }
+            // NAME
+            else if ( NAME.equals( name ) )
+            {
+                return value.equals( connection.getName() );
+            }
+            // HOST
+            else if ( HOST.equals( name ) )
+            {
+                return value.equals( connection.getHost() );
+            }
+            // PORT
+            else if ( PORT.equals( name ) )
+            {
+                return value.equals( "" + connection.getPort() );
+            }
+            // ENCRYPTION METHOD
+            else if ( ENCRYPTION_METHOD.equals( name ) )
+            {
+                return value.equals( connection.getEncryptionMethod().toString() );
+            }
+            // NETWORK PROVIDER
+            else if ( NETWORK_PROVIDER.equals( name ) )
+            {
+                return value.equals( connection.getNetworkProvider().toString() );
+            }
+            // AUTH METHOD
+            else if ( AUTH_METHOD.equals( name ) )
+            {
+                return value.equals( connection.getAuthMethod().toString() );
+            }
+            // BIND PRINCIPAL
+            else if ( BIND_PRINCIPAL.equals( name ) )
+            {
+                return value.equals( connection.getBindPrincipal() );
+            }
+            // BIND PASSWORD
+            else if ( BIND_PASSWORD.equals( name ) )
+            {
+                return value.equals( connection.getBindPassword() );
+            }
+            // SASL REALM
+            else if ( SASL_REALM.equals( name ) )
+            {
+                return value.equals( connection.getSaslRealm() );
+            }
+            // SASL QOP
+            else if ( SASL_QOP.equals( name ) )
+            {
+                return value.equals( connection.getSaslQop().toString() );
+            }
+            // SASL SECURITY STRENGTH
+            else if ( SASL_SECURITY_STRENGTH.equals( name ) )
+            {
+                return value.equals( connection.getSaslSecurityStrength().toString() );
+            }
+            // SASL MUTUAL AUTHENTICATION
+            else if ( SASL_MUTUAL_AUTHENTICATION.equals( name ) )
+            {
+                return value.equals( connection.isSaslMutualAuthentication() ? "true" : "false"
);
+            }
+            // KRB5 CREDENTIAL CONFIGURATION
+            else if ( KRB5_CREDENTIAL_CONFIGURATION.equals( name ) )
+            {
+                return value.equals( connection.getKrb5CredentialConfiguration().toString()
);
+            }
+            // KRB5 CONFIGURATION
+            else if ( KRB5_CONFIGURATION.equals( name ) )
+            {
+                return value.equals( connection.getKrb5Configuration().toString() );
+            }
+            // KRB5 CONFIGURATION FILE
+            else if ( KRB5_CONFIGURATION_FILE.equals( name ) )
+            {
+                return value.equals( connection.getKrb5ConfigurationFile() );
+            }
+            // KRB5 REALM
+            else if ( KRB5_REALM.equals( name ) )
+            {
+                return value.equals( connection.getKrb5Realm() );
+            }
+            // KRB5 KDC HOST
+            else if ( KRB5_KDC_HOST.equals( name ) )
+            {
+                return value.equals( connection.getKrb5KdcHost() );
+            }
+            // KRB5 KDC PORT
+            else if ( KRB5_KDC_PORT.equals( name ) )
+            {
+                return value.equals( "" + connection.getKrb5KdcPort() );
+            }
+            // VENDOR NAME
+            else if ( VENDOR_NAME.equals( name ) )
+            {
+                return value.equals( "" + connection.getDetectedConnectionProperties().getVendorName()
);
+            }
+            // VENDOR VERSION
+            else if ( VENDOR_VERSION.equals( name ) )
+            {
+                return value.equals( "" + connection.getDetectedConnectionProperties().getVendorVersion()
);
+            }
+            // SERVER TYPE
+            else if ( SERVER_TYPE.equals( name ) )
+            {
+                return value.equals( "" + connection.getDetectedConnectionProperties().getServerType().toString()
);
+            }
+            // SUPPORTED LDAP VERSIONS
+            else if ( SUPPORTED_LDAP_VERSIONS.equals( name ) )
+            {
+                connection.getDetectedConnectionProperties().getSupportedLdapVersions().contains(
value );
+            }
+            // SUPPORTED CONTROLS
+            else if ( SUPPORTED_CONTROLS.equals( name ) )
+            {
+                connection.getDetectedConnectionProperties().getSupportedControls().contains(
value );
+            }
+            // SUPPORTED EXTENSIONS
+            else if ( SUPPORTED_EXTENSIONS.equals( name ) )
+            {
+                connection.getDetectedConnectionProperties().getSupportedExtensions().contains(
value );
+            }
+            // SUPPORTED FEATURES
+            else if ( SUPPORTED_FEATURES.equals( name ) )
+            {
+                connection.getDetectedConnectionProperties().getSupportedFeatures().contains(
value );
+            }
+        }
+
+        return false;
+    }
+}

Modified: directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java?rev=1073878&r1=1073877&r2=1073878&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
(original)
+++ directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
Wed Feb 23 18:41:34 2011
@@ -21,7 +21,10 @@
 package org.apache.directory.studio.connection.core;
 
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
@@ -459,9 +462,9 @@ public class ConnectionParameter
 
 
     /**
-     * Gets the SASL qualitiy of protection.
+     * Gets the SASL quality of protection.
      * 
-     * @return the SASL qualitiy of protection
+     * @return the SASL quality of protection
      */
     public SaslQoP getSaslQop()
     {
@@ -704,6 +707,52 @@ public class ConnectionParameter
 
 
     /**
+     * Sets the extended list string property.
+     * 
+     * @param key the key
+     * @param value the value
+     */
+    public void setExtendedListStringProperty( String key, List<String> value )
+    {
+        StringBuilder sb = new StringBuilder();
+        if ( ( value != null ) && ( !value.isEmpty() ) )
+        {
+            for ( String string : value )
+            {
+                sb.append( string );
+                sb.append( ';' );
+            }
+            sb.deleteCharAt( sb.length() - 1 );
+        }
+
+        extendedProperties.put( key, sb.toString() );
+    }
+
+
+    /**
+     * Gets the extended list string property.
+     * 
+     * @param key the key
+     * 
+     * @return the extended list string property or <code>null</code> if the
property doesn't exist
+     */
+    public List<String> getExtendedListStringProperty( String key )
+    {
+        String s = extendedProperties.get( key );
+        if ( s != null )
+        {
+            String[] array = s.split( ";" );
+            if ( ( array != null ) && ( array.length > 0 ) )
+            {
+                return new ArrayList<String>( Arrays.asList( array ) );
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
      * Sets the extended int property.
      * 
      * @param key the key

Added: directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DetectedConnectionProperties.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DetectedConnectionProperties.java?rev=1073878&view=auto
==============================================================================
--- directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DetectedConnectionProperties.java
(added)
+++ directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DetectedConnectionProperties.java
Wed Feb 23 18:41:34 2011
@@ -0,0 +1,184 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.core;
+
+
+import java.util.List;
+
+
+/**
+ * This class contains all the properties that were detected for a connection
+ * during the first connection.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DetectedConnectionProperties
+{
+    /** The key for the connection parameter "Vendor name" */
+    private static final String CONNECTION_PARAMETER_VENDOR_NAME = "detectedProperties.vendorName";
+
+    /** The key for the connection parameter "Vendor version" */
+    private static final String CONNECTION_PARAMETER_VENDOR_VERSION = "detectedProperties.vendorVersion";
+
+    /** The key for the connection parameter "Server type" */
+    private static final String CONNECTION_PARAMETER_SERVER_TYPE = "detectedProperties.serverType";
+
+    /** The key for the connection parameter "Supported LDAP versions" */
+    private static final String CONNECTION_PARAMETER_SUPPORTED_LDAP_VERSIONS = "detectedProperties.supportedLdapVersions";
+
+    /** The key for the connection parameter "Supported SASL mechanisms" */
+    private static final String CONNECTION_PARAMETER_SUPPORTED_SASL_MECHANISMS = "detectedProperties.supportedSaslMechanisms";
+
+    /** The key for the connection parameter "Supported controls" */
+    private static final String CONNECTION_PARAMETER_SUPPORTED_CONTROLS = "detectedProperties.supportedControls";
+
+    /** The key for the connection parameter "Supported extensions" */
+    private static final String CONNECTION_PARAMETER_SUPPORTED_EXTENSIONS = "detectedProperties.supportedExtensions";
+
+    /** The key for the connection parameter "Supported features" */
+    private static final String CONNECTION_PARAMETER_SUPPORTED_FEATURES = "detectedProperties.supportedFeatures";
+
+    /** The connection */
+    private Connection connection;
+
+
+    /**
+     * Creates a new instance of DetectedConnectionProperties.
+     *
+     * @param connection the associated connection
+     */
+    public DetectedConnectionProperties( Connection connection )
+    {
+        this.connection = connection;
+    }
+
+
+    public String getVendorName()
+    {
+        return connection.getConnectionParameter().getExtendedProperty( CONNECTION_PARAMETER_VENDOR_NAME
);
+    }
+
+
+    public void setVendorName( String vendorName )
+    {
+        connection.getConnectionParameter().setExtendedProperty( CONNECTION_PARAMETER_VENDOR_NAME,
vendorName );
+    }
+
+
+    public String getVendorVersion()
+    {
+        return connection.getConnectionParameter().getExtendedProperty( CONNECTION_PARAMETER_VENDOR_VERSION
);
+    }
+
+
+    public void setVendorVersion( String vendorVersion )
+    {
+        connection.getConnectionParameter().setExtendedProperty( CONNECTION_PARAMETER_VENDOR_VERSION,
vendorVersion );
+    }
+
+
+    public Object getServerType()
+    {
+        return connection.getConnectionParameter().getExtendedProperty( CONNECTION_PARAMETER_SERVER_TYPE
);
+    }
+
+
+    public void setServerType( Object serverType )
+    {
+        connection.getConnectionParameter().setExtendedProperty( CONNECTION_PARAMETER_SERVER_TYPE,
+            serverType.toString() );
+    }
+
+
+    public List<String> getSupportedLdapVersions()
+    {
+        return connection.getConnectionParameter().getExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_LDAP_VERSIONS );
+    }
+
+
+    public void setSupportedLdapVersions( List<String> supportedLdapVersions )
+    {
+        connection.getConnectionParameter().setExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_LDAP_VERSIONS,
+            supportedLdapVersions );
+    }
+
+
+    public List<String> getSupportedSaslMechanisms()
+    {
+        return connection.getConnectionParameter().getExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_SASL_MECHANISMS );
+    }
+
+
+    public void setSupportedSaslMechanisms( List<String> supportedSaslMechanisms )
+    {
+        connection.getConnectionParameter().setExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_SASL_MECHANISMS,
+            supportedSaslMechanisms );
+    }
+
+
+    public List<String> getSupportedControls()
+    {
+        return connection.getConnectionParameter().getExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_CONTROLS );
+    }
+
+
+    public void setSupportedControls( List<String> supportedControls )
+    {
+        connection.getConnectionParameter().setExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_CONTROLS,
+            supportedControls );
+    }
+
+
+    public List<String> getSupportedExtensions()
+    {
+        return connection.getConnectionParameter().getExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_EXTENSIONS );
+    }
+
+
+    public void setSupportedExtensions( List<String> supportedExtensions )
+    {
+        connection.getConnectionParameter().setExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_EXTENSIONS,
+            supportedExtensions );
+    }
+
+
+    public List<String> getSupportedFeatures()
+    {
+        return connection.getConnectionParameter().getExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_FEATURES );
+    }
+
+
+    public void setSupportedFeatures( List<String> supportedFeatures )
+    {
+        connection.getConnectionParameter().setExtendedListStringProperty(
+            CONNECTION_PARAMETER_SUPPORTED_FEATURES,
+            supportedFeatures );
+    }
+}

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java?rev=1073878&r1=1073877&r2=1073878&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeRootDSERunnable.java
Wed Feb 23 18:41:34 2011
@@ -22,6 +22,7 @@ package org.apache.directory.studio.ldap
 
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -33,6 +34,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.DetectedConnectionProperties;
 import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
 import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
@@ -295,6 +298,23 @@ public class InitializeRootDSERunnable i
         browserConnection.getRootDSE().setChildrenInitialized( true );
         browserConnection.getRootDSE().setHasChildrenHint( true );
         browserConnection.getRootDSE().setDirectoryEntry( true );
+
+        // Set detected connection properties
+        DetectedConnectionProperties detectedConnectionProperties = browserConnection.getConnection()
+            .getDetectedConnectionProperties();
+        detectedConnectionProperties.setVendorName( browserConnection.getRootDSE().getAttribute(
"vendorName" )
+            .getStringValue() );
+        detectedConnectionProperties.setVendorVersion( browserConnection.getRootDSE().getAttribute(
"vendorVersion" )
+            .getStringValue() );
+        detectedConnectionProperties.setSupportedControls( Arrays.asList( browserConnection.getRootDSE()
+            .getAttribute( "supportedControl" ).getStringValues() ) );
+        detectedConnectionProperties.setSupportedExtensions( Arrays.asList( browserConnection.getRootDSE()
+            .getAttribute( "supportedExtension" ).getStringValues() ) );
+        detectedConnectionProperties.setSupportedFeatures( Arrays.asList( browserConnection.getRootDSE()
+            .getAttribute( "supportedFeatures" ).getStringValues() ) );
+
+        ConnectionCorePlugin.getDefault().getConnectionManager()
+            .connectionUpdated( browserConnection.getConnection() );
     }
 
 



Mime
View raw message