if(catalogConfig == null)
return null;
CatalogFactory catalogFactory = getInstance();
assert catalogFactory != null;
Catalog catalog = new CatalogBase();
List chainConfigs = catalogConfig.getCommands();
for(int i = 0; i < chainConfigs.size(); i++) {
CommandConfig commandConfig = (CommandConfig)chainConfigs.get(i);
assert commandConfig != null;
if(commandConfig instanceof ChainConfig) {
ChainConfig chainConfig = (ChainConfig)commandConfig;
Chain chain = new ChainBase();
List commandConfigs = chainConfig.getCommands();
for(int j = 0; j < commandConfigs.size(); j++) {
CommandConfig chainCommandConfig = (CommandConfig)commandConfigs.get(j);
Command command = createCommand(chainCommandConfig);
chain.addCommand(command);
}
catalog.addCommand(chainConfig.getName(), chain);
}
else {
Command command = createCommand(commandConfig);
catalog.addCommand(commandConfig.getId(), command);
}
}
catalogFactory.setCatalog(catalog);
return catalogFactory;
}