.attribute( ServerXmlIOV156.ATTRIBUTE_ALLOW_ANONYMOUS_ACCESS );
if ( allowAnonymousAccessAttribute == null )
{
// If the 'allowAnonymousAccess' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV156.ErrorAllowAnonymousAccess" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setAllowAnonymousAccess( parseBoolean( allowAnonymousAccessAttribute.getValue() ) );
}
// SaslHost
org.dom4j.Attribute saslHostAttribute = ldapServerElement.attribute( ServerXmlIOV156.ATTRIBUTE_SASL_HOST );
if ( saslHostAttribute == null )
{
// If the 'saslHost' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV156.ErrorSaslHost" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setSaslHost( saslHostAttribute.getValue() );
}
// SaslPrincipal
org.dom4j.Attribute saslPrincipalAttribute = ldapServerElement
.attribute( ServerXmlIOV156.ATTRIBUTE_SASL_PRINCIPAL );
if ( saslPrincipalAttribute == null )
{
// If the 'saslPrincipal' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV156.ErrorSaslPrincipal" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setSaslPrincipal( saslPrincipalAttribute.getValue() );
}
// SearchBaseDn
org.dom4j.Attribute searchBaseDnAttribute = ldapServerElement
.attribute( ServerXmlIOV156.ATTRIBUTE_SEARCH_BASE_DN );
if ( searchBaseDnAttribute == null )
{
// If the 'searchBaseDn' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV156.ErrorSearchBaseDn" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setSearchBaseDn( searchBaseDnAttribute.getValue() );
}
// MaxTimeLimit
org.dom4j.Attribute maxTimeLimitAttribute = ldapServerElement
.attribute( ServerXmlIOV156.ATTRIBUTE_MAX_TIME_LIMIT );
if ( maxTimeLimitAttribute == null )
{
// If the 'maxTimeLimit' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV156.ErrorMaxTimeLimit" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setMaxTimeLimit( Integer.parseInt( maxTimeLimitAttribute.getValue() ) );
}
// MaxSizeLimit
org.dom4j.Attribute maxSizeLimitAttribute = ldapServerElement
.attribute( ServerXmlIOV156.ATTRIBUTE_MAX_SIZE_LIMIT );
if ( maxSizeLimitAttribute == null )
{
// If the 'maxSizeLimit' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV156.ErrorMaxSizeLimit" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setMaxSizeLimit( Integer.parseInt( maxSizeLimitAttribute.getValue() ) );
}
// Getting the 'transports' element
Element transportsElement = ldapServerElement.element( ServerXmlIOV156.ELEMENT_TRANSPORTS );
if ( transportsElement != null )
{
// Looping on all 'tcpTransport' elements
for ( Iterator<?> iterator = transportsElement.elementIterator( ServerXmlIOV156.ELEMENT_TCP_TRANSPORT ); iterator
.hasNext(); )
{
// Getting the 'tcpTransport' element
Element tcpTransportElement = ( Element ) iterator.next();
// Getting the 'port' attribute
org.dom4j.Attribute portAttribute = tcpTransportElement.attribute( ServerXmlIOV156.ATTRIBUTE_PORT );
if ( portAttribute == null )
{
// If the 'port' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV156.ErrorLdapServerPort" ) ); //$NON-NLS-1$
}
// Getting the 'enableSSL' attribute
boolean enableSsl = false;
org.dom4j.Attribute enableSslAttribut = tcpTransportElement
.attribute( ServerXmlIOV156.ATTRIBUTE_ENABLESSL );
if ( enableSslAttribut != null )
{
enableSsl = parseBoolean( enableSslAttribut.getValue() );
}
// Enabling the right protocol
if ( enableSsl )
{
serverConfiguration.setEnableLdaps( true );
serverConfiguration.setLdapsPort( Integer.parseInt( portAttribute.getValue() ) );
}
else
{
serverConfiguration.setEnableLdap( true );
serverConfiguration.setLdapPort( Integer.parseInt( portAttribute.getValue() ) );
}
}
}
else
{
// If the 'transports' element does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV156.ErrorLdapServerPort" ) ); //$NON-NLS-1$
}
// Supported Mechanisms
Element supportedMechanismsElement = ldapServerElement
.element( ServerXmlIOV156.ELEMENT_SASL_MECHANISM_HANDLERS );