private void checkNewParent( DN newParent ) throws NamingException
{
if ( newParent.size() != 3 )
{
throw new LdapInvalidNameException(
"The parent dn of a objectClass should be at most 3 name components in length.",
ResultCodeEnum.NAMING_VIOLATION );
}
RDN rdn = newParent.getRdn();
if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
SchemaConstants.OU_AT_OID ) )
{
throw new LdapInvalidNameException( I18n.err( I18n.ERR_376 ),
ResultCodeEnum.NAMING_VIOLATION );
}
if ( !( ( String ) rdn.getNormValue() ).equalsIgnoreCase( SchemaConstants.OBJECT_CLASSES_AT ) )
{
throw new LdapInvalidNameException( I18n.err( I18n.ERR_377 ),
ResultCodeEnum.NAMING_VIOLATION );
}
}