directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r658655 - in /directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration: editor/v152/ model/v152/
Date Wed, 21 May 2008 12:34:49 GMT
Author: pamarcelot
Date: Wed May 21 05:34:49 2008
New Revision: 658655

URL: http://svn.apache.org/viewvc?rev=658655&view=rev
Log:
Replaced the String values of the SASL QoP by an Enum.

Added:
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SaslQualityOfProtectionEnum.java
Modified:
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/AuthenticationPage.java
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/AuthenticationPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/AuthenticationPage.java?rev=658655&r1=658654&r2=658655&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/AuthenticationPage.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/AuthenticationPage.java
Wed May 21 05:34:49 2008
@@ -25,6 +25,7 @@
 
 import org.apache.directory.studio.apacheds.configuration.editor.SaveableFormPage;
 import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
+import org.apache.directory.studio.apacheds.configuration.model.v152.SaslQualityOfProtectionEnum;
 import org.apache.directory.studio.apacheds.configuration.model.v152.ServerConfigurationV152;
 import org.apache.directory.studio.apacheds.configuration.model.v152.SupportedMechanismEnum;
 import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -71,6 +72,8 @@
     private Button selectAllSupportedMechanismsButton;
     private Button deselectAllSupportedMechanismsButton;
 
+    private CheckboxTableViewer saslQualityOfProtectionTableViewer;
+
 
     /**
      * Creates a new instance of AuthenticationPage.
@@ -257,11 +260,11 @@
         GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 3 );
         gd.heightHint = 76;
         saslQualityOfProtectionTable.setLayoutData( gd );
-        TableViewer saslQualityOfProtectionTableViewer = new CheckboxTableViewer( saslQualityOfProtectionTable
);
+        saslQualityOfProtectionTableViewer = new CheckboxTableViewer( saslQualityOfProtectionTable
);
         saslQualityOfProtectionTableViewer.setContentProvider( new ArrayContentProvider()
);
-        saslQualityOfProtectionTableViewer.setInput( new String[]
-            { "auth (Authentication only)", "auth-int (Authentication with integrity protection)",
-                "auth-conf (Authentication with integrity and privacy protection)" } );
+        saslQualityOfProtectionTableViewer.setInput( new SaslQualityOfProtectionEnum[]
+            { SaslQualityOfProtectionEnum.AUTH, SaslQualityOfProtectionEnum.AUTH_INT,
+                SaslQualityOfProtectionEnum.AUTH_CONF } );
 
         // Select All Button
         Button selectAllQualityOfProtectionButton = toolkit.createButton( client, "Select
All", SWT.PUSH );
@@ -284,6 +287,9 @@
         // Supported Authentication Mechanisms
         supportedMechanismsTableViewer.setCheckedElements( configuration.getSupportedMechanisms().toArray()
);
 
+        // SASL Quality Of Protection
+        saslQualityOfProtectionTableViewer.setCheckedElements( configuration.getSaslQops().toArray()
);
+
     }
 
 

Added: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SaslQualityOfProtectionEnum.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SaslQualityOfProtectionEnum.java?rev=658655&view=auto
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SaslQualityOfProtectionEnum.java
(added)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SaslQualityOfProtectionEnum.java
Wed May 21 05:34:49 2008
@@ -0,0 +1,84 @@
+/*
+ *  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.apacheds.configuration.model.v152;
+
+
+/**
+ * This enum contains all the SASL qualities of protection.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public enum SaslQualityOfProtectionEnum
+{
+    /** The auth QoP */
+    AUTH("auth (Authentication only)"),
+
+    /** The auth-int QoP */
+    AUTH_INT("auth-int (Authentication with integrity protection)"),
+
+    /** The auth-conf QoP */
+    AUTH_CONF("auth-conf (Authentication with integrity and privacy protection)");
+
+    /** The name */
+    private String name;
+
+
+    /**
+     * Creates a new instance of SaslQualityOfProtectionEnum.
+     *
+     * @param name
+     *      the name
+     */
+    private SaslQualityOfProtectionEnum( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Gets the name.
+     *
+     * @return
+     *      the name
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Sets the name.
+     *
+     * @param name
+     *      the name
+     */
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+
+    public String toString()
+    {
+        return name;
+    }
+}

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java?rev=658655&r1=658654&r2=658655&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java
Wed May 21 05:34:49 2008
@@ -67,7 +67,7 @@
     private String saslPrincipal;
 
     /** The SASL QOP */
-    private List<String> saslQops;
+    private List<SaslQualityOfProtectionEnum> saslQops;
 
     /** The SASL Realms */
     private List<String> saslRealms;
@@ -138,7 +138,7 @@
         super( ServerConfigurationVersionEnum.VERSION_1_5_2 );
 
         supportedMechanisms = new ArrayList<SupportedMechanismEnum>();
-        saslQops = new ArrayList<String>();
+        saslQops = new ArrayList<SaslQualityOfProtectionEnum>();
         saslRealms = new ArrayList<String>();
         partitions = new ArrayList<Partition>();
         interceptors = new ArrayList<InterceptorEnum>();
@@ -196,7 +196,7 @@
      * @return
      *      true (as per the general contract of the Collection.add method).
      */
-    public boolean addSaslQop( String saslQop )
+    public boolean addSaslQop( SaslQualityOfProtectionEnum saslQop )
     {
         return saslQops.add( saslQop );
     }
@@ -431,7 +431,7 @@
      * @return
      *      the SASL Quality Of Protection List
      */
-    public List<String> getSaslQops()
+    public List<SaslQualityOfProtectionEnum> getSaslQops()
     {
         return saslQops;
     }
@@ -934,7 +934,7 @@
      * @param saslQops
      *      the new value
      */
-    public void setSaslQops( List<String> saslQops )
+    public void setSaslQops( List<SaslQualityOfProtectionEnum> saslQops )
     {
         this.saslQops = saslQops;
     }

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java?rev=658655&r1=658654&r2=658655&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java
Wed May 21 05:34:49 2008
@@ -1221,7 +1221,6 @@
                             Element supportedMechanismValueElement = ( Element ) iterator.next();
 
                             String supportedMechanismValue = supportedMechanismValueElement.getText().trim();
-
                             if ( "SIMPLE".equalsIgnoreCase( supportedMechanismValue ) )
                             {
                                 serverConfiguration.addSupportedMechanism( SupportedMechanismEnum.SIMPLE
);
@@ -1253,8 +1252,19 @@
                             Element saslQopValueElement = ( Element ) iterator.next();
 
                             // Adding the SaslQop value
-                            serverConfiguration.addSaslQop( saslQopValueElement.getText().trim()
);
-
+                            String saslQopValue = saslQopValueElement.getText().trim();
+                            if ( "auth".equalsIgnoreCase( saslQopValue ) )
+                            {
+                                serverConfiguration.addSaslQop( SaslQualityOfProtectionEnum.AUTH
);
+                            }
+                            else if ( "auth-int".equalsIgnoreCase( saslQopValue ) )
+                            {
+                                serverConfiguration.addSaslQop( SaslQualityOfProtectionEnum.AUTH_INT
);
+                            }
+                            else if ( "auth-conf".equalsIgnoreCase( saslQopValue ) )
+                            {
+                                serverConfiguration.addSaslQop( SaslQualityOfProtectionEnum.AUTH_CONF
);
+                            }
                         }
                     }
 
@@ -2011,10 +2021,23 @@
         Element saslQopElement = ldapServerElement.addElement( ServerXmlIOV152.ELEMENT_SASL_QOP
);
 
         // Adding each SaslQop item
-        for ( String saslQop : serverConfiguration.getSaslQops() )
+        for ( SaslQualityOfProtectionEnum saslQop : serverConfiguration.getSaslQops() )
         {
-            saslQopElement.addElement( new QName( ServerXmlIOV152.ELEMENT_VALUE, NAMESPACE_SPRINGFRAMEWORK
) ).setText(
-                saslQop );
+            switch ( saslQop )
+            {
+                case AUTH:
+                    saslQopElement.addElement( new QName( ServerXmlIOV152.ELEMENT_VALUE,
NAMESPACE_SPRINGFRAMEWORK ) )
+                        .setText( "auth" );
+                    break;
+                case AUTH_INT:
+                    saslQopElement.addElement( new QName( ServerXmlIOV152.ELEMENT_VALUE,
NAMESPACE_SPRINGFRAMEWORK ) )
+                        .setText( "auth-int" );
+                    break;
+                case AUTH_CONF:
+                    saslQopElement.addElement( new QName( ServerXmlIOV152.ELEMENT_VALUE,
NAMESPACE_SPRINGFRAMEWORK ) )
+                        .setText( "auth-conf" );
+                    break;
+            }
         }
 
         // Adding 'SaslRealms' element



Mime
View raw message