directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1643724 - in /directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor: LdapLdapsServersPage.java OverviewPage.java ServerConfigurationEditorPage.java
Date Sun, 07 Dec 2014 23:59:35 GMT
Author: elecharny
Date: Sun Dec  7 23:59:34 2014
New Revision: 1643724

URL: http://svn.apache.org/r1643724
Log:
o Fixed a wrong configuration listener
o Added some Javadoc
o Moved some constants to ServerConfigurationEditorPage

Modified:
    directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java
    directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
    directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java

Modified: directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java?rev=1643724&r1=1643723&r2=1643724&view=diff
==============================================================================
--- directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java
(original)
+++ directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java
Sun Dec  7 23:59:34 2014
@@ -144,8 +144,6 @@ import org.eclipse.ui.forms.widgets.Tabl
  */
 public class LdapLdapsServersPage extends ServerConfigurationEditorPage
 {
-    private static final int DEFAULT_PORT_LDAPS = 10636;
-    private static final int DEFAULT_PORT_LDAP = 10389;
     private static final int DEFAULT_NB_THREADS = 4;
     private static final int DEFAULT_BACKLOG_SIZE = 50;
     private static final String TRANSPORT_ID_LDAP = "ldap"; //$NON-NLS-1$
@@ -274,7 +272,7 @@ public class LdapLdapsServersPage extend
             {
                 int port = Integer.parseInt( ldapPortText.getText() );
                 
-                getLdapServerTransportBean().setTransportBackLog( port );
+                getLdapServerTransportBean().setSystemPort( port );
             }
             catch ( NumberFormatException nfe )
             {
@@ -1284,36 +1282,13 @@ public class LdapLdapsServersPage extend
                 {
                     LdapSecurityConstants hashingMethod = ( LdapSecurityConstants ) element;
 
-                    switch ( hashingMethod )
-                    {
-                        case HASH_METHOD_SHA:
-                            return "SHA"; //$NON-NLS-1$
-                        case HASH_METHOD_SSHA:
-                            return "SSHA"; //$NON-NLS-1$
-                        case HASH_METHOD_MD5:
-                            return "MD5"; //$NON-NLS-1$
-                        case HASH_METHOD_SMD5:
-                            return "SMD5"; //$NON-NLS-1$
-                        case HASH_METHOD_CRYPT:
-                            return "CRYPT"; //$NON-NLS-1$
-                        case HASH_METHOD_SHA256:
-                            return "SHA-256"; //$NON-NLS-1$
-                        case HASH_METHOD_SSHA256:
-                            return "SSHA-256"; //$NON-NLS-1$
-                        case HASH_METHOD_SHA384:
-                            return "SHA-384"; //$NON-NLS-1$
-                        case HASH_METHOD_SSHA384:
-                            return "SSHA-384"; //$NON-NLS-1$
-                        case HASH_METHOD_SHA512:
-                            return "SHA-512"; //$NON-NLS-1$
-                        case HASH_METHOD_SSHA512:
-                            return "SSHA-512"; //$NON-NLS-1$
-                    }
+                    return hashingMethod.getName();
                 }
 
                 return super.getText( element );
             }
         } );
+        
         Object[] hashingMethods = new Object[]
             {
                 LdapSecurityConstants.HASH_METHOD_SHA,
@@ -1326,8 +1301,10 @@ public class LdapLdapsServersPage extend
                 LdapSecurityConstants.HASH_METHOD_SHA384,
                 LdapSecurityConstants.HASH_METHOD_SSHA384,
                 LdapSecurityConstants.HASH_METHOD_SHA512,
-                LdapSecurityConstants.HASH_METHOD_SSHA512
+                LdapSecurityConstants.HASH_METHOD_SSHA512,
+                LdapSecurityConstants.HASH_METHOD_PKCS5S2
         };
+        
         hashingMethodComboViewer.setInput( hashingMethods );
         setSelection( hashingMethodComboViewer, LdapSecurityConstants.HASH_METHOD_SSHA );
         toolkit.createLabel( hashingMethodComposite, "   " ); //$NON-NLS-1$

Modified: directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java?rev=1643724&r1=1643723&r2=1643724&view=diff
==============================================================================
--- directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
(original)
+++ directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
Sun Dec  7 23:59:34 2014
@@ -122,15 +122,16 @@ public class OverviewPage extends Server
 
     // UI Control Listeners
     /**
-     * The LDAP transport checkbox listener.
+     * The LDAP transport checkbox selection adapter.
      */
     private SelectionAdapter enableLdapCheckboxListener = new SelectionAdapter()
     {
         public void widgetSelected( SelectionEvent e )
         {
+            boolean enableLdap = enableLdapCheckbox.getSelection();
             LdapLdapsServersPage.getLdapServerTransportBean( getDirectoryServiceBean() ).setEnabled(
-                enableLdapCheckbox.getSelection() );
-            setEnabled( ldapPortText, enableLdapCheckbox.getSelection() );
+                enableLdap );
+            setEnabled( ldapPortText, enableLdap );
         }
     };
 
@@ -142,19 +143,31 @@ public class OverviewPage extends Server
     {
         public void modifyText( ModifyEvent e )
         {
-            LdapLdapsServersPage.getLdapServerTransportBean( getDirectoryServiceBean() ).setSystemPort(
-                Integer.parseInt( ldapPortText.getText() ) );
+            try
+            {
+                int port = Integer.parseInt( ldapPortText.getText() );
+                
+                LdapLdapsServersPage.getLdapServerTransportBean( getDirectoryServiceBean()
).setSystemPort( port );
+            }
+            catch ( NumberFormatException nfe )
+            {
+                System.out.println( "Wrong LDAP TCP Port : it must be an integer" );
+            }
         }
     };
     
     
+    /**
+     * The LDAPS transport checkbox selection adapter
+     */
     private SelectionAdapter enableLdapsCheckboxListener = new SelectionAdapter()
     {
         public void widgetSelected( SelectionEvent e )
         {
+            boolean enableLdaps = enableLdapCheckbox.getSelection();
             LdapLdapsServersPage.getLdapsServerTransportBean( getDirectoryServiceBean() ).setEnabled(
-                enableLdapsCheckbox.getSelection() );
-            setEnabled( ldapsPortText, enableLdapsCheckbox.getSelection() );
+                enableLdaps );
+            setEnabled( ldapsPortText, enableLdaps );
         }
     };
 
@@ -166,12 +179,23 @@ public class OverviewPage extends Server
     {
         public void modifyText( ModifyEvent e )
         {
-            LdapLdapsServersPage.getLdapsServerTransportBean( getDirectoryServiceBean() ).setSystemPort(
-                Integer.parseInt( ldapsPortText.getText() ) );
+            try
+            {
+                int port = Integer.parseInt( ldapsPortText.getText() );
+                
+                LdapLdapsServersPage.getLdapsServerTransportBean( getDirectoryServiceBean()
).setSystemPort( port );
+            }
+            catch ( NumberFormatException nfe )
+            {
+                System.out.println( "Wrong LDAPS TCP Port : it must be an integer" );
+            }
         }
     };
 
     
+    /**
+     * The advanced LDAP/LDAPS configuration hyper link adapter
+     */
     private HyperlinkAdapter openLdapConfigurationLinkListener = new HyperlinkAdapter()
     {
         public void linkActivated( HyperlinkEvent e )
@@ -179,42 +203,86 @@ public class OverviewPage extends Server
             getServerConfigurationEditor().showPage( LdapLdapsServersPage.class );
         }
     };
+    
+    
+    /**
+     * The Kerberos server selection adpater
+     */
     private SelectionAdapter enableKerberosCheckboxListener = new SelectionAdapter()
     {
         public void widgetSelected( SelectionEvent e )
         {
-            KerberosServerPage.enableKerberosServer( getDirectoryServiceBean(), enableKerberosCheckbox.getSelection()
);
-            setEnabled( kerberosPortText, enableKerberosCheckbox.getSelection() );
+            boolean enableKerberos = enableKerberosCheckbox.getSelection();
+            KerberosServerPage.enableKerberosServer( getDirectoryServiceBean(), enableKerberos
);
+            setEnabled( kerberosPortText, enableKerberos );
         }
     };
+    
+    
+    /**
+     * The Kerberos port listener
+     */
     private ModifyListener kerberosPortTextListener = new ModifyListener()
     {
         public void modifyText( ModifyEvent e )
         {
-            KdcServerBean kdcServerBean = getConfigBean().getDirectoryServiceBean().getKdcServerBean();
-            kdcServerBean.getTransports()[0].setSystemPort( Integer.parseInt( kerberosPortText.getText()
) );
+            KdcServerBean kdcServerBean = getDirectoryServiceBean().getKdcServerBean();
+
+            try
+            {
+                int port = Integer.parseInt( kerberosPortText.getText() );
+                
+                kdcServerBean.getTransports()[0].setSystemPort( port );
+            }
+            catch ( NumberFormatException nfe )
+            {
+                System.out.println( "Wrong Kerberos TCP/UDP Port : it must be an integer"
);
+            }
         }
     };
+    
+    
+    /**
+     * The ChangePassword server selection adapter 
+     */
     private SelectionAdapter enableChangePasswordCheckboxListener = new SelectionAdapter()
     {
         public void widgetSelected( SelectionEvent e )
         {
-            ChangePasswordServerBean changePasswordServerBean = getConfigBean().getDirectoryServiceBean()
-                .getChangePasswordServerBean();
-            changePasswordServerBean.setEnabled( enableChangePasswordCheckbox.getSelection()
);
-            setEnabled( changePasswordPortText, enableChangePasswordCheckbox.getSelection()
);
+            ChangePasswordServerBean changePasswordServerBean = getDirectoryServiceBean().getChangePasswordServerBean();
+            boolean enableChangePassword = enableChangePasswordCheckbox.getSelection();
+            changePasswordServerBean.setEnabled( enableChangePassword );
+            setEnabled( changePasswordPortText, enableChangePassword );
         }
     };
+    
+    
+    /**
+     * The ChangePassword server port listener
+     */
     private ModifyListener changePasswordPortTextListener = new ModifyListener()
     {
         public void modifyText( ModifyEvent e )
         {
-            ChangePasswordServerBean changePasswordServerBean = getConfigBean().getDirectoryServiceBean()
-                .getChangePasswordServerBean();
-            changePasswordServerBean.getTransports()[0].setSystemPort( Integer.parseInt(
changePasswordPortText
-                .getText() ) );
+            ChangePasswordServerBean changePasswordServerBean = getDirectoryServiceBean().getChangePasswordServerBean();
+
+            try
+            {
+                int port = Integer.parseInt( changePasswordPortText.getText() );
+                
+                changePasswordServerBean.getTransports()[0].setSystemPort( port );
+            }
+            catch ( NumberFormatException nfe )
+            {
+                System.out.println( "Wrong ChnagePassword Port : it must be an integer" );
+            }
         }
     };
+    
+    
+    /**
+     * The advanced Kerberos configuration hyperlink
+     */
     private HyperlinkAdapter openKerberosConfigurationLinkListener = new HyperlinkAdapter()
     {
         public void linkActivated( HyperlinkEvent e )
@@ -222,6 +290,11 @@ public class OverviewPage extends Server
             getServerConfigurationEditor().showPage( KerberosServerPage.class );
         }
     };
+    
+    
+    /**
+     * The advanced Partition configuration hyperlink
+     */
     private HyperlinkAdapter openPartitionsConfigurationLinkListener = new HyperlinkAdapter()
     {
         public void linkActivated( HyperlinkEvent e )
@@ -229,20 +302,28 @@ public class OverviewPage extends Server
             getServerConfigurationEditor().showPage( PartitionsPage.class );
         }
     };
+    
+    
+    /**
+     * The AllowAnonymousAccess checkbox listener
+     */
     private SelectionAdapter allowAnonymousAccessCheckboxListener = new SelectionAdapter()
     {
         public void widgetSelected( SelectionEvent e )
         {
-            DirectoryServiceBean directoryServiceBean = getConfigBean().getDirectoryServiceBean();
-            directoryServiceBean.setDsAllowAnonymousAccess( allowAnonymousAccessCheckbox.getSelection()
);
+            getDirectoryServiceBean().setDsAllowAnonymousAccess( allowAnonymousAccessCheckbox.getSelection()
);
         }
     };
+    
+    
+    /**
+     * The AccessControl checkbox listener
+     */
     private SelectionAdapter enableAccessControlCheckboxListener = new SelectionAdapter()
     {
         public void widgetSelected( SelectionEvent e )
         {
-            DirectoryServiceBean directoryServiceBean = getConfigBean().getDirectoryServiceBean();
-            directoryServiceBean.setDsAccessControlEnabled( enableAccessControlCheckbox.getSelection()
);
+            getDirectoryServiceBean().setDsAccessControlEnabled( enableAccessControlCheckbox.getSelection()
);
         }
     };
 
@@ -250,8 +331,7 @@ public class OverviewPage extends Server
     /**
      * Creates a new instance of GeneralPage.
      *
-     * @param editor
-     *      the associated editor
+     * @param editor the associated editor
      */
     public OverviewPage( ServerConfigurationEditor editor )
     {
@@ -260,7 +340,23 @@ public class OverviewPage extends Server
 
 
     /**
-     * {@inheritDoc}
+     * Creates the global Overview Tab. It contains 2 columns, each one of
+     * them having two sections :
+     * 
+     * <pre>
+     * +-----------------------------------+---------------------------------+
+     * |                                   |                                 |
+     * | LDAP/LDAPS configuration section  | Kerberos/ChangePassword section |
+     * |                                   |                                 |
+     * +-----------------------------------+---------------------------------+
+     * |                                   |                                 |
+     * | Partition section                 | Options configuration section   |
+     * |                                   |                                 |
+     * +-----------------------------------+---------------------------------+
+     * </pre>
+     * 
+     * @param parent the parent element
+     * @param toolkit the form toolkit
      */
     protected void createFormContent( Composite parent, FormToolkit toolkit )
     {
@@ -294,7 +390,22 @@ public class OverviewPage extends Server
 
 
     /**
-     * Creates the LDAP and LDAPS Servers section.
+     * Creates the LDAP and LDAPS Servers section. This section is a grid with 4 columns,
+     * where we configure LDAPa and LDAPS servers.
+     * We can enable or disable those servers, and if they are enabled, we can configure
+     * the port.
+     * 
+     * <pre>
+     * .--------------------------------.
+     * | LDAP/LDAPS Transport           |
+     * +--------------------------------|
+     * | [X] Enabled LDAP server        |
+     * |  Port     : [/////////]        |
+     * | [X] Enabled LDAPS server       |
+     * |  Port     : [/////////]        |
+     * | <advanced LDAP/LDAPS config>   |
+     * +--------------------------------|
+     * </pre>
      *
      * @param toolkit the toolkit
      * @param parent the parent composite
@@ -308,7 +419,8 @@ public class OverviewPage extends Server
         Composite composite = toolkit.createComposite( section );
         toolkit.paintBordersFor( composite );
         GridLayout gridLayout = new GridLayout( 4, false );
-        gridLayout.marginHeight = gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+        gridLayout.marginWidth = 0;
         composite.setLayout( gridLayout );
         section.setClient( composite );
 
@@ -321,7 +433,7 @@ public class OverviewPage extends Server
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, Messages.getString( "OverviewPage.Port" ) ); //$NON-NLS-1$
         ldapPortText = createPortText( toolkit, composite );
-        createDefaultValueLabel( toolkit, composite, "10389" ); //$NON-NLS-1$
+        createDefaultValueLabel( toolkit, composite, Integer.toString( DEFAULT_PORT_LDAP
) ); //$NON-NLS-1$
 
         // Enable LDAPS Server Checkbox
         enableLdapsCheckbox = toolkit.createButton( composite,
@@ -332,7 +444,7 @@ public class OverviewPage extends Server
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, Messages.getString( "OverviewPage.Port" ) ); //$NON-NLS-1$
         ldapsPortText = createPortText( toolkit, composite );
-        createDefaultValueLabel( toolkit, composite, "10636" ); //$NON-NLS-1$
+        createDefaultValueLabel( toolkit, composite, Integer.toString( DEFAULT_PORT_LDAPS
) ); //$NON-NLS-1$
 
         // LDAP Configuration Link
         openLdapConfigurationLink = toolkit.createHyperlink( composite,
@@ -344,7 +456,19 @@ public class OverviewPage extends Server
 
 
     /**
-     * Creates the Kerberos and Change Password Servers section.
+     * Creates the Kerberos and Change Password Servers section. As for the LDAP/LDAPS
+     * server, we can configure the Kerberos and ChangePassword ports if they are enabled.
+     * <pre>
+     * +--------------------------------+
+     * | Kerberos Server                |
+     * +--------------------------------+
+     * | [X] Enable Kerberos Server     |
+     * |   Port     : [/////]           |
+     * | [X] Enable Kerberos ChangePwd  |
+     * |   Port     : [/////]           |
+     * | <advanced Kerberos config>     |
+     * +--------------------------------+
+     * </pre>
      *
      * @param toolkit the toolkit
      * @param parent the parent composite
@@ -372,7 +496,7 @@ public class OverviewPage extends Server
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, Messages.getString( "OverviewPage.Port" ) ); //$NON-NLS-1$
         kerberosPortText = createPortText( toolkit, composite );
-        createDefaultValueLabel( toolkit, composite, "60088" ); //$NON-NLS-1$
+        createDefaultValueLabel( toolkit, composite, Integer.toString( DEFAULT_PORT_KERBEROS
) ); //$NON-NLS-1$
 
         // Enable Change Password Server Checkbox
         enableChangePasswordCheckbox = toolkit.createButton( composite,
@@ -385,7 +509,7 @@ public class OverviewPage extends Server
         toolkit.createLabel( composite, TABULATION );
         toolkit.createLabel( composite, Messages.getString( "OverviewPage.Port" ) ); //$NON-NLS-1$
         changePasswordPortText = createPortText( toolkit, composite );
-        createDefaultValueLabel( toolkit, composite, "60464" ); //$NON-NLS-1$
+        createDefaultValueLabel( toolkit, composite, Integer.toString( DEFAULT_PORT_CHANGE_PASSWORD
) ); //$NON-NLS-1$
 
         // Kerberos Configuration Link
         openKerberosConfigurationLink = toolkit.createHyperlink( composite,
@@ -603,6 +727,7 @@ public class OverviewPage extends Server
 
             // Partitions
             List<PartitionBean> partitions = directoryServiceBean.getPartitions();
+            
             if ( partitions.size() == 1 )
             {
                 partitionsLabel.setText( Messages.getString( "OverviewPage.ThereIsOnePartitionDefined"
) ); //$NON-NLS-1$
@@ -612,6 +737,7 @@ public class OverviewPage extends Server
                 partitionsLabel.setText( NLS.bind(
                     Messages.getString( "OverviewPage.ThereAreXPartitionsDefined" ), partitions.size()
) ); //$NON-NLS-1$
             }
+            
             partitionsTableViewer.setInput( partitions.toArray() );
 
             // Options

Modified: directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java?rev=1643724&r1=1643723&r2=1643724&view=diff
==============================================================================
--- directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java
(original)
+++ directory/studio/branches/studio-tycho/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java
Sun Dec  7 23:59:34 2014
@@ -70,8 +70,21 @@ import org.eclipse.ui.forms.widgets.Scro
  */
 public abstract class ServerConfigurationEditorPage extends FormPage
 {
+    /** The default LDAP port */
+    protected static final int DEFAULT_PORT_LDAP = 10389;
+    
+    /** The default LDAPS port */
+    protected static final int DEFAULT_PORT_LDAPS = 10636;
+    
+    /** The default Kerberos port */
+    protected static final int DEFAULT_PORT_KERBEROS = 60088;
+    
+    /** The default LDAPS port */
+    protected static final int DEFAULT_PORT_CHANGE_PASSWORD = 60464;
+    
     /** The default IPV4 address for servers */
     protected static final String DEFAULT_ADDRESS = "0.0.0.0"; //$NON-NLS-1$
+    
     protected static final Color GRAY_COLOR = new Color( null, 120, 120, 120 );
     protected static final String TABULATION = "      "; //$NON-NLS-1$
     



Mime
View raw message