private boolean disableSchema( String schemaName ) throws Exception
{
// First check that the schema is not already disabled
Map<String, Schema> schemas = globalRegistries.getLoadedSchemas();
Schema schema = schemas.get( schemaName );
if ( ( schema == null ) || schema.isDisabled() )
{
// The schema is disabled, do nothing
return SCHEMA_UNCHANGED;
}
Set<String> dependents = loader.listEnabledDependentSchemaNames( schemaName );
if ( ! dependents.isEmpty() )
{
throw new LdapOperationNotSupportedException(
"Cannot disable schema with enabled dependents: " + dependents,
ResultCodeEnum.UNWILLING_TO_PERFORM );
}
schema.disable();
globalRegistries.unload( schemaName );
return SCHEMA_MODIFIED;
}