Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 32821 invoked from network); 21 Nov 2006 16:55:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Nov 2006 16:55:49 -0000 Received: (qmail 9083 invoked by uid 500); 21 Nov 2006 16:55:58 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 9042 invoked by uid 500); 21 Nov 2006 16:55:58 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 9031 invoked by uid 99); 21 Nov 2006 16:55:58 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Nov 2006 08:55:58 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Nov 2006 08:55:47 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id D84F31A9846; Tue, 21 Nov 2006 08:55:13 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: pamarcelot@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061121165513.D84F31A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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( "" + ( ( "".equals( userDN.getNormName() ) ) ? "null" : userDN.getNormName() ) + "" ); - sb.append( "" + prefixUserDNWithBaseDN + "" ); + sb.append( "" + appendBaseDNtoUserDNWithBaseDN + "" ); sb.append( "" + ( ( "".equals( password ) ) ? "null" : password ) + "" ); sb.append( "" ); @@ -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(); super.transitions[USERDN_START] = new HashMap(); super.transitions[USERDN_END] = new HashMap(); - super.transitions[PREFIXUSERDNWITHBASEDN_START] = new HashMap(); - super.transitions[PREFIXUSERDNWITHBASEDN_END] = new HashMap(); + super.transitions[APPENDBASEDNTOUSERDN_START] = new HashMap(); + super.transitions[APPENDBASEDNTOUSERDN_END] = new HashMap(); super.transitions[PASSWORD_START] = new HashMap(); super.transitions[PASSWORD_END] = new HashMap(); @@ -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: - super.transitions[USERDN_END].put( new Tag( "prefixUserDNWithBaseDN", Tag.START ), new GrammarTransition( - USERDN_END, PREFIXUSERDNWITHBASEDN_START, addPrefixUserDNWithBaseDN ) ); - - // State: [PREFIXUSERDNWITHBASEDN_START] - Tag: - super.transitions[PREFIXUSERDNWITHBASEDN_START].put( new Tag( "prefixUserDNWithBaseDN", Tag.END ), - new GrammarTransition( PREFIXUSERDNWITHBASEDN_START, PREFIXUSERDNWITHBASEDN_END, null ) ); + // State: [USERDN_END] - Tag: + super.transitions[USERDN_END].put( new Tag( "appendBaseDNtoUserDNWithBaseDN", Tag.START ), new GrammarTransition( + USERDN_END, APPENDBASEDNTOUSERDN_START, appendBaseDNtoUserDNWithBaseDN ) ); + + // State: [PREFIXUSERDNWITHBASEDN_START] - Tag: + super.transitions[APPENDBASEDNTOUSERDN_START].put( new Tag( "appendBaseDNtoUserDNWithBaseDN", Tag.END ), + new GrammarTransition( APPENDBASEDNTOUSERDN_START, APPENDBASEDNTOUSERDN_END, null ) ); // State: [PREFIXUSERDNWITHBASEDN_END] - Tag: - 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: 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();