return createHabitat(name, createInhabitantsParser(h));
}
public Habitat createHabitat(String name, InhabitantsParser parser) throws ComponentException {
try {
Habitat habitat = parser.habitat;
for (final Module module : getModules())
parseInhabitants(module, name,parser);
populateConfig(habitat);
// default modules registry is the one that created the habitat
habitat.addIndex(new ExistingSingletonInhabitant<ModulesRegistry>(this),
ModulesRegistry.class.getName(), null);
habitats.put(name, habitat);
habitat.initialized();
return habitat;
} catch (Exception e) {
throw new ComponentException("Failed to create a habitat",e);
}