* the server configuration
*/
public static void createLdapBrowserConnection( String serverName, ServerConfiguration serverConfiguration )
{
//Creating the connection parameter object
ConnectionParameter connectionParameter = new ConnectionParameter();
// Auth method
connectionParameter.setAuthMethod( AuthenticationMethod.SIMPLE );
// Encryption method and port
if ( serverConfiguration instanceof ServerConfigurationV155 )
{
ServerConfigurationV155 serverConfiguration155 = ( ServerConfigurationV155 ) serverConfiguration;
if ( serverConfiguration155.isEnableLdap() )
{
connectionParameter.setEncryptionMethod( EncryptionMethod.NONE );
connectionParameter.setPort( serverConfiguration155.getLdapPort() );
}
else if ( serverConfiguration155.isEnableLdaps() )
{
connectionParameter.setEncryptionMethod( EncryptionMethod.LDAPS );
connectionParameter.setPort( serverConfiguration155.getLdapsPort() );
}
}
else if ( serverConfiguration instanceof ServerConfigurationV154 )
{
ServerConfigurationV154 serverConfiguration154 = ( ServerConfigurationV154 ) serverConfiguration;
if ( serverConfiguration154.isEnableLdap() )
{
connectionParameter.setEncryptionMethod( EncryptionMethod.NONE );
connectionParameter.setPort( serverConfiguration154.getLdapPort() );
}
else if ( serverConfiguration154.isEnableLdaps() )
{
connectionParameter.setEncryptionMethod( EncryptionMethod.LDAPS );
connectionParameter.setPort( serverConfiguration154.getLdapsPort() );
}
}
else if ( serverConfiguration instanceof ServerConfigurationV153 )
{
ServerConfigurationV153 serverConfiguration153 = ( ServerConfigurationV153 ) serverConfiguration;
if ( serverConfiguration153.isEnableLdap() )
{
connectionParameter.setEncryptionMethod( EncryptionMethod.NONE );
connectionParameter.setPort( serverConfiguration153.getLdapPort() );
}
else if ( serverConfiguration153.isEnableLdaps() )
{
connectionParameter.setEncryptionMethod( EncryptionMethod.LDAPS );
connectionParameter.setPort( serverConfiguration153.getLdapsPort() );
}
}
// Bind password
connectionParameter.setBindPassword( "secret" ); //$NON-NLS-1$
// Bind principal
connectionParameter.setBindPrincipal( "uid=admin,ou=system" ); //$NON-NLS-1$
// Host
connectionParameter.setHost( "localhost" ); //$NON-NLS-1$
// Name
connectionParameter.setName( serverName );
// Creating the connection
Connection connection = new Connection( connectionParameter );
// Adding the connection to the connection manager