org.dom4j.Attribute idAttribute = ldapServerElement.attribute( ServerXmlIOV152.ATTRIBUTE_ID );
if ( idAttribute == null )
{
// If the 'id' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV152.ErrorLdapServerId" ) ); //$NON-NLS-1$
}
else
{
// Checking if the 'ldapServer' element is the one for LDAP
if ( ServerXmlIOV152.ELEMENT_LDAP_SERVER.equalsIgnoreCase( idAttribute.getValue() ) )
{
// Getting the 'enabled' attribute
org.dom4j.Attribute enabledAttribute = ldapServerElement
.attribute( ServerXmlIOV152.ATTRIBUTE_ENABLED );
if ( enabledAttribute == null )
{
// By default, the protocol is enabled
serverConfiguration.setEnableLdap( true );
}
else
{
serverConfiguration.setEnableLdap( parseBoolean( enabledAttribute.getValue() ) );
}
// IpPort
org.dom4j.Attribute ipPortAttribute = ldapServerElement
.attribute( ServerXmlIOV152.ATTRIBUTE_IP_PORT );
if ( ipPortAttribute == null )
{
// If the 'ipPort' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV152.ErrorLdapServerPort" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setLdapPort( Integer.parseInt( ipPortAttribute.getValue() ) );
}
// Allow Anonymous Access
org.dom4j.Attribute allowAnonymousAccessAttribute = ldapServerElement
.attribute( ServerXmlIOV152.ATTRIBUTE_ALLOW_ANONYMOUS_ACCESS );
if ( allowAnonymousAccessAttribute == null )
{
// If the 'allowAnonymousAccess' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException(
Messages.getString( "ServerXmlIOV152.ErrorAllowAnonymousAccess" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setAllowAnonymousAccess( parseBoolean( allowAnonymousAccessAttribute
.getValue() ) );
}
// SaslHost
org.dom4j.Attribute saslHostAttribute = ldapServerElement
.attribute( ServerXmlIOV152.ATTRIBUTE_SASL_HOST );
if ( saslHostAttribute == null )
{
// If the 'saslHost' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV152.ErrorSaslHost" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setSaslHost( saslHostAttribute.getValue() );
}
// SaslPrincipal
org.dom4j.Attribute saslPrincipalAttribute = ldapServerElement
.attribute( ServerXmlIOV152.ATTRIBUTE_SASL_PRINCIPAL );
if ( saslPrincipalAttribute == null )
{
// If the 'saslPrincipal' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV152.ErrorSaslPrincipal" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setSaslPrincipal( saslPrincipalAttribute.getValue() );
}
// SearchBaseDn
org.dom4j.Attribute searchBaseDnAttribute = ldapServerElement
.attribute( ServerXmlIOV152.ATTRIBUTE_SEARCH_BASE_DN );
if ( searchBaseDnAttribute == null )
{
// If the 'searchBaseDn' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV152.ErrorSearchBaseDn" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setSearchBaseDn( searchBaseDnAttribute.getValue() );
}
// MaxTimeLimit
org.dom4j.Attribute maxTimeLimitAttribute = ldapServerElement
.attribute( ServerXmlIOV152.ATTRIBUTE_MAX_TIME_LIMIT );
if ( maxTimeLimitAttribute == null )
{
// If the 'maxTimeLimit' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV152.ErrorMaxTimeLimit" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setMaxTimeLimit( Integer.parseInt( maxTimeLimitAttribute.getValue() ) );
}
// MaxSizeLimit
org.dom4j.Attribute maxSizeLimitAttribute = ldapServerElement
.attribute( ServerXmlIOV152.ATTRIBUTE_MAX_SIZE_LIMIT );
if ( maxSizeLimitAttribute == null )
{
// If the 'maxSizeLimit' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( Messages.getString( "ServerXmlIOV152.ErrorMaxSizeLimit" ) ); //$NON-NLS-1$
}
else
{
serverConfiguration.setMaxSizeLimit( Integer.parseInt( maxSizeLimitAttribute.getValue() ) );
}