directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1179279 - in /directory/studio/trunk/plugins: ldapservers.apacheds.v153/ ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ ldapservers.apacheds.v154/ ldapservers.apacheds.v154/src/main/java/org/...
Date Wed, 05 Oct 2011 15:50:17 GMT
Author: pamarcelot
Date: Wed Oct  5 15:50:16 2011
New Revision: 1179279

URL: http://svn.apache.org/viewvc?rev=1179279&view=rev
Log:
Added a new method to the LdapServerAdapter which allows the adapter to verify if any port used in the configuration of the server is already in use by another process.
A warning dialog appears in such a case.

Modified:
    directory/studio/trunk/plugins/ldapservers.apacheds.v153/pom.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/messages.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v154/pom.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/messages.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v155/pom.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/messages.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v156/pom.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/messages.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v157/pom.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/messages.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v200/pom.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/ApacheDS200LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/messages.properties
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/StartAction.java
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages.properties
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_de.properties
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_fr.properties
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v153/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v153/pom.xml?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v153/pom.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v153/pom.xml Wed Oct  5 15:50:16 2011
@@ -119,6 +119,7 @@
  org.apache.directory.studio.common.ui,
  org.apache.directory.studio.connection.core,
  org.apache.directory.studio.ldapservers,
+ org.apache.mina.core;bundle-version="${org.apache.mina.core.version}",
  org.dom4j.dom4j;bundle-version="${org.dom4j.version}",
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
@@ -404,6 +405,11 @@
     <!-- Apache Directory Studio library plugins dependencies -->
     <dependency>
       <groupId>org.apache.directory.studio</groupId>
+      <artifactId>org.apache.mina.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.studio</groupId>
       <artifactId>org.dom4j.dom4j</artifactId>
       <scope>provided</scope>
     </dependency>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java Wed Oct  5 15:50:16 2011
@@ -26,6 +26,8 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
 import org.apache.directory.studio.apacheds.configuration.model.ServerXmlIOException;
@@ -37,9 +39,11 @@ import org.apache.directory.studio.ldaps
 import org.apache.directory.studio.ldapservers.LdapServersUtils;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
 import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+import org.apache.mina.util.AvailablePortFinder;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunch;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
@@ -268,4 +272,92 @@ public class ApacheDS153LdapServerAdapte
             return 0;
         }
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] checkPortsBeforeServerStart( LdapServer server )
+    {
+        List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
+
+        try
+        {
+            ServerConfigurationV153 configuration = getServerConfiguration( server );
+
+            // LDAP
+            if ( configuration.isEnableLdap() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS153LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // LDAPS
+            if ( configuration.isEnableLdaps() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS153LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // Kerberos
+            if ( configuration.isEnableKerberos() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS153LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // DNS
+            if ( configuration.isEnableDns() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS153LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // NTP
+            if ( configuration.isEnableNtp() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
+                {
+                    alreadyInUseProtocolPortsList.add( NLS.bind(
+                        Messages.getString( "ApacheDS153LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+                        { configuration.getNtpPort() } ) );
+                }
+            }
+
+            // Change Password
+            if ( configuration.isEnableChangePassword() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS153LdapServerAdapter.ChangePasswordPort" ), new Object[] { configuration.getChangePasswordPort() } ) ); //$NON-NLS-1$
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+            System.out.println( e );
+        }
+
+        return alreadyInUseProtocolPortsList.toArray( new String[0] );
+    }
 }

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/messages.properties?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/messages.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/messages.properties Wed Oct  5 15:50:16 2011
@@ -15,6 +15,13 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ApacheDS153LdapServerAdapter.LDAPPort=LDAP (port {0})
+ApacheDS153LdapServerAdapter.LDAPSPort=LDAPS (port {0})
+ApacheDS153LdapServerAdapter.KerberosPort=Kerberos (port {0})
+ApacheDS153LdapServerAdapter.DNSPort=DNS (port {0})
+ApacheDS153LdapServerAdapter.NTPPort=NTP (port {0})
+ApacheDS153LdapServerAdapter.ChangePasswordPort=ChangePassword (port {0})
+
 ApacheDS153Plugin.UnableGetPluginProperties=Unable to get the plugin properties.
 
 CreateConnectionAction.FollowingErrorOccurred=The following error occurred\: 

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v154/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v154/pom.xml?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v154/pom.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v154/pom.xml Wed Oct  5 15:50:16 2011
@@ -119,6 +119,7 @@
  org.apache.directory.studio.common.ui,
  org.apache.directory.studio.connection.core,
  org.apache.directory.studio.ldapservers,
+ org.apache.mina.core;bundle-version="${org.apache.mina.core.version}",
  org.dom4j.dom4j;bundle-version="${org.dom4j.version}",
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
@@ -424,6 +425,11 @@
     <!-- Apache Directory Studio library plugins dependencies -->
     <dependency>
       <groupId>org.apache.directory.studio</groupId>
+      <artifactId>org.apache.mina.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.studio</groupId>
       <artifactId>org.dom4j.dom4j</artifactId>
       <scope>provided</scope>
     </dependency>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java Wed Oct  5 15:50:16 2011
@@ -26,6 +26,8 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
 import org.apache.directory.studio.apacheds.configuration.model.ServerXmlIOException;
@@ -37,9 +39,11 @@ import org.apache.directory.studio.ldaps
 import org.apache.directory.studio.ldapservers.LdapServersUtils;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
 import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+import org.apache.mina.util.AvailablePortFinder;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunch;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
@@ -270,4 +274,92 @@ public class ApacheDS154LdapServerAdapte
             return 0;
         }
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] checkPortsBeforeServerStart( LdapServer server )
+    {
+        List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
+
+        try
+        {
+            ServerConfigurationV154 configuration = getServerConfiguration( server );
+
+            // LDAP
+            if ( configuration.isEnableLdap() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS154LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // LDAPS
+            if ( configuration.isEnableLdaps() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS154LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // Kerberos
+            if ( configuration.isEnableKerberos() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS154LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // DNS
+            if ( configuration.isEnableDns() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS154LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // NTP
+            if ( configuration.isEnableNtp() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
+                {
+                    alreadyInUseProtocolPortsList.add( NLS.bind(
+                        Messages.getString( "ApacheDS154LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+                        { configuration.getNtpPort() } ) );
+                }
+            }
+
+            // Change Password
+            if ( configuration.isEnableChangePassword() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS154LdapServerAdapter.ChangePasswordPort" ), new Object[] { configuration.getChangePasswordPort() } ) ); //$NON-NLS-1$
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+            System.out.println( e );
+        }
+
+        return alreadyInUseProtocolPortsList.toArray( new String[0] );
+    }
 }

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/messages.properties?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/messages.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/messages.properties Wed Oct  5 15:50:16 2011
@@ -15,6 +15,13 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ApacheDS154LdapServerAdapter.LDAPPort=LDAP (port {0})
+ApacheDS154LdapServerAdapter.LDAPSPort=LDAPS (port {0})
+ApacheDS154LdapServerAdapter.KerberosPort=Kerberos (port {0})
+ApacheDS154LdapServerAdapter.DNSPort=DNS (port {0})
+ApacheDS154LdapServerAdapter.NTPPort=NTP (port {0})
+ApacheDS154LdapServerAdapter.ChangePasswordPort=ChangePassword (port {0})
+
 ApacheDS154Plugin.UnableGetPluginProperties=Unable to get the plugin properties.
 
 CreateConnectionAction.FollowingErrorOccurred=The following error occurred\: 

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v155/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v155/pom.xml?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v155/pom.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v155/pom.xml Wed Oct  5 15:50:16 2011
@@ -119,6 +119,7 @@
  org.apache.directory.studio.common.ui,
  org.apache.directory.studio.connection.core,
  org.apache.directory.studio.ldapservers,
+ org.apache.mina.core;bundle-version="${org.apache.mina.core.version}",
  org.dom4j.dom4j;bundle-version="${org.dom4j.version}",
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
@@ -434,6 +435,11 @@
     <!-- Apache Directory Studio library plugins dependencies -->
     <dependency>
       <groupId>org.apache.directory.studio</groupId>
+      <artifactId>org.apache.mina.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.studio</groupId>
       <artifactId>org.dom4j.dom4j</artifactId>
       <scope>provided</scope>
     </dependency>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java Wed Oct  5 15:50:16 2011
@@ -17,7 +17,6 @@
  *  under the License. 
  *  
  */
-
 package org.apache.directory.studio.ldapservers.apacheds.v155;
 
 
@@ -26,6 +25,8 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
 import org.apache.directory.studio.apacheds.configuration.model.ServerXmlIOException;
@@ -37,9 +38,11 @@ import org.apache.directory.studio.ldaps
 import org.apache.directory.studio.ldapservers.LdapServersUtils;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
 import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+import org.apache.mina.util.AvailablePortFinder;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunch;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
@@ -270,4 +273,92 @@ public class ApacheDS155LdapServerAdapte
             return 0;
         }
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] checkPortsBeforeServerStart( LdapServer server )
+    {
+        List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
+
+        try
+        {
+            ServerConfigurationV155 configuration = getServerConfiguration( server );
+
+        // LDAP
+        if ( configuration.isEnableLdap() )
+        {
+            if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
+            {
+                alreadyInUseProtocolPortsList
+                    .add( NLS.bind(
+                        Messages.getString( "ApacheDS155LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
+            }
+        }
+
+        // LDAPS
+        if ( configuration.isEnableLdaps() )
+        {
+            if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
+            {
+                alreadyInUseProtocolPortsList
+                    .add( NLS.bind(
+                        Messages.getString( "ApacheDS155LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
+            }
+        }
+
+        // Kerberos
+        if ( configuration.isEnableKerberos() )
+        {
+            if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
+            {
+                alreadyInUseProtocolPortsList
+                    .add( NLS
+                        .bind(
+                            Messages.getString( "ApacheDS155LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
+            }
+        }
+
+        // DNS
+        if ( configuration.isEnableDns() )
+        {
+            if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
+            {
+                alreadyInUseProtocolPortsList
+                    .add( NLS.bind(
+                        Messages.getString( "ApacheDS155LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
+            }
+        }
+
+        // NTP
+        if ( configuration.isEnableNtp() )
+        {
+            if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
+            {
+                alreadyInUseProtocolPortsList.add( NLS.bind(
+                    Messages.getString( "ApacheDS155LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+                    { configuration.getNtpPort() } ) );
+            }
+        }
+
+        // Change Password
+        if ( configuration.isEnableChangePassword() )
+        {
+            if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
+            {
+                alreadyInUseProtocolPortsList
+                    .add( NLS
+                        .bind(
+                            Messages.getString( "ApacheDS155LdapServerAdapter.ChangePasswordPort" ), new Object[] { configuration.getChangePasswordPort() } ) ); //$NON-NLS-1$
+            }
+        }
+    }
+    catch ( Exception e )
+    {
+        System.out.println( e );
+    }
+
+        return alreadyInUseProtocolPortsList.toArray( new String[0] );
+    }
 }

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/messages.properties?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/messages.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/messages.properties Wed Oct  5 15:50:16 2011
@@ -15,6 +15,13 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ApacheDS155LdapServerAdapter.LDAPPort=LDAP (port {0})
+ApacheDS155LdapServerAdapter.LDAPSPort=LDAPS (port {0})
+ApacheDS155LdapServerAdapter.KerberosPort=Kerberos (port {0})
+ApacheDS155LdapServerAdapter.DNSPort=DNS (port {0})
+ApacheDS155LdapServerAdapter.NTPPort=NTP (port {0})
+ApacheDS155LdapServerAdapter.ChangePasswordPort=ChangePassword (port {0})
+
 ApacheDS155Plugin.UnableGetPluginProperties=Unable to get the plugin properties.
 
 CreateConnectionAction.FollowingErrorOccurred=The following error occurred\: 

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v156/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v156/pom.xml?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v156/pom.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v156/pom.xml Wed Oct  5 15:50:16 2011
@@ -119,6 +119,7 @@
  org.apache.directory.studio.common.ui,
  org.apache.directory.studio.connection.core,
  org.apache.directory.studio.ldapservers,
+ org.apache.mina.core;bundle-version="${org.apache.mina.core.version}",
  org.dom4j.dom4j;bundle-version="${org.dom4j.version}",
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
@@ -528,6 +529,11 @@
     <!-- Apache Directory Studio library plugins dependencies -->
     <dependency>
       <groupId>org.apache.directory.studio</groupId>
+      <artifactId>org.apache.mina.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.studio</groupId>
       <artifactId>org.dom4j.dom4j</artifactId>
       <scope>provided</scope>
     </dependency>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java Wed Oct  5 15:50:16 2011
@@ -26,6 +26,8 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
 import org.apache.directory.studio.apacheds.configuration.model.ServerXmlIOException;
@@ -37,9 +39,11 @@ import org.apache.directory.studio.ldaps
 import org.apache.directory.studio.ldapservers.LdapServersUtils;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
 import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+import org.apache.mina.util.AvailablePortFinder;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunch;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
@@ -275,4 +279,92 @@ public class ApacheDS156LdapServerAdapte
             return 0;
         }
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] checkPortsBeforeServerStart( LdapServer server )
+    {
+        List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
+
+        try
+        {
+            ServerConfigurationV156 configuration = getServerConfiguration( server );
+
+            // LDAP
+            if ( configuration.isEnableLdap() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS156LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // LDAPS
+            if ( configuration.isEnableLdaps() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS156LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // Kerberos
+            if ( configuration.isEnableKerberos() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS156LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // DNS
+            if ( configuration.isEnableDns() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS156LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // NTP
+            if ( configuration.isEnableNtp() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
+                {
+                    alreadyInUseProtocolPortsList.add( NLS.bind(
+                        Messages.getString( "ApacheDS156LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+                        { configuration.getNtpPort() } ) );
+                }
+            }
+
+            // Change Password
+            if ( configuration.isEnableChangePassword() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS156LdapServerAdapter.ChangePasswordPort" ), new Object[] { configuration.getChangePasswordPort() } ) ); //$NON-NLS-1$
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+            System.out.println( e );
+        }
+
+        return alreadyInUseProtocolPortsList.toArray( new String[0] );
+    }
 }

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/messages.properties?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/messages.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/messages.properties Wed Oct  5 15:50:16 2011
@@ -15,6 +15,13 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ApacheDS156LdapServerAdapter.LDAPPort=LDAP (port {0})
+ApacheDS156LdapServerAdapter.LDAPSPort=LDAPS (port {0})
+ApacheDS156LdapServerAdapter.KerberosPort=Kerberos (port {0})
+ApacheDS156LdapServerAdapter.DNSPort=DNS (port {0})
+ApacheDS156LdapServerAdapter.NTPPort=NTP (port {0})
+ApacheDS156LdapServerAdapter.ChangePasswordPort=ChangePassword (port {0})
+
 ApacheDS156Plugin.UnableGetPluginProperties=Unable to get the plugin properties.
 
 CreateConnectionAction.FollowingErrorOccurred=The following error occurred\: 

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v157/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v157/pom.xml?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v157/pom.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v157/pom.xml Wed Oct  5 15:50:16 2011
@@ -119,6 +119,7 @@
  org.apache.directory.studio.common.ui,
  org.apache.directory.studio.connection.core,
  org.apache.directory.studio.ldapservers,
+ org.apache.mina.core;bundle-version="${org.apache.mina.core.version}",
  org.dom4j.dom4j;bundle-version="${org.dom4j.version}",
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
@@ -528,6 +529,11 @@
     <!-- Apache Directory Studio library plugins dependencies -->
     <dependency>
       <groupId>org.apache.directory.studio</groupId>
+      <artifactId>org.apache.mina.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.studio</groupId>
       <artifactId>org.dom4j.dom4j</artifactId>
       <scope>provided</scope>
     </dependency>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java Wed Oct  5 15:50:16 2011
@@ -26,6 +26,8 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
 import org.apache.directory.studio.apacheds.configuration.model.ServerXmlIOException;
@@ -37,9 +39,11 @@ import org.apache.directory.studio.ldaps
 import org.apache.directory.studio.ldapservers.LdapServersUtils;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
 import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+import org.apache.mina.util.AvailablePortFinder;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunch;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
@@ -275,4 +279,92 @@ public class ApacheDS157LdapServerAdapte
             return 0;
         }
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] checkPortsBeforeServerStart( LdapServer server )
+    {
+        List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
+
+        try
+        {
+            ServerConfigurationV157 configuration = getServerConfiguration( server );
+
+            // LDAP
+            if ( configuration.isEnableLdap() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS157LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // LDAPS
+            if ( configuration.isEnableLdaps() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS157LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // Kerberos
+            if ( configuration.isEnableKerberos() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS157LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // DNS
+            if ( configuration.isEnableDns() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS157LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // NTP
+            if ( configuration.isEnableNtp() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
+                {
+                    alreadyInUseProtocolPortsList.add( NLS.bind(
+                        Messages.getString( "ApacheDS157LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+                        { configuration.getNtpPort() } ) );
+                }
+            }
+
+            // Change Password
+            if ( configuration.isEnableChangePassword() )
+            {
+                if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS157LdapServerAdapter.ChangePasswordPort" ), new Object[] { configuration.getChangePasswordPort() } ) ); //$NON-NLS-1$
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+            System.out.println( e );
+        }
+
+        return alreadyInUseProtocolPortsList.toArray( new String[0] );
+    }
 }

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/messages.properties?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/messages.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/messages.properties Wed Oct  5 15:50:16 2011
@@ -15,6 +15,13 @@
 # specific language governing permissions and limitations
 # under the License.
 
+ApacheDS157LdapServerAdapter.LDAPPort=LDAP (port {0})
+ApacheDS157LdapServerAdapter.LDAPSPort=LDAPS (port {0})
+ApacheDS157LdapServerAdapter.KerberosPort=Kerberos (port {0})
+ApacheDS157LdapServerAdapter.DNSPort=DNS (port {0})
+ApacheDS157LdapServerAdapter.NTPPort=NTP (port {0})
+ApacheDS157LdapServerAdapter.ChangePasswordPort=ChangePassword (port {0})
+
 ApacheDS157Plugin.UnableGetPluginProperties=Unable to get the plugin properties.
 
 CreateConnectionAction.FollowingErrorOccurred=The following error occurred\: 

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v200/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v200/pom.xml?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v200/pom.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v200/pom.xml Wed Oct  5 15:50:16 2011
@@ -122,6 +122,7 @@
  org.apache.directory.studio.common.ui,
  org.apache.directory.studio.connection.core,
  org.apache.directory.studio.ldapservers,
+ org.apache.mina.core;bundle-version="${org.apache.mina.core.version}",
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
  org.eclipse.debug.core,
@@ -201,6 +202,11 @@
       <artifactId>org.apache.directory.server.xdbm.partition</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.directory.studio</groupId>
+      <artifactId>org.apache.mina.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
     
   	<!-- Apache Directory Studio plugins dependencies -->
     <dependency>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/ApacheDS200LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/ApacheDS200LdapServerAdapter.java?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/ApacheDS200LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/ApacheDS200LdapServerAdapter.java Wed Oct  5 15:50:16 2011
@@ -44,6 +44,7 @@ import org.apache.directory.studio.ldaps
 import org.apache.directory.studio.ldapservers.LdapServersUtils;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
 import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+import org.apache.mina.util.AvailablePortFinder;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
@@ -767,4 +768,92 @@ public class ApacheDS200LdapServerAdapte
 
         return 0;
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] checkPortsBeforeServerStart( LdapServer server )
+    {
+        List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
+
+        try
+        {
+            ConfigBean configuration = getServerConfiguration( server );
+
+            // LDAP
+            if ( isEnableLdap( configuration ) )
+            {
+                if ( !AvailablePortFinder.available( getLdapPort( configuration ) ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS200LdapServerAdapter.LDAPPort" ), new Object[] { getLdapPort( configuration ) } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // LDAPS
+            if ( isEnableLdaps( configuration ) )
+            {
+                if ( !AvailablePortFinder.available( getLdapsPort( configuration ) ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS200LdapServerAdapter.LDAPSPort" ), new Object[] { getLdapsPort( configuration ) } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // Kerberos
+            if ( isEnableKerberos( configuration ) )
+            {
+                if ( !AvailablePortFinder.available( getKerberosPort( configuration ) ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS200LdapServerAdapter.KerberosPort" ), new Object[] { getKerberosPort( configuration ) } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // DNS
+            if ( isEnableDns( configuration ) )
+            {
+                if ( !AvailablePortFinder.available( getDnsPort( configuration ) ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS.bind(
+                            Messages.getString( "ApacheDS200LdapServerAdapter.DNSPort" ), new Object[] { getDnsPort( configuration ) } ) ); //$NON-NLS-1$
+                }
+            }
+
+            // NTP
+            if ( isEnableNtp( configuration ) )
+            {
+                if ( !AvailablePortFinder.available( getNtpPort( configuration ) ) )
+                {
+                    alreadyInUseProtocolPortsList.add( NLS.bind(
+                        Messages.getString( "ApacheDS200LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+                        { getNtpPort( configuration ) } ) );
+                }
+            }
+
+            // Change Password
+            if ( isEnableChangePassword( configuration ) )
+            {
+                if ( !AvailablePortFinder.available( getChangePasswordPort( configuration ) ) )
+                {
+                    alreadyInUseProtocolPortsList
+                        .add( NLS
+                            .bind(
+                                Messages.getString( "ApacheDS200LdapServerAdapter.ChangePasswordPort" ), new Object[] { getChangePasswordPort( configuration ) } ) ); //$NON-NLS-1$
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+            System.out.println( e );
+        }
+
+        return alreadyInUseProtocolPortsList.toArray( new String[0] );
+    }
 }

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/messages.properties?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/messages.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/messages.properties Wed Oct  5 15:50:16 2011
@@ -15,9 +15,15 @@
 # specific language governing permissions and limitations
 # under the License.
 
-ApacheDS200Plugin.UnableGetPluginProperties=Unable to get the plugin properties.
-
 ApacheDS200LdapServerAdapter.Starting=Starting {0}...
+ApacheDS200LdapServerAdapter.LDAPPort=LDAP (port {0})
+ApacheDS200LdapServerAdapter.LDAPSPort=LDAPS (port {0})
+ApacheDS200LdapServerAdapter.KerberosPort=Kerberos (port {0})
+ApacheDS200LdapServerAdapter.DNSPort=DNS (port {0})
+ApacheDS200LdapServerAdapter.NTPPort=NTP (port {0})
+ApacheDS200LdapServerAdapter.ChangePasswordPort=ChangePassword (port {0})
+
+ApacheDS200Plugin.UnableGetPluginProperties=Unable to get the plugin properties.
 
 CreateConnectionAction.FollowingErrorOccurred=The following error occurred\: 
 CreateConnectionAction.LDAPAndLDAPSDisabled=LDAP and LDAPS protocols are disabled. A connection cannot be created.

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/StartAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/StartAction.java?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/StartAction.java (original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/StartAction.java Wed Oct  5 15:50:16 2011
@@ -25,11 +25,16 @@ import org.apache.directory.studio.ldaps
 import org.apache.directory.studio.ldapservers.jobs.StartLdapServerRunnable;
 import org.apache.directory.studio.ldapservers.jobs.StudioLdapServerJob;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
+import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+import org.apache.directory.studio.ldapservers.model.LdapServerAdapterExtension;
 import org.apache.directory.studio.ldapservers.views.ServersView;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 
@@ -95,9 +100,56 @@ public class StartAction extends Action 
                 // Getting the server
                 LdapServer server = ( LdapServer ) selection.getFirstElement();
 
-                // Creating and scheduling the job to start the server
-                StudioLdapServerJob job = new StudioLdapServerJob( new StartLdapServerRunnable( server ) );
-                job.schedule();
+                LdapServerAdapterExtension ldapServerAdapterExtension = server.getLdapServerAdapterExtension();
+                if ( ( ldapServerAdapterExtension != null ) && ( ldapServerAdapterExtension.getInstance() != null ) )
+                {
+                    LdapServerAdapter ldapServerAdapter = ldapServerAdapterExtension.getInstance();
+
+                    // Getting the ports already in use
+                    String[] portsAlreadyInUse = ldapServerAdapter.checkPortsBeforeServerStart( server );
+                    if ( ( portsAlreadyInUse == null ) || ( portsAlreadyInUse.length > 0 ) )
+                    {
+                        String title = null;
+                        String message = null;
+
+                        if ( portsAlreadyInUse.length == 1 )
+                        {
+                            title = Messages.getString( "StartAction.PortInUse" ); //$NON-NLS-1$
+                            message = NLS
+                                .bind(
+                                    Messages.getString( "StartAction.PortOfProtocolInUse" ), new String[] { portsAlreadyInUse[0] } ); //$NON-NLS-1$
+                        }
+                        else
+                        {
+                            title = Messages.getString( "StartAction.PortsInUse" ); //$NON-NLS-1$
+                            message = Messages.getString( "StartAction.PortsOfProtocolsInUse" ); //$NON-NLS-1$
+                            for ( String portAlreadyInUse : portsAlreadyInUse )
+                            {
+                                message += "\n    - " + portAlreadyInUse; //$NON-NLS-1$
+                            }
+                        }
+
+                        message += "\n\n" + Messages.getString( "StartAction.Continue" ); //$NON-NLS-1$
+
+                        MessageDialog dialog = new MessageDialog( view.getSite().getShell(), title, null, message,
+                            MessageDialog.WARNING, new String[]
+                                { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, MessageDialog.OK );
+                        if ( dialog.open() == MessageDialog.CANCEL )
+                        {
+                            return;
+                        }
+                    }
+
+                    // Creating and scheduling the job to start the server
+                    StudioLdapServerJob job = new StudioLdapServerJob( new StartLdapServerRunnable( server ) );
+                    job.schedule();
+                }
+                else
+                {
+                    // Showing an error in case no LDAP Server Adapter can be found
+                    MessageDialog.openError( view.getSite().getShell(), "No LDAP Server Adapter",
+                        "This server can't be started.\nNo LDAP Server Adapter could be found for this server." );
+                }
             }
         }
     }

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages.properties?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages.properties (original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages.properties Wed Oct  5 15:50:16 2011
@@ -39,20 +39,19 @@ RenameAction.RenameToolTip=Rename...
 RenameAction.Server=Server
 
 StartAction.ChangePasswordPort=ChangePassword (port {0})
-StartAction.Continue=Do you wish to continue?
 StartAction.DNSPort=DNS (port {0})
-StartAction.FollowingErrorOccurred=The following error occurred\: 
 StartAction.KerberosPort=Kerberos (port {0})
 StartAction.LDAPPort=LDAP (port {0})
 StartAction.LDAPSPort=LDAPS (port {0})
 StartAction.NTPPort=NTP (port {0})
+
+StartAction.Continue=Do you wish to continue?
 StartAction.PortInUse=Port already in use
 StartAction.PortOfProtocolInUse=The port of the protocol {0} is already in use.
 StartAction.PortsInUse=Ports already in use
 StartAction.PortsOfProtocolsInUse=The ports of the following protocols are already in use\:
 StartAction.Start=&Run
 StartAction.StartToolTip=Run
-StartAction.UnableReadServerConfiguration=Unable to read the server configuration.
 
 StopAction.ErrorWhenStopping=An error occurred when stopping the server.\n\n
 StopAction.ErrorWhenWriting=An error occurred when writing to the Info console message stream.\n\n

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_de.properties?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_de.properties (original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_de.properties Wed Oct  5 15:50:16 2011
@@ -38,12 +38,10 @@ RenameAction.Rename=Umb&enennen...
 RenameAction.RenameToolTip=Umbenennen...
 
 StartAction.Continue=Wollen Sie weiterfahren?
-StartAction.FollowingErrorOccurred=Folgender Fehler ist aufgetreten\: 
 StartAction.PortInUse=Der Port wird bereits verwendet
 StartAction.PortOfProtocolInUse=Der Port des Protokolls {0} wird bereits verwendet.
 StartAction.PortsInUse=Die Ports werden bereits verwendet
 StartAction.PortsOfProtocolsInUse=Die Ports folgender Protokolle werden bereits verwendet\:
-StartAction.UnableReadServerConfiguration=Unf\u00E4hig die Server Konfiguration zu lesen.
 StartAction.Start=&Starten
 StartAction.StartToolTip=Starten
 

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_fr.properties?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_fr.properties (original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/messages_fr.properties Wed Oct  5 15:50:16 2011
@@ -48,14 +48,12 @@ RenameAction.RenameToolTip=Renommer...
 RenameAction.Server=Serveur
 
 StartAction.Continue=Voulez-vous poursuivre l'op\u00E9ration ?
-StartAction.FollowingErrorOccurred=L'erreur suivante est survenue \:
 StartAction.PortInUse=Le port est d\u00E9j\u00E0 utilis\u00E9
 StartAction.PortOfProtocolInUse=Le port associ\u00E9 au protocole "{0}" est d\u00E9j\u00E0 utilis\u00E9.
 StartAction.PortsInUse=Les ports sont d\u00E9j\u00E0 utilis\u00E9s.
 StartAction.PortsOfProtocolsInUse=Les ports associ\u00E9s aux protocoles suivants sont d\u00E9j\u00E0 utilis\u00E9s \:
 StartAction.Start=&D\u00E9marrer
 StartAction.StartToolTip=D\u00E9marrer
-StartAction.UnableReadServerConfiguration=Impossible de lire la configuration du serveur.
 
 StopAction.ErrorWhenStopping=Une erreur est survenue lors de l'arr\u00EAt du serveur.\n\n
 StopAction.ErrorWhenWriting=Une erreur est survenue lors de l'\u00E9criture dans la console d'information.\n\n

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java Wed Oct  5 15:50:16 2011
@@ -21,11 +21,7 @@
 package org.apache.directory.studio.ldapservers.model;
 
 
-import java.util.List;
-
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
 
 
 /**
@@ -96,4 +92,15 @@ public interface LdapServerAdapter
      *      if an error occurs when restarting the server
      */
     public void stop( LdapServer server, StudioProgressMonitor monitor ) throws Exception;
+
+
+    /**
+     * Checks the ports before the server start.
+     * <p>
+     * The return strings must have the following format: {PROTOCOL} ({PORT})
+     *
+     * @param server the server
+     * @return an array of error message, one for each port being already used.
+     */
+    public String[] checkPortsBeforeServerStart( LdapServer server );
 }

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java?rev=1179279&r1=1179278&r2=1179279&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java (original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java Wed Oct  5 15:50:16 2011
@@ -110,6 +110,15 @@ public class UnknownLdapServerAdapterExt
                     }
                 } );
             }
+
+
+            /**
+             * {@inheritDoc}
+             */
+            public String[] checkPortsBeforeServerStart( LdapServer server )
+            {
+                return new String[0];
+            }
         } );
 
     }



Mime
View raw message