directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1202789 - /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java
Date Wed, 16 Nov 2011 17:19:18 GMT
Author: pamarcelot
Date: Wed Nov 16 17:19:18 2011
New Revision: 1202789

URL: http://svn.apache.org/viewvc?rev=1202789&view=rev
Log:
Bound remaining UI widgets to listeners for the Kerberos configuration page.

Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java?rev=1202789&r1=1202788&r2=1202789&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java
Wed Nov 16 17:19:18 2011
@@ -65,7 +65,6 @@ public class KerberosServerPage extends 
     private Text primaryKdcRealmText;
     private Text kdcSearchBaseDnText;
     private Text encryptionTypesText;
-    private Button allowClockSkewCheckbox;
     private Button verifyBodyChecksumCheckbox;
     private Button allowEmptyAddressesCheckbox;
     private Button allowForwardableAddressesCheckbox;
@@ -74,6 +73,7 @@ public class KerberosServerPage extends 
     private Button allowRenewableTicketsCheckbox;
     private Text maximumRenewableLifetimeText;
     private Text maximumTicketLifetimeText;
+    private Text allowableClockSkewText;
 
     // UI Controls Listeners
     private SelectionAdapter enableKerberosCheckboxListener = new SelectionAdapter()
@@ -81,6 +81,7 @@ public class KerberosServerPage extends 
         public void widgetSelected( SelectionEvent e )
         {
             getKdcServerBean().setEnabled( enableKerberosCheckbox.getSelection() );
+            setEnabled( kerberosPortText, enableKerberosCheckbox.getSelection() );
         }
     };
     private ModifyListener kerberosPortTextListener = new ModifyListener()
@@ -95,6 +96,7 @@ public class KerberosServerPage extends 
         public void widgetSelected( SelectionEvent e )
         {
             getChangePasswordServerBean().setEnabled( enableChangePasswordCheckbox.getSelection()
);
+            setEnabled( changePasswordPortText, enableChangePasswordCheckbox.getSelection()
);
         }
     };
     private ModifyListener changePasswordPortTextListener = new ModifyListener()
@@ -132,11 +134,18 @@ public class KerberosServerPage extends 
             }
             catch ( LdapInvalidDnException e1 )
             {
-                // TODO Auto-generated catch block
-                e1.printStackTrace();
+                // Stay silent
             }
         }
     };
+    private ModifyListener encryptionTypesTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getKdcServerBean().getKrbEncryptionTypes().clear();
+            getKdcServerBean().addKrbEncryptionTypes( encryptionTypesText.getText() );
+        }
+    };
     private SelectionAdapter verifyBodyChecksumCheckboxListener = new SelectionAdapter()
     {
         public void widgetSelected( SelectionEvent e )
@@ -184,16 +193,22 @@ public class KerberosServerPage extends 
     {
         public void modifyText( ModifyEvent e )
         {
-            getKdcServerBean().setKrbMaximumRenewableLifetime(
-                Integer.parseInt( maximumRenewableLifetimeText.getText() ) );
+            getKdcServerBean()
+                .setKrbMaximumRenewableLifetime( Long.parseLong( maximumRenewableLifetimeText.getText()
) );
         }
     };
     private ModifyListener maximumTicketLifetimeTextListener = new ModifyListener()
     {
         public void modifyText( ModifyEvent e )
         {
-            getKdcServerBean()
-                .setKrbMaximumTicketLifetime( Integer.parseInt( maximumTicketLifetimeText.getText()
) );
+            getKdcServerBean().setKrbMaximumTicketLifetime( Long.parseLong( maximumTicketLifetimeText.getText()
) );
+        }
+    };
+    private ModifyListener allowableClockSkewTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getKdcServerBean().setKrbAllowableClockSkew( Long.parseLong( allowableClockSkewText.getText()
) );
         }
     };
 
@@ -219,28 +234,39 @@ public class KerberosServerPage extends 
         twl.numColumns = 2;
         parent.setLayout( twl );
 
+        // Left Composite
         Composite leftComposite = toolkit.createComposite( parent );
         leftComposite.setLayout( new GridLayout() );
         TableWrapData leftCompositeTableWrapData = new TableWrapData( TableWrapData.FILL,
TableWrapData.TOP );
         leftCompositeTableWrapData.grabHorizontal = true;
         leftComposite.setLayoutData( leftCompositeTableWrapData );
 
+        // Right Composite
         Composite rightComposite = toolkit.createComposite( parent );
         rightComposite.setLayout( new GridLayout() );
         TableWrapData rightCompositeTableWrapData = new TableWrapData( TableWrapData.FILL,
TableWrapData.TOP );
         rightCompositeTableWrapData.grabHorizontal = true;
         rightComposite.setLayoutData( rightCompositeTableWrapData );
 
+        // Creating the sections
         createKerberosServerSection( toolkit, leftComposite );
         createKerberosSettingsSection( toolkit, leftComposite );
         createTicketSettingsSection( toolkit, rightComposite );
 
+        // Refreshing the UI
         refreshUI();
     }
 
 
+    /**
+     * Creates the Kerberos Server section.
+     *
+     * @param toolkit the toolkit to use
+     * @param parent the parent composite
+     */
     private void createKerberosServerSection( FormToolkit toolkit, Composite parent )
     {
+        // Creation of the section
         Section section = toolkit.createSection( parent, Section.TITLE_BAR );
         section.setText( "Kerberos Server" );
         section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
@@ -251,18 +277,24 @@ public class KerberosServerPage extends 
         composite.setLayout( gridLayout );
         section.setClient( composite );
 
+        // Enable Kerberos Server Checkbox
         enableKerberosCheckbox = toolkit.createButton( composite, "Enable Kerberos Server",
SWT.CHECK );
         enableKerberosCheckbox
             .setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, gridLayout.numColumns,
1 ) );
+
+        // Kerberos Server Port Text
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, "Port:" );
         kerberosPortText = createPortText( toolkit, composite );
         createDefaultValueLabel( toolkit, composite, "60088" );
 
+        // Enable Change Password Server Checkbox
         enableChangePasswordCheckbox = toolkit.createButton( composite, "Enable Kerberos
Change Password Server",
             SWT.CHECK );
         enableChangePasswordCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false,
             gridLayout.numColumns, 1 ) );
+
+        // Change Password Server Port Text
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, "Port:" );
         changePasswordPortText = createPortText( toolkit, composite );
@@ -271,12 +303,10 @@ public class KerberosServerPage extends 
 
 
     /**
-     * Creates the Kerberos Settings Section
+     * Creates the Kerberos Settings section
      *
-     * @param toolkit
-     *      the toolkit to use
-     * @param parent
-     *      the parent composite
+     * @param toolkit the toolkit to use
+     * @param parent the parent composite
      */
     private void createKerberosSettingsSection( FormToolkit toolkit, Composite parent )
     {
@@ -290,14 +320,14 @@ public class KerberosServerPage extends 
         composite.setLayout( glayout );
         section.setClient( composite );
 
-        // KDC Principal
+        // KDC Principal Text
         toolkit.createLabel( composite, "KDC Principal:" );
         kdcPrincipalText = toolkit.createText( composite, "" );
         setGridDataWithDefaultWidth( kdcPrincipalText, new GridData( SWT.FILL, SWT.NONE,
true, false ) );
         Label defaultSaslHostLabel = createDefaultValueLabel( toolkit, composite, "krbtgt/EXAMPLE.COM@EXAMPLE.COM"
);
         defaultSaslHostLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false,
2, 1 ) );
 
-        // SASL Principal
+        // SASL Principal Text
         toolkit.createLabel( composite, "Primary KDC Realm:" );
         primaryKdcRealmText = toolkit.createText( composite, "" ); //$NON-NLS-1$
         setGridDataWithDefaultWidth( primaryKdcRealmText, new GridData( SWT.FILL, SWT.NONE,
true, false ) );
@@ -305,14 +335,14 @@ public class KerberosServerPage extends 
             "EXAMPLE.COM" );
         defaultSaslPrincipalLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false, 2, 1 ) );
 
-        // Search Base Dn
+        // Search Base Dn Text
         toolkit.createLabel( composite, "Search Base Dn:" );
         kdcSearchBaseDnText = toolkit.createText( composite, "" ); //$NON-NLS-1$
         setGridDataWithDefaultWidth( kdcSearchBaseDnText, new GridData( SWT.FILL, SWT.NONE,
true, false ) );
         Label defaultSaslSearchBaseDnLabel = createDefaultValueLabel( toolkit, composite,
"ou=users,dc=example,dc=com" );
         defaultSaslSearchBaseDnLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false, 2, 1 ) );
 
-        // Encryption Types
+        // Encryption Types Text
         toolkit.createLabel( composite, "Encryption Types:" );
         encryptionTypesText = toolkit.createText( composite, "" ); //$NON-NLS-1$
         setGridDataWithDefaultWidth( encryptionTypesText, new GridData( SWT.FILL, SWT.NONE,
true, false ) );
@@ -322,12 +352,10 @@ public class KerberosServerPage extends 
 
 
     /**
-     * Creates the Tickets Settings Section
+     * Creates the Tickets Settings section
      *
-     * @param toolkit
-     *      the toolkit to use
-     * @param parent
-     *      the parent composite
+     * @param toolkit the toolkit to use
+     * @param parent the parent composite
      */
     private void createTicketSettingsSection( FormToolkit toolkit, Composite parent )
     {
@@ -337,47 +365,57 @@ public class KerberosServerPage extends 
         section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
         Composite composite = toolkit.createComposite( section );
         toolkit.paintBordersFor( composite );
-        GridLayout layout = new GridLayout( 3, false );
+        GridLayout layout = new GridLayout( 2, false );
         composite.setLayout( layout );
         section.setClient( composite );
 
-        allowClockSkewCheckbox = toolkit.createButton( composite, "Allow Clock Skew", SWT.CHECK
);
-        allowClockSkewCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false,
layout.numColumns, 1 ) );
+        // Verify Body Checksum Checkbox
         verifyBodyChecksumCheckbox = toolkit.createButton( composite, "Verify Body Checksum",
SWT.CHECK );
         verifyBodyChecksumCheckbox
             .setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, layout.numColumns,
1 ) );
 
+        // Allow Empty Addresse Checkbox
         allowEmptyAddressesCheckbox = toolkit.createButton( composite, "Allow Empty Addresses",
SWT.CHECK );
         allowEmptyAddressesCheckbox
             .setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, layout.numColumns,
1 ) );
 
+        // Allow Forwardable Addresses Checkbox
         allowForwardableAddressesCheckbox = toolkit.createButton( composite, "Allow Forwardable
Addresses",
             SWT.CHECK );
         allowForwardableAddressesCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE,
true, false,
             layout.numColumns, 1 ) );
 
+        // Require Pre-Authentication By Encrypted Timestamp Checkbox
         requirePreAuthByEncryptedTimestampCheckbox = toolkit.createButton( composite,
             "Require Pre-Authentication\nBy Encrypted TimeStamp", SWT.CHECK );
         requirePreAuthByEncryptedTimestampCheckbox
             .setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, layout.numColumns,
1 ) );
 
+        // Allow Postdated Tickets Checkbox
         allowPostdatedTicketsCheckbox = toolkit.createButton( composite, "Allow Postdated
Tickets", SWT.CHECK );
         allowPostdatedTicketsCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false, layout.numColumns,
             1 ) );
 
+        // Allow Renewable Tickets Checkbox
         allowRenewableTicketsCheckbox = toolkit.createButton( composite, "Allow Renewable
Tickets", SWT.CHECK );
         allowRenewableTicketsCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false, layout.numColumns,
             1 ) );
 
-        toolkit.createLabel( composite, "Max. Renewable Lifetime:" );
+        // Max Renewable Lifetime Text
+        toolkit.createLabel( composite, "Max. Renewable Lifetime (ms):" );
         maximumRenewableLifetimeText = createIntegerText( toolkit, composite );
         setGridDataWithDefaultWidth( maximumRenewableLifetimeText, new GridData( SWT.FILL,
SWT.NONE, true, false ) );
-        toolkit.createLabel( composite, "ms" );
 
-        toolkit.createLabel( composite, "Max. Ticket Lifetime:" );
+        // Max Ticket Lifetime Text
+        toolkit.createLabel( composite, "Max. Ticket Lifetime (ms):" );
         maximumTicketLifetimeText = createIntegerText( toolkit, composite );
         setGridDataWithDefaultWidth( maximumTicketLifetimeText, new GridData( SWT.FILL, SWT.NONE,
true, false ) );
-        toolkit.createLabel( composite, "ms" );
+
+        // Allowable Clock Skew Text
+        toolkit.createLabel( composite, "Allowable Clock Skew (ms):" );
+        allowableClockSkewText = createIntegerText( toolkit, composite );
+        setGridDataWithDefaultWidth( allowableClockSkewText, new GridData( SWT.FILL, SWT.NONE,
true, false ) );
+
     }
 
 
@@ -388,19 +426,25 @@ public class KerberosServerPage extends 
     {
         removeListeners();
 
+        // Kerberos Server
         KdcServerBean kdcServerBean = getKdcServerBean();
-        ChangePasswordServerBean changePasswordServerBean = getChangePasswordServerBean();
-
         setSelection( enableKerberosCheckbox, kdcServerBean.isEnabled() );
+        setEnabled( kerberosPortText, enableKerberosCheckbox.getSelection() );
         setText( kerberosPortText, "" + getKdcServerTransportBean().getSystemPort() );
 
+        // Change Password Checkbox
+        ChangePasswordServerBean changePasswordServerBean = getChangePasswordServerBean();
         setSelection( enableChangePasswordCheckbox, changePasswordServerBean.isEnabled()
);
+        setEnabled( changePasswordPortText, enableChangePasswordCheckbox.getSelection() );
         setText( changePasswordPortText, "" + getChangePasswordServerTransportBean().getSystemPort()
);
 
+        // Kerberos Settings
         setText( kdcPrincipalText, kdcServerBean.getKrbKdcPrincipal().toString() );
+        setText( primaryKdcRealmText, kdcServerBean.getKrbPrimaryRealm() );
         setText( kdcSearchBaseDnText, kdcServerBean.getSearchBaseDn().toString() );
         setText( encryptionTypesText, kdcServerBean.getKrbEncryptionTypes().toString() );
 
+        // Ticket Settings
         setSelection( verifyBodyChecksumCheckbox, kdcServerBean.isKrbBodyChecksumVerified()
);
         setSelection( allowEmptyAddressesCheckbox, kdcServerBean.isKrbEmptyAddressesAllowed()
);
         setSelection( allowForwardableAddressesCheckbox, kdcServerBean.isKrbForwardableAllowed()
);
@@ -409,6 +453,7 @@ public class KerberosServerPage extends 
         setSelection( allowRenewableTicketsCheckbox, kdcServerBean.isKrbRenewableAllowed()
);
         setText( maximumRenewableLifetimeText, kdcServerBean.getKrbMaximumRenewableLifetime()
+ "" );
         setText( maximumTicketLifetimeText, kdcServerBean.getKrbMaximumTicketLifetime() +
"" );
+        setText( allowableClockSkewText, kdcServerBean.getKrbAllowableClockSkew() + "" );
 
         addListeners();
     }
@@ -419,19 +464,19 @@ public class KerberosServerPage extends 
      */
     private void addListeners()
     {
-        // Enable Kerberos Checkbox
+        // Enable Kerberos Server Checkbox
         addDirtyListener( enableKerberosCheckbox );
         addSelectionListener( enableKerberosCheckbox, enableKerberosCheckboxListener );
 
-        // Kerberos Port Text
+        // Kerberos Server Port Text
         addDirtyListener( kerberosPortText );
         addModifyListener( kerberosPortText, kerberosPortTextListener );
 
-        // Enable Change Password Checkbox
+        // Enable Change Password Server Checkbox
         addDirtyListener( enableChangePasswordCheckbox );
         addSelectionListener( enableChangePasswordCheckbox, enableChangePasswordCheckboxListener
);
 
-        // Change Password Port Text
+        // Change Password Server Port Text
         addDirtyListener( changePasswordPortText );
         addModifyListener( changePasswordPortText, changePasswordPortTextListener );
 
@@ -449,10 +494,7 @@ public class KerberosServerPage extends 
 
         // Encryption Types Text
         addDirtyListener( encryptionTypesText );
-        // TODO A Text Control is probably not the most appropriate one
-
-        addDirtyListener( allowClockSkewCheckbox );
-        // TODO A Checkbox Control is probably not the most appropriate one
+        addModifyListener( encryptionTypesText, encryptionTypesTextListener );
 
         // Verify Body Checksum Checkbox
         addDirtyListener( verifyBodyChecksumCheckbox );
@@ -486,6 +528,10 @@ public class KerberosServerPage extends 
         // Maximum Ticket Lifetime Text
         addDirtyListener( maximumTicketLifetimeText );
         addModifyListener( maximumTicketLifetimeText, maximumTicketLifetimeTextListener );
+
+        // Allowable Clock Skew Text
+        addDirtyListener( allowableClockSkewText );
+        addModifyListener( allowableClockSkewText, allowableClockSkewTextListener );
     }
 
 
@@ -494,19 +540,19 @@ public class KerberosServerPage extends 
      */
     private void removeListeners()
     {
-        // Enable Kerberos Checkbox
+        // Enable Kerberos Server Checkbox
         removeDirtyListener( enableKerberosCheckbox );
         removeSelectionListener( enableKerberosCheckbox, enableKerberosCheckboxListener );
 
-        // Kerberos Port Text
+        // Kerberos Server Port Text
         removeDirtyListener( kerberosPortText );
         removeModifyListener( kerberosPortText, kerberosPortTextListener );
 
-        // Enable Change Password Checkbox
+        // Enable Change Password Server Checkbox
         removeDirtyListener( enableChangePasswordCheckbox );
         removeSelectionListener( enableChangePasswordCheckbox, enableChangePasswordCheckboxListener
);
 
-        // Change Password Port Text
+        // Change Password Server Port Text
         removeDirtyListener( changePasswordPortText );
         removeModifyListener( changePasswordPortText, changePasswordPortTextListener );
 
@@ -524,10 +570,7 @@ public class KerberosServerPage extends 
 
         // Encryption Types Text
         removeDirtyListener( encryptionTypesText );
-        // TODO A Text Control is probably not the most appropriate one
-
-        removeDirtyListener( allowClockSkewCheckbox );
-        // TODO A Checkbox Control is probably not the most appropriate one
+        removeModifyListener( encryptionTypesText, encryptionTypesTextListener );
 
         // Verify Body Checksum Checkbox
         removeDirtyListener( verifyBodyChecksumCheckbox );
@@ -561,6 +604,10 @@ public class KerberosServerPage extends 
         // Maximum Ticket Lifetime Text
         removeDirtyListener( maximumTicketLifetimeText );
         removeModifyListener( maximumTicketLifetimeText, maximumTicketLifetimeTextListener
);
+
+        // Allowable Clock Skew Text
+        removeDirtyListener( allowableClockSkewText );
+        removeModifyListener( allowableClockSkewText, allowableClockSkewTextListener );
     }
 
 



Mime
View raw message