You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2008/05/21 12:00:40 UTC
svn commit: r658613 - in
/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration:
editor/v152/ model/v152/
Author: pamarcelot
Date: Wed May 21 03:00:40 2008
New Revision: 658613
URL: http://svn.apache.org/viewvc?rev=658613&view=rev
Log:
Replaced the String values of the supported authentication mechanisms by an Enum.
Added:
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SupportedMechanismEnum.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=658613&r1=658612&r2=658613&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 03:00:40 2008
@@ -26,6 +26,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.ServerConfigurationV152;
+import org.apache.directory.studio.apacheds.configuration.model.v152.SupportedMechanismEnum;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
@@ -138,8 +139,9 @@
supportedMechanismsTable.setLayoutData( gd );
supportedMechanismsTableViewer = new CheckboxTableViewer( supportedMechanismsTable );
supportedMechanismsTableViewer.setContentProvider( new ArrayContentProvider() );
- supportedMechanismsTableViewer.setInput( new String[]
- { "SIMPLE", "CRAM-MD5 (SASL)", "DIGEST-MD5 (SASL)", "GSSAPI (SASL)" } );
+ supportedMechanismsTableViewer.setInput( new SupportedMechanismEnum[]
+ { SupportedMechanismEnum.SIMPLE, SupportedMechanismEnum.CRAM_MD5, SupportedMechanismEnum.DIGEST_MD5,
+ SupportedMechanismEnum.GSSAPI } );
// Select All Button
selectAllSupportedMechanismsButton = toolkit.createButton( client, "Select All", SWT.PUSH );
@@ -345,10 +347,10 @@
ServerConfigurationV152 configuration = ( ServerConfigurationV152 ) ( ( ServerConfigurationEditor ) getEditor() )
.getServerConfiguration();
- List<String> supportedMechanismsList = new ArrayList<String>();
+ List<SupportedMechanismEnum> supportedMechanismsList = new ArrayList<SupportedMechanismEnum>();
for ( Object supportedMechanism : supportedMechanismsTableViewer.getCheckedElements() )
{
- supportedMechanismsList.add( ( String ) supportedMechanism );
+ supportedMechanismsList.add( ( SupportedMechanismEnum ) supportedMechanism );
}
configuration.setSupportedMechanisms( supportedMechanismsList );
}
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=658613&r1=658612&r2=658613&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 03:00:40 2008
@@ -56,7 +56,7 @@
private int maxThreads;
/** The Supported Mechanisms */
- private List<String> supportedMechanisms;
+ private List<SupportedMechanismEnum> supportedMechanisms;
// SASL Properties
@@ -137,7 +137,7 @@
{
super( ServerConfigurationVersionEnum.VERSION_1_5_2 );
- supportedMechanisms = new ArrayList<String>();
+ supportedMechanisms = new ArrayList<SupportedMechanismEnum>();
saslQops = new ArrayList<String>();
saslRealms = new ArrayList<String>();
partitions = new ArrayList<Partition>();
@@ -224,7 +224,7 @@
* @return
* true (as per the general contract of the Collection.add method).
*/
- public boolean addSupportedMechanism( String supportedMechanism )
+ public boolean addSupportedMechanism( SupportedMechanismEnum supportedMechanism )
{
return supportedMechanisms.add( supportedMechanism );
}
@@ -467,7 +467,7 @@
* @return
* the Supported Mechanisms List
*/
- public List<String> getSupportedMechanisms()
+ public List<SupportedMechanismEnum> getSupportedMechanisms()
{
return supportedMechanisms;
}
@@ -970,7 +970,7 @@
* @param supportedMechanisms
* the new value
*/
- public void setSupportedMechanisms( List<String> supportedMechanisms )
+ public void setSupportedMechanisms( List<SupportedMechanismEnum> supportedMechanisms )
{
this.supportedMechanisms = supportedMechanisms;
}
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=658613&r1=658612&r2=658613&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 03:00:40 2008
@@ -1220,10 +1220,24 @@
// Getting the 'value' element
Element supportedMechanismValueElement = ( Element ) iterator.next();
- // Adding the supported mechanism value
- serverConfiguration.addSupportedMechanism( supportedMechanismValueElement.getText().trim()
- .toUpperCase() );
+ String supportedMechanismValue = supportedMechanismValueElement.getText().trim();
+ if ( "SIMPLE".equalsIgnoreCase( supportedMechanismValue ) )
+ {
+ serverConfiguration.addSupportedMechanism( SupportedMechanismEnum.SIMPLE );
+ }
+ else if ( "CRAM-MD5".equalsIgnoreCase( supportedMechanismValue ) )
+ {
+ serverConfiguration.addSupportedMechanism( SupportedMechanismEnum.CRAM_MD5 );
+ }
+ else if ( "DIGEST-MD5".equalsIgnoreCase( supportedMechanismValue ) )
+ {
+ serverConfiguration.addSupportedMechanism( SupportedMechanismEnum.DIGEST_MD5 );
+ }
+ else if ( "GSSAPI".equalsIgnoreCase( supportedMechanismValue ) )
+ {
+ serverConfiguration.addSupportedMechanism( SupportedMechanismEnum.GSSAPI );
+ }
}
}
@@ -1970,11 +1984,27 @@
.addElement( ServerXmlIOV152.ELEMENT_SUPPORTED_MECHANISMS );
// Adding each supported mechanism
- for ( String supportedMechanism : serverConfiguration.getSupportedMechanisms() )
+ for ( SupportedMechanismEnum supportedMechanism : serverConfiguration.getSupportedMechanisms() )
{
- supportedMechanismsElement
- .addElement( new QName( ServerXmlIOV152.ELEMENT_VALUE, NAMESPACE_SPRINGFRAMEWORK ) ).setText(
- supportedMechanism );
+ switch ( supportedMechanism )
+ {
+ case SIMPLE:
+ supportedMechanismsElement.addElement(
+ new QName( ServerXmlIOV152.ELEMENT_VALUE, NAMESPACE_SPRINGFRAMEWORK ) ).setText( "SIMPLE" );
+ break;
+ case CRAM_MD5:
+ supportedMechanismsElement.addElement(
+ new QName( ServerXmlIOV152.ELEMENT_VALUE, NAMESPACE_SPRINGFRAMEWORK ) ).setText( "CRAM-MD5" );
+ break;
+ case DIGEST_MD5:
+ supportedMechanismsElement.addElement(
+ new QName( ServerXmlIOV152.ELEMENT_VALUE, NAMESPACE_SPRINGFRAMEWORK ) ).setText( "DIGEST-MD5" );
+ break;
+ case GSSAPI:
+ supportedMechanismsElement.addElement(
+ new QName( ServerXmlIOV152.ELEMENT_VALUE, NAMESPACE_SPRINGFRAMEWORK ) ).setText( "GSSAPI" );
+ break;
+ }
}
// Adding 'SaslQop' element
Added: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SupportedMechanismEnum.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SupportedMechanismEnum.java?rev=658613&view=auto
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SupportedMechanismEnum.java (added)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/SupportedMechanismEnum.java Wed May 21 03:00:40 2008
@@ -0,0 +1,87 @@
+/*
+ * 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 supported mechanisms.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public enum SupportedMechanismEnum
+{
+ /** The Simple mechanism */
+ SIMPLE("SIMPLE"),
+
+ /** The CRAM-MD5 (SASL) mechanism */
+ CRAM_MD5("CRAM-MD5 (SASL)"),
+
+ /** The DIGEST-MD5 (SASL) mechanism */
+ DIGEST_MD5("DIGEST-MD5 (SASL)"),
+
+ /** The GSSAPI (SASL) mechanism */
+ GSSAPI("GSSAPI (SASL)"), ;
+
+ /** The name */
+ private String name;
+
+
+ /**
+ * Creates a new instance of SupportedMechanismEnum.
+ *
+ * @param name
+ * the name
+ */
+ private SupportedMechanismEnum( 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;
+ }
+}