// Get the SchemaName
String schemaName = getSchemaName( entry.getDn() );
// Get the Schema
Schema schema = schemaManager.getLoadedSchema( schemaName );
if ( schema.isDisabled() )
{
// The schema is disabled, nothing to do.
LOG.debug( "The Comparator {} cannot be deleted from the disabled schema {}", dn.getName(), schemaName );
return;
}
// Test that the Oid exists
LdapComparator<?> comparator = null;
try
{
comparator = ( LdapComparator<?> ) checkComparatorOidExists( entry );
}
catch ( LdapSchemaViolationException lsve )
{
// The comparator does not exist
comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), schemaName );
if ( schemaManager.getRegistries().contains( comparator ) )
{
// Remove the Comparator from the schema/SchemaObject Map
schemaManager.getRegistries().dissociateFromSchema( comparator );
// Ok, we can exit.
return;
}
else
{
// Ok, definitively an error
String msg = I18n.err( I18n.ERR_351, entry.getDn().getName() );
LOG.info( msg );
throw new LdapSchemaViolationException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg );
}
}
List<Throwable> errors = new ArrayList<Throwable>();
if ( schema.isEnabled() && comparator.isEnabled() )
{
if ( schemaManager.delete( comparator ) )
{
LOG.debug( "Deleted {} from the enabled schema {}", dn.getName(), schemaName );
}