private void checkNewParent( LdapDN newParent ) throws NamingException
{
if ( newParent.size() != 3 )
{
throw new LdapInvalidNameException(
"The parent dn of a attributeType should be at most 3 name components in length.",
ResultCodeEnum.NAMING_VIOLATION );
}
Rdn rdn = newParent.getRdn();
if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
{
throw new LdapInvalidNameException( "The parent entry of a attributeType should be an organizationalUnit.",
ResultCodeEnum.NAMING_VIOLATION );
}
if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.ATTRIBUTE_TYPES_AT ) )
{
throw new LdapInvalidNameException(
"The parent entry of a attributeType should have a relative name of ou=attributeTypes.",
ResultCodeEnum.NAMING_VIOLATION );
}
}