// - pre-load the models
messages = this.loadIfNecessary(models);
for (final Iterator iterator = namespaces.iterator(); iterator.hasNext();)
{
final Namespace namespace = (Namespace)iterator.next();
final Cartridge cartridge = (Cartridge)cartridgesByNamespace.get(namespace.getName());
if (cartridge != null)
{
cartridgeName = cartridge.getNamespace();
if (this.shouldProcess(cartridgeName))
{
// - set the active namespace on the shared factory and profile instances
this.factory.setNamespace(cartridgeName);
cartridge.initialize();
// - process each model with the cartridge
for (int ctr = 0; ctr < models.length; ctr++)
{
final Model model = models[ctr];
// - set the namespace on the metafacades instance so we know the
// correct facades to use
this.factory.setModel(
this.repositories.getImplementation(repositoryName).getModel(),
model.getType());
cartridge.processModelElements(this.factory);
writer.writeHistory();
}
cartridge.shutdown();
}
}
}
}
}