org.dom4j.Attribute idAttribute = ldapServerElement.attribute( ServerXmlIOV153.ATTRIBUTE_ID );
if ( idAttribute == null )
{
// If the 'id' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException( "Unable to find the 'id' attribute for the 'ldapServer' bean." );
}
else
{
// Checking if the 'ldapServer' element is the one for LDAP
if ( ServerXmlIOV153.ELEMENT_LDAP_SERVER.equalsIgnoreCase( idAttribute.getValue() ) )
{
// Getting the 'enabled' attribute
org.dom4j.Attribute enabledAttribute = ldapServerElement
.attribute( ServerXmlIOV153.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( ServerXmlIOV153.ATTRIBUTE_IP_PORT );
if ( ipPortAttribute == null )
{
// If the 'ipPort' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException(
"Unable to find the 'ipPort' attribute for the 'ldapServer' bean." );
}
else
{
serverConfiguration.setLdapPort( Integer.parseInt( ipPortAttribute.getValue() ) );
}
// Allow Anonymous Access
org.dom4j.Attribute allowAnonymousAccessAttribute = ldapServerElement
.attribute( ServerXmlIOV153.ATTRIBUTE_ALLOW_ANONYMOUS_ACCESS );
if ( allowAnonymousAccessAttribute == null )
{
// If the 'allowAnonymousAccess' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException(
"Unable to find the 'allowAnonymousAccess' attribute for the 'ldapServer' bean." );
}
else
{
serverConfiguration.setAllowAnonymousAccess( parseBoolean( allowAnonymousAccessAttribute
.getValue() ) );
}
// SaslHost
org.dom4j.Attribute saslHostAttribute = ldapServerElement
.attribute( ServerXmlIOV153.ATTRIBUTE_SASL_HOST );
if ( saslHostAttribute == null )
{
// If the 'saslHost' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException(
"Unable to find the 'saslHost' attribute for the 'ldapServer' bean." );
}
else
{
serverConfiguration.setSaslHost( saslHostAttribute.getValue() );
}
// SaslPrincipal
org.dom4j.Attribute saslPrincipalAttribute = ldapServerElement
.attribute( ServerXmlIOV153.ATTRIBUTE_SASL_PRINCIPAL );
if ( saslPrincipalAttribute == null )
{
// If the 'saslPrincipal' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException(
"Unable to find the 'saslPrincipal' attribute for the 'ldapServer' bean." );
}
else
{
serverConfiguration.setSaslPrincipal( saslPrincipalAttribute.getValue() );
}
// SearchBaseDn
org.dom4j.Attribute searchBaseDnAttribute = ldapServerElement
.attribute( ServerXmlIOV153.ATTRIBUTE_SEARCH_BASE_DN );
if ( searchBaseDnAttribute == null )
{
// If the 'searchBaseDn' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException(
"Unable to find the 'searchBaseDn' attribute for the 'ldapServer' bean." );
}
else
{
serverConfiguration.setSearchBaseDn( searchBaseDnAttribute.getValue() );
}
// MaxTimeLimit
org.dom4j.Attribute maxTimeLimitAttribute = ldapServerElement
.attribute( ServerXmlIOV153.ATTRIBUTE_MAX_TIME_LIMIT );
if ( maxTimeLimitAttribute == null )
{
// If the 'maxTimeLimit' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException(
"Unable to find the 'maxTimeLimit' attribute for the 'ldapServer' bean." );
}
else
{
serverConfiguration.setMaxTimeLimit( Integer.parseInt( maxTimeLimitAttribute.getValue() ) );
}
// MaxSizeLimit
org.dom4j.Attribute maxSizeLimitAttribute = ldapServerElement
.attribute( ServerXmlIOV153.ATTRIBUTE_MAX_SIZE_LIMIT );
if ( maxSizeLimitAttribute == null )
{
// If the 'maxSizeLimit' attribute does not exists,
// we throw an exception
throw new ServerXmlIOException(
"Unable to find the 'maxSizeLimit' attribute for the 'ldapServer' bean." );
}
else
{
serverConfiguration.setMaxSizeLimit( Integer.parseInt( maxSizeLimitAttribute.getValue() ) );