directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r522512 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view: ./ dialogs/ wizards/
Date Mon, 26 Mar 2007 13:36:10 GMT
Author: pamarcelot
Date: Mon Mar 26 06:36:06 2007
New Revision: 522512

URL: http://svn.apache.org/viewvc?view=rev&rev=522512
Log:
Added a verification on the Aliases (cf. RFC 2252 & 4512) of an AT/OC.

Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/ViewUtils.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/ManageAliasesDialog.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/ViewUtils.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/ViewUtils.java?view=diff&rev=522512&r1=522511&r2=522512
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/ViewUtils.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/ViewUtils.java
Mon Mar 26 06:36:06 2007
@@ -65,4 +65,19 @@
 
         return sb.toString();
     }
+    
+    
+    /**
+     * Verifies that the given name is syntaxely correct according to the RFC 2252 
+     * (Lightweight Directory Access Protocol (v3): Attribute Syntax Definitions).
+     *
+     * @param name
+     *      the name to test
+     * @return
+     *      true if the name is correct, false if the name is not correct.
+     */
+    public static boolean verifyName( String name )
+    {
+        return name.matches( "[a-zA-Z]+[a-zA-Z0-9;-]*" );
+    }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/ManageAliasesDialog.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/ManageAliasesDialog.java?view=diff&rev=522512&r1=522511&r2=522512
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/ManageAliasesDialog.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/ManageAliasesDialog.java
Mon Mar 26 06:36:06 2007
@@ -26,6 +26,7 @@
 
 import org.apache.directory.ldapstudio.schemas.Messages;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
@@ -268,6 +269,12 @@
                 {
                     errorComposite.setVisible( true );
                     errorLabel.setText( "An element with same alias already exists." );
+                    newAliasAddButton.setEnabled( false );
+                }
+                else if ( !ViewUtils.verifyName( text ) )
+                {
+                    errorComposite.setVisible( true );
+                    errorLabel.setText( "Invalid Alias." );
                     newAliasAddButton.setEnabled( false );
                 }
             }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java?view=diff&rev=522512&r1=522511&r2=522512
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewAttributeTypeWizardPage.java
Mon Mar 26 06:36:06 2007
@@ -25,6 +25,7 @@
 import org.apache.directory.ldapstudio.schemas.Messages;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
 import org.apache.directory.ldapstudio.schemas.view.preferences.OidPreferencePage;
 import org.apache.directory.shared.asn1.primitives.OID;
 import org.eclipse.core.runtime.preferences.ConfigurationScope;
@@ -208,6 +209,12 @@
         {
             updateStatus( Messages
                 .getString( "CreateANewAttributeTypeWizardPage.An_element_of_the_same_OID_already_exists"
) ); //$NON-NLS-1$
+            return;
+        }
+
+        if ( !ViewUtils.verifyName( getNameField() ) )
+        {
+            updateStatus( "Name is not valid." );
             return;
         }
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java?view=diff&rev=522512&r1=522511&r2=522512
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/wizards/CreateANewObjectClassWizardPage.java
Mon Mar 26 06:36:06 2007
@@ -25,6 +25,7 @@
 import org.apache.directory.ldapstudio.schemas.Messages;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
 import org.apache.directory.ldapstudio.schemas.view.preferences.OidPreferencePage;
 import org.apache.directory.shared.asn1.primitives.OID;
 import org.eclipse.core.runtime.preferences.ConfigurationScope;
@@ -210,6 +211,12 @@
         {
             updateStatus( Messages
                 .getString( "CreateANewObjectClassWizardPage.An_element_of_the_same_OID_already_exists"
) ); //$NON-NLS-1$
+            return;
+        }
+
+        if ( !ViewUtils.verifyName( getNameField() ) )
+        {
+            updateStatus( "Name is not valid." );
             return;
         }
 



Mime
View raw message