{
errors.clear();
}
// Work on a cloned and relaxed registries
Registries clonedRegistries = cloneRegistries();
clonedRegistries.setRelaxed();
// Load the schemas
for ( Schema schema : schemas )
{
unload( clonedRegistries, schema );
}
// Build the cross references
errors = clonedRegistries.buildReferences();
if ( errors.isEmpty() )
{
// Ok no errors. Check the registries now
errors = clonedRegistries.checkRefInteg();
if ( errors.isEmpty() )
{
// We are golden : let's apply the schema in the real registries
registries.setRelaxed();
// Load the schemas
for ( Schema schema : schemas )
{
unload( registries, schema );
// Update the schema dependences
for ( String dep : schema.getDependencies() )
{
Set<String> deps = schemaDependences.get( dep );
if ( deps != null )
{
deps.remove( schema.getSchemaName() );
}
}
schemaLoader.removeSchema( schema );
}
// Build the cross references
errors = registries.buildReferences();
registries.setStrict();
unloaded = true;
}
}
// clear the cloned registries
clonedRegistries.clear();
return unloaded;
}