directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r477743 - in /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser: model/ view/views/ view/views/wrappers/
Date Tue, 21 Nov 2006 16:55:13 GMT
Author: pamarcelot
Date: Tue Nov 21 08:55:12 2006
New Revision: 477743

URL: http://svn.apache.org/viewvc?view=rev&rev=477743
Log:
Refactoring the 'prefixUserDN' feature by 'appendBaseDNToUserDN'. The Browser View now works
correctly with connections using 'appendBaseDNToUserDN'.

Modified:
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/Connection.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/ConnectionGrammar.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/Connection.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/Connection.java?view=diff&rev=477743&r1=477742&r2=477743
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/Connection.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/Connection.java
Tue Nov 21 08:55:12 2006
@@ -38,7 +38,7 @@
     private LdapDN baseDN;
     private boolean anonymousBind = true;
     private LdapDN userDN;
-    private boolean prefixUserDNWithBaseDN = false;
+    private boolean appendBaseDNtoUserDNWithBaseDN = false;
     private String password;
 
     /** The Listeners List */
@@ -62,11 +62,11 @@
      * @param baseDN the Base DN
      * @param anonymousBind the value of the Anonymous Bind flag
      * @param userDN the User DN
-     * @param prefixUserDNWithBaseDN the value of the prefixUserDNWithBaseDN flag
+     * @param appendBaseDNtoUserDNWithBaseDN the value of the appendBaseDNtoUserDNWithBaseDN
flag
      * @param password the Password
      */
     public Connection( String name, String host, int port, LdapDN baseDN, boolean anonymousBind,
LdapDN userDN,
-        boolean prefixUserDNWithBaseDN, String password )
+        boolean appendBaseDNtoUserDNWithBaseDN, String password )
     {
         this.name = name;
         this.host = host;
@@ -74,7 +74,7 @@
         this.baseDN = baseDN;
         this.anonymousBind = anonymousBind;
         this.userDN = userDN;
-        this.prefixUserDNWithBaseDN = prefixUserDNWithBaseDN;
+        this.appendBaseDNtoUserDNWithBaseDN = appendBaseDNtoUserDNWithBaseDN;
         this.password = password;
     }
 
@@ -220,22 +220,22 @@
 
 
     /**
-     * Get the prefixUserDNWithBaseDN Flag
-     * @return the prefixUserDNWithBaseDN Flag
+     * Get the appendBaseDNtoUserDNWithBaseDN Flag
+     * @return the appendBaseDNtoUserDNWithBaseDN Flag
      */
-    public boolean isPrefixUserDNWithBaseDN()
+    public boolean isAppendBaseDNtoUserDNWithBaseDN()
     {
-        return prefixUserDNWithBaseDN;
+        return appendBaseDNtoUserDNWithBaseDN;
     }
 
 
     /**
-     * Sets prefixUserDNWithBaseDN Flag
-     * @param prefixUserDNWithBaseDN the prefixUserDNWithBaseDN Flag
+     * Sets appendBaseDNtoUserDNWithBaseDN Flag
+     * @param appendBaseDNtoUserDNWithBaseDN the appendBaseDNtoUserDNWithBaseDN Flag
      */
-    public void setPrefixUserDNWithBaseDN( boolean prefixUserDNWithBaseDN )
+    public void setAppendBaseDNtoUserDNWithBaseDN( boolean appendBaseDNtoUserDNWithBaseDN
)
     {
-        this.prefixUserDNWithBaseDN = prefixUserDNWithBaseDN;
+        this.appendBaseDNtoUserDNWithBaseDN = appendBaseDNtoUserDNWithBaseDN;
     }
 
 
@@ -258,7 +258,7 @@
         sb
             .append( "<userDN>" + ( ( "".equals( userDN.getNormName() ) ) ? "null"
: userDN.getNormName() )
                 + "</userDN>" );
-        sb.append( "<prefixUserDNWithBaseDN>" + prefixUserDNWithBaseDN + "</prefixUserDNWithBaseDN>"
);
+        sb.append( "<appendBaseDNtoUserDNWithBaseDN>" + appendBaseDNtoUserDNWithBaseDN
+ "</appendBaseDNtoUserDNWithBaseDN>" );
         sb.append( "<password>" + ( ( "".equals( password ) ) ? "null" : password )
+ "</password>" );
         sb.append( "</connection>" );
 
@@ -307,7 +307,7 @@
         sb.append( "\" | " );
         sb.append( "userDN=\"" + userDN.getNormName() );
         sb.append( "\" | " );
-        sb.append( "prefixUserDNWithBaseDN=\"" + prefixUserDNWithBaseDN );
+        sb.append( "appendBaseDNtoUserDNWithBaseDN=\"" + appendBaseDNtoUserDNWithBaseDN );
         sb.append( "\" | " );
         sb.append( "password=\"" + password );
         sb.append( "\"]" );

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/ConnectionGrammar.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/ConnectionGrammar.java?view=diff&rev=477743&r1=477742&r2=477743
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/ConnectionGrammar.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/model/ConnectionGrammar.java
Tue Nov 21 08:55:12 2006
@@ -75,9 +75,9 @@
     public static int USERDN_START = 14;
     public static int USERDN_END = 15;
 
-    // States for prefixUserDNWithBaseDN tag
-    public static int PREFIXUSERDNWITHBASEDN_START = 18;
-    public static int PREFIXUSERDNWITHBASEDN_END = 19;
+    // States for appendBaseDNtoUserDNWithBaseDN tag
+    public static int APPENDBASEDNTOUSERDN_START = 18;
+    public static int APPENDBASEDNTOUSERDN_END = 19;
 
     // States for Password tag
     public static int PASSWORD_START = 16;
@@ -110,8 +110,8 @@
         super.transitions[ANONYMOUSBIND_END] = new HashMap<Tag, GrammarTransition>();
         super.transitions[USERDN_START] = new HashMap<Tag, GrammarTransition>();
         super.transitions[USERDN_END] = new HashMap<Tag, GrammarTransition>();
-        super.transitions[PREFIXUSERDNWITHBASEDN_START] = new HashMap<Tag, GrammarTransition>();
-        super.transitions[PREFIXUSERDNWITHBASEDN_END] = new HashMap<Tag, GrammarTransition>();
+        super.transitions[APPENDBASEDNTOUSERDN_START] = new HashMap<Tag, GrammarTransition>();
+        super.transitions[APPENDBASEDNTOUSERDN_END] = new HashMap<Tag, GrammarTransition>();
         super.transitions[PASSWORD_START] = new HashMap<Tag, GrammarTransition>();
         super.transitions[PASSWORD_END] = new HashMap<Tag, GrammarTransition>();
 
@@ -171,17 +171,17 @@
         super.transitions[USERDN_START].put( new Tag( "userDN", Tag.END ), new GrammarTransition(
USERDN_START,
             USERDN_END, null ) );
 
-        // State: [USERDN_END] - Tag: <prefixUserDNWithBaseDN>
-        super.transitions[USERDN_END].put( new Tag( "prefixUserDNWithBaseDN", Tag.START ),
new GrammarTransition(
-            USERDN_END, PREFIXUSERDNWITHBASEDN_START, addPrefixUserDNWithBaseDN ) );
-
-        // State: [PREFIXUSERDNWITHBASEDN_START] - Tag: </prefixUserDNWithBaseDN>
-        super.transitions[PREFIXUSERDNWITHBASEDN_START].put( new Tag( "prefixUserDNWithBaseDN",
Tag.END ),
-            new GrammarTransition( PREFIXUSERDNWITHBASEDN_START, PREFIXUSERDNWITHBASEDN_END,
null ) );
+        // State: [USERDN_END] - Tag: <appendBaseDNtoUserDNWithBaseDN>
+        super.transitions[USERDN_END].put( new Tag( "appendBaseDNtoUserDNWithBaseDN", Tag.START
), new GrammarTransition(
+            USERDN_END, APPENDBASEDNTOUSERDN_START, appendBaseDNtoUserDNWithBaseDN ) );
+
+        // State: [PREFIXUSERDNWITHBASEDN_START] - Tag: </appendBaseDNtoUserDNWithBaseDN>
+        super.transitions[APPENDBASEDNTOUSERDN_START].put( new Tag( "appendBaseDNtoUserDNWithBaseDN",
Tag.END ),
+            new GrammarTransition( APPENDBASEDNTOUSERDN_START, APPENDBASEDNTOUSERDN_END,
null ) );
 
         // State: [PREFIXUSERDNWITHBASEDN_END] - Tag: <password>
-        super.transitions[PREFIXUSERDNWITHBASEDN_END].put( new Tag( "password", Tag.START
), new GrammarTransition(
-            PREFIXUSERDNWITHBASEDN_END, PASSWORD_START, addPassword ) );
+        super.transitions[APPENDBASEDNTOUSERDN_END].put( new Tag( "password", Tag.START ),
new GrammarTransition(
+            APPENDBASEDNTOUSERDN_END, PASSWORD_START, addPassword ) );
 
         // State: [PASSWORD_START] - Tag: </password>
         super.transitions[PASSWORD_START].put( new Tag( "password", Tag.END ), new GrammarTransition(
PASSWORD_START,
@@ -460,9 +460,9 @@
     };
 
     /**
-     * GrammarAction that adds a prefixUserDNWithBaseDN to a Connection
+     * GrammarAction that adds a appendBaseDNtoUserDNWithBaseDN to a Connection
      */
-    private final GrammarAction addPrefixUserDNWithBaseDN = new GrammarAction( "Add prefixUserDNWithBaseDN"
)
+    private final GrammarAction appendBaseDNtoUserDNWithBaseDN = new GrammarAction( "Add
appendBaseDNtoUserDNWithBaseDN" )
     {
         public void action( ConnectionParserContainer container ) throws XmlPullParserException
         {
@@ -488,11 +488,11 @@
             {
                 if ( xpp.getText().equals( "false" ) )
                 {
-                    connection.setPrefixUserDNWithBaseDN( false );
+                    connection.setAppendBaseDNtoUserDNWithBaseDN( false );
                 }
                 else if ( xpp.getText().equals( "true" ) )
                 {
-                    connection.setPrefixUserDNWithBaseDN( true );
+                    connection.setAppendBaseDNtoUserDNWithBaseDN( true );
                 }
                 else
                 {

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java?view=diff&rev=477743&r1=477742&r2=477743
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/ConnectionWizardInformationPage.java
Tue Nov 21 08:55:12 2006
@@ -50,7 +50,6 @@
  */
 public class ConnectionWizardInformationPage extends WizardPage
 {
-
     private Connection connection;
 
     private Group connectionGroup;
@@ -79,7 +78,7 @@
     private Label passwordLabel;
     private Text passwordText;
 
-    private Button prefixUserDN;
+    private Button appendBaseDNtoUserDNWithBaseDNButton;
 
 
     protected ConnectionWizardInformationPage()
@@ -159,10 +158,10 @@
         userDNText.setLayoutData( new GridData( GridData.FILL, SWT.NONE, true, false ) );
 
         // Prefix User DN with Base DN
-        Label prefixUserDNLabel = new Label( userGroup, SWT.NONE );
-        prefixUserDN = new Button( userGroup, SWT.CHECK );
-        prefixUserDN.setText( "Append Base DN to User DN" );
-        prefixUserDN.setLayoutData( new GridData( GridData.FILL, SWT.NONE, true, false )
);
+        Label appendBaseDNtoUserDNWithBaseDNLabel = new Label( userGroup, SWT.NONE );
+        appendBaseDNtoUserDNWithBaseDNButton = new Button( userGroup, SWT.CHECK );
+        appendBaseDNtoUserDNWithBaseDNButton.setText( "Append Base DN to User DN" );
+        appendBaseDNtoUserDNWithBaseDNButton.setLayoutData( new GridData( GridData.FILL,
SWT.NONE, true, false ) );
 
         // Password
         passwordLabel = new Label( userGroup, SWT.NONE );
@@ -404,6 +403,9 @@
 
         // User DN
         userDNText.setText( ( connection.getUserDN() == null ) ? "" : connection.getUserDN().getNormName()
);
+        
+        // Append Base DN to User DN
+        appendBaseDNtoUserDNWithBaseDNButton.setSelection( connection.isAppendBaseDNtoUserDNWithBaseDN()
);
 
         // Password
         passwordText.setText( ( connection.getPassword() == null ) ? "" : connection.getPassword()
);
@@ -418,7 +420,7 @@
         userGroup.setEnabled( true );
         userDNLabel.setEnabled( true );
         userDNText.setEnabled( true );
-        prefixUserDN.setEnabled( true );
+        appendBaseDNtoUserDNWithBaseDNButton.setEnabled( true );
         passwordLabel.setEnabled( true );
         passwordText.setEnabled( true );
     }
@@ -432,7 +434,7 @@
         userGroup.setEnabled( false );
         userDNLabel.setEnabled( false );
         userDNText.setEnabled( false );
-        prefixUserDN.setEnabled( false );
+        appendBaseDNtoUserDNWithBaseDNButton.setEnabled( false );
         passwordLabel.setEnabled( false );
         passwordText.setEnabled( false );
     }
@@ -454,7 +456,7 @@
             connection.setAnonymousBind( anonymousBind.getSelection() );
             connection.setUserDN( ( "".equals( userDNText.getText() ) ? LdapDN.EMPTY_LDAPDN
: new LdapDN( userDNText
                 .getText() ) ) );
-            connection.setPrefixUserDNWithBaseDN( prefixUserDN.getSelection() );
+            connection.setAppendBaseDNtoUserDNWithBaseDN( appendBaseDNtoUserDNWithBaseDNButton.getSelection()
);
             connection.setPassword( passwordText.getText() );
         }
         catch ( InvalidNameException e )

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java?view=diff&rev=477743&r1=477742&r2=477743
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
Tue Nov 21 08:55:12 2006
@@ -31,6 +31,7 @@
 import org.apache.directory.shared.ldap.codec.LdapResponse;
 import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.PlatformUI;
@@ -174,8 +175,17 @@
                 if ( engine == null )
                 {
                     // Initialization of the DSML Engine and the DSML Response Parser
-                    engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(),
connection
-                        .getUserDN().getNormName(), connection.getPassword() );
+                    if ( connection.isAppendBaseDNtoUserDNWithBaseDN() )
+                    {
+                        engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(),
new LdapDN( connection
+                            .getUserDN().getNormName() + "," + connection.getBaseDN().getNormName()
).getNormName(),
+                            connection.getPassword() );
+                    }
+                    else
+                    {
+                        engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(),
connection
+                            .getUserDN().getNormName(), connection.getPassword() );
+                    }
                 }
                 
                 Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();



Mime
View raw message