You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2011/11/07 14:30:15 UTC
svn commit: r1198727 - in /directory/studio/trunk/plugins:
ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/
ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/
lda...
Author: pamarcelot
Date: Mon Nov 7 13:30:15 2011
New Revision: 1198727
URL: http://svn.apache.org/viewvc?rev=1198727&view=rev
Log:
Improved error reporting when starting an LDAP Server.
Modified:
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.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java
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.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java
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.v200/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v200/ApacheDS200LdapServerAdapter.java
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/model/LdapServerAdapter.java
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=1198727&r1=1198726&r2=1198727&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 Mon Nov 7 13:30:15 2011
@@ -277,86 +277,79 @@ public class ApacheDS153LdapServerAdapte
/**
* {@inheritDoc}
*/
- public String[] checkPortsBeforeServerStart( LdapServer server )
+ public String[] checkPortsBeforeServerStart( LdapServer server ) throws Exception
{
List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
- try
- {
- ServerConfigurationV153 configuration = getServerConfiguration( server );
+ ServerConfigurationV153 configuration = getServerConfiguration( server );
- // LDAP
- if ( configuration.isEnableLdap() )
+ // LDAP
+ if ( configuration.isEnableLdap() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS153LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS153LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
}
+ }
- // LDAPS
- if ( configuration.isEnableLdaps() )
+ // LDAPS
+ if ( configuration.isEnableLdaps() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS153LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS153LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
}
+ }
- // Kerberos
- if ( configuration.isEnableKerberos() )
+ // Kerberos
+ if ( configuration.isEnableKerberos() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS153LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS
+ .bind(
+ Messages.getString( "ApacheDS153LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
}
+ }
- // DNS
- if ( configuration.isEnableDns() )
+ // DNS
+ if ( configuration.isEnableDns() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS153LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS153LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
}
+ }
- // NTP
- if ( configuration.isEnableNtp() )
+ // NTP
+ if ( configuration.isEnableNtp() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
- {
- alreadyInUseProtocolPortsList.add( NLS.bind(
- Messages.getString( "ApacheDS153LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
- { configuration.getNtpPort() } ) );
- }
+ alreadyInUseProtocolPortsList.add( NLS.bind(
+ Messages.getString( "ApacheDS153LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+ { configuration.getNtpPort() } ) );
}
+ }
- // Change Password
- if ( configuration.isEnableChangePassword() )
+ // Change Password
+ if ( configuration.isEnableChangePassword() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS153LdapServerAdapter.ChangePasswordPort" ), new Object[] { configuration.getChangePasswordPort() } ) ); //$NON-NLS-1$
- }
+ 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.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=1198727&r1=1198726&r2=1198727&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 Mon Nov 7 13:30:15 2011
@@ -279,86 +279,79 @@ public class ApacheDS154LdapServerAdapte
/**
* {@inheritDoc}
*/
- public String[] checkPortsBeforeServerStart( LdapServer server )
+ public String[] checkPortsBeforeServerStart( LdapServer server ) throws Exception
{
List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
- try
- {
- ServerConfigurationV154 configuration = getServerConfiguration( server );
+ ServerConfigurationV154 configuration = getServerConfiguration( server );
- // LDAP
- if ( configuration.isEnableLdap() )
+ // LDAP
+ if ( configuration.isEnableLdap() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS154LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS154LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
}
+ }
- // LDAPS
- if ( configuration.isEnableLdaps() )
+ // LDAPS
+ if ( configuration.isEnableLdaps() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS154LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS154LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
}
+ }
- // Kerberos
- if ( configuration.isEnableKerberos() )
+ // Kerberos
+ if ( configuration.isEnableKerberos() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS154LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS
+ .bind(
+ Messages.getString( "ApacheDS154LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
}
+ }
- // DNS
- if ( configuration.isEnableDns() )
+ // DNS
+ if ( configuration.isEnableDns() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS154LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS154LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
}
+ }
- // NTP
- if ( configuration.isEnableNtp() )
+ // NTP
+ if ( configuration.isEnableNtp() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
- {
- alreadyInUseProtocolPortsList.add( NLS.bind(
- Messages.getString( "ApacheDS154LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
- { configuration.getNtpPort() } ) );
- }
+ alreadyInUseProtocolPortsList.add( NLS.bind(
+ Messages.getString( "ApacheDS154LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+ { configuration.getNtpPort() } ) );
}
+ }
- // Change Password
- if ( configuration.isEnableChangePassword() )
+ // Change Password
+ if ( configuration.isEnableChangePassword() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS154LdapServerAdapter.ChangePasswordPort" ), new Object[] { configuration.getChangePasswordPort() } ) ); //$NON-NLS-1$
- }
+ 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.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=1198727&r1=1198726&r2=1198727&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 Mon Nov 7 13:30:15 2011
@@ -278,13 +278,11 @@ public class ApacheDS155LdapServerAdapte
/**
* {@inheritDoc}
*/
- public String[] checkPortsBeforeServerStart( LdapServer server )
+ public String[] checkPortsBeforeServerStart( LdapServer server ) throws Exception
{
List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
- try
- {
- ServerConfigurationV155 configuration = getServerConfiguration( server );
+ ServerConfigurationV155 configuration = getServerConfiguration( server );
// LDAP
if ( configuration.isEnableLdap() )
@@ -353,11 +351,6 @@ public class ApacheDS155LdapServerAdapte
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.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=1198727&r1=1198726&r2=1198727&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 Mon Nov 7 13:30:15 2011
@@ -284,86 +284,79 @@ public class ApacheDS156LdapServerAdapte
/**
* {@inheritDoc}
*/
- public String[] checkPortsBeforeServerStart( LdapServer server )
+ public String[] checkPortsBeforeServerStart( LdapServer server ) throws Exception
{
List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
- try
- {
- ServerConfigurationV156 configuration = getServerConfiguration( server );
+ ServerConfigurationV156 configuration = getServerConfiguration( server );
- // LDAP
- if ( configuration.isEnableLdap() )
+ // LDAP
+ if ( configuration.isEnableLdap() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS156LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS156LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
}
+ }
- // LDAPS
- if ( configuration.isEnableLdaps() )
+ // LDAPS
+ if ( configuration.isEnableLdaps() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS156LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS156LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
}
+ }
- // Kerberos
- if ( configuration.isEnableKerberos() )
+ // Kerberos
+ if ( configuration.isEnableKerberos() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS156LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS
+ .bind(
+ Messages.getString( "ApacheDS156LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
}
+ }
- // DNS
- if ( configuration.isEnableDns() )
+ // DNS
+ if ( configuration.isEnableDns() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS156LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS156LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
}
+ }
- // NTP
- if ( configuration.isEnableNtp() )
+ // NTP
+ if ( configuration.isEnableNtp() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
- {
- alreadyInUseProtocolPortsList.add( NLS.bind(
- Messages.getString( "ApacheDS156LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
- { configuration.getNtpPort() } ) );
- }
+ alreadyInUseProtocolPortsList.add( NLS.bind(
+ Messages.getString( "ApacheDS156LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+ { configuration.getNtpPort() } ) );
}
+ }
- // Change Password
- if ( configuration.isEnableChangePassword() )
+ // Change Password
+ if ( configuration.isEnableChangePassword() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS156LdapServerAdapter.ChangePasswordPort" ), new Object[] { configuration.getChangePasswordPort() } ) ); //$NON-NLS-1$
- }
+ 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.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=1198727&r1=1198726&r2=1198727&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 Mon Nov 7 13:30:15 2011
@@ -284,86 +284,79 @@ public class ApacheDS157LdapServerAdapte
/**
* {@inheritDoc}
*/
- public String[] checkPortsBeforeServerStart( LdapServer server )
+ public String[] checkPortsBeforeServerStart( LdapServer server ) throws Exception
{
List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
- try
- {
- ServerConfigurationV157 configuration = getServerConfiguration( server );
+ ServerConfigurationV157 configuration = getServerConfiguration( server );
- // LDAP
- if ( configuration.isEnableLdap() )
+ // LDAP
+ if ( configuration.isEnableLdap() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getLdapPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS157LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS157LdapServerAdapter.LDAPPort" ), new Object[] { configuration.getLdapPort() } ) ); //$NON-NLS-1$
}
+ }
- // LDAPS
- if ( configuration.isEnableLdaps() )
+ // LDAPS
+ if ( configuration.isEnableLdaps() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getLdapsPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS157LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS157LdapServerAdapter.LDAPSPort" ), new Object[] { configuration.getLdapsPort() } ) ); //$NON-NLS-1$
}
+ }
- // Kerberos
- if ( configuration.isEnableKerberos() )
+ // Kerberos
+ if ( configuration.isEnableKerberos() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getKerberosPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS157LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS
+ .bind(
+ Messages.getString( "ApacheDS157LdapServerAdapter.KerberosPort" ), new Object[] { configuration.getKerberosPort() } ) ); //$NON-NLS-1$
}
+ }
- // DNS
- if ( configuration.isEnableDns() )
+ // DNS
+ if ( configuration.isEnableDns() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getDnsPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS157LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS157LdapServerAdapter.DNSPort" ), new Object[] { configuration.getDnsPort() } ) ); //$NON-NLS-1$
}
+ }
- // NTP
- if ( configuration.isEnableNtp() )
+ // NTP
+ if ( configuration.isEnableNtp() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getNtpPort() ) )
- {
- alreadyInUseProtocolPortsList.add( NLS.bind(
- Messages.getString( "ApacheDS157LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
- { configuration.getNtpPort() } ) );
- }
+ alreadyInUseProtocolPortsList.add( NLS.bind(
+ Messages.getString( "ApacheDS157LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+ { configuration.getNtpPort() } ) );
}
+ }
- // Change Password
- if ( configuration.isEnableChangePassword() )
+ // Change Password
+ if ( configuration.isEnableChangePassword() )
+ {
+ if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
{
- if ( !AvailablePortFinder.available( configuration.getChangePasswordPort() ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS157LdapServerAdapter.ChangePasswordPort" ), new Object[] { configuration.getChangePasswordPort() } ) ); //$NON-NLS-1$
- }
+ 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.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=1198727&r1=1198726&r2=1198727&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 Mon Nov 7 13:30:15 2011
@@ -773,86 +773,79 @@ public class ApacheDS200LdapServerAdapte
/**
* {@inheritDoc}
*/
- public String[] checkPortsBeforeServerStart( LdapServer server )
+ public String[] checkPortsBeforeServerStart( LdapServer server ) throws Exception
{
List<String> alreadyInUseProtocolPortsList = new ArrayList<String>();
- try
- {
- ConfigBean configuration = getServerConfiguration( server );
+ ConfigBean configuration = getServerConfiguration( server );
- // LDAP
- if ( isEnableLdap( configuration ) )
+ // LDAP
+ if ( isEnableLdap( configuration ) )
+ {
+ if ( !AvailablePortFinder.available( getLdapPort( configuration ) ) )
{
- if ( !AvailablePortFinder.available( getLdapPort( configuration ) ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS200LdapServerAdapter.LDAPPort" ), new Object[] { getLdapPort( configuration ) } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS200LdapServerAdapter.LDAPPort" ), new Object[] { getLdapPort( configuration ) } ) ); //$NON-NLS-1$
}
+ }
- // LDAPS
- if ( isEnableLdaps( configuration ) )
+ // LDAPS
+ if ( isEnableLdaps( configuration ) )
+ {
+ if ( !AvailablePortFinder.available( getLdapsPort( configuration ) ) )
{
- if ( !AvailablePortFinder.available( getLdapsPort( configuration ) ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS200LdapServerAdapter.LDAPSPort" ), new Object[] { getLdapsPort( configuration ) } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS200LdapServerAdapter.LDAPSPort" ), new Object[] { getLdapsPort( configuration ) } ) ); //$NON-NLS-1$
}
+ }
- // Kerberos
- if ( isEnableKerberos( configuration ) )
+ // Kerberos
+ if ( isEnableKerberos( configuration ) )
+ {
+ if ( !AvailablePortFinder.available( getKerberosPort( configuration ) ) )
{
- if ( !AvailablePortFinder.available( getKerberosPort( configuration ) ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS200LdapServerAdapter.KerberosPort" ), new Object[] { getKerberosPort( configuration ) } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS
+ .bind(
+ Messages.getString( "ApacheDS200LdapServerAdapter.KerberosPort" ), new Object[] { getKerberosPort( configuration ) } ) ); //$NON-NLS-1$
}
+ }
- // DNS
- if ( isEnableDns( configuration ) )
+ // DNS
+ if ( isEnableDns( configuration ) )
+ {
+ if ( !AvailablePortFinder.available( getDnsPort( configuration ) ) )
{
- if ( !AvailablePortFinder.available( getDnsPort( configuration ) ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS.bind(
- Messages.getString( "ApacheDS200LdapServerAdapter.DNSPort" ), new Object[] { getDnsPort( configuration ) } ) ); //$NON-NLS-1$
- }
+ alreadyInUseProtocolPortsList
+ .add( NLS.bind(
+ Messages.getString( "ApacheDS200LdapServerAdapter.DNSPort" ), new Object[] { getDnsPort( configuration ) } ) ); //$NON-NLS-1$
}
+ }
- // NTP
- if ( isEnableNtp( configuration ) )
+ // NTP
+ if ( isEnableNtp( configuration ) )
+ {
+ if ( !AvailablePortFinder.available( getNtpPort( configuration ) ) )
{
- if ( !AvailablePortFinder.available( getNtpPort( configuration ) ) )
- {
- alreadyInUseProtocolPortsList.add( NLS.bind(
- Messages.getString( "ApacheDS200LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
- { getNtpPort( configuration ) } ) );
- }
+ alreadyInUseProtocolPortsList.add( NLS.bind(
+ Messages.getString( "ApacheDS200LdapServerAdapter.NTPPort" ), new Object[] //$NON-NLS-1$
+ { getNtpPort( configuration ) } ) );
}
+ }
- // Change Password
- if ( isEnableChangePassword( configuration ) )
+ // Change Password
+ if ( isEnableChangePassword( configuration ) )
+ {
+ if ( !AvailablePortFinder.available( getChangePasswordPort( configuration ) ) )
{
- if ( !AvailablePortFinder.available( getChangePasswordPort( configuration ) ) )
- {
- alreadyInUseProtocolPortsList
- .add( NLS
- .bind(
- Messages.getString( "ApacheDS200LdapServerAdapter.ChangePasswordPort" ), new Object[] { getChangePasswordPort( configuration ) } ) ); //$NON-NLS-1$
- }
+ 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/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=1198727&r1=1198726&r2=1198727&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 Mon Nov 7 13:30:15 2011
@@ -105,50 +105,62 @@ public class StartAction extends Action
{
LdapServerAdapter ldapServerAdapter = ldapServerAdapterExtension.getInstance();
- // Getting the ports already in use
- String[] portsAlreadyInUse = ldapServerAdapter.checkPortsBeforeServerStart( server );
- if ( ( portsAlreadyInUse == null ) || ( portsAlreadyInUse.length > 0 ) )
+ try
{
- String title = null;
- String message = null;
- if ( portsAlreadyInUse.length == 1 )
+ // Getting the ports already in use
+ String[] portsAlreadyInUse = ldapServerAdapter.checkPortsBeforeServerStart( server );
+ if ( ( portsAlreadyInUse == null ) || ( portsAlreadyInUse.length > 0 ) )
{
- 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 )
+ String title = null;
+ String message = null;
+
+ if ( portsAlreadyInUse.length == 1 )
{
- message += "\n - " + portAlreadyInUse; //$NON-NLS-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$
+ 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;
+ 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();
+ // Creating and scheduling the job to start the server
+ StudioLdapServerJob job = new StudioLdapServerJob( new StartLdapServerRunnable( server ) );
+ job.schedule();
+ }
+ catch ( Exception e )
+ {
+ // Showing an error in case no LDAP Server Adapter can be found
+ MessageDialog.openError( view.getSite().getShell(), "Error Starting Server",
+ NLS.bind( "The server ''{0}'' cannot be started." + "\n" + "Cause: {1}", server.getName(),
+ e.getMessage() ) );
+ }
}
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." );
+ NLS.bind( "The server ''{0}'' cannot be started." + "\n"
+ + "No LDAP Server Adapter could be found for this server.", server.getName() ) );
}
}
}
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=1198727&r1=1198726&r2=1198727&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 Mon Nov 7 13:30:15 2011
@@ -102,5 +102,5 @@ public interface LdapServerAdapter
* @param server the server
* @return an array of error message, one for each port being already used.
*/
- public String[] checkPortsBeforeServerStart( LdapServer server );
+ public String[] checkPortsBeforeServerStart( LdapServer server ) throws Exception;
}