return catalogConfig;
}
private static CatalogConfig parseCatalog(Element catalogElement) {
CatalogConfig catalogConfig = null;
if(catalogElement != null && catalogElement.hasChildNodes()) {
catalogConfig = new CatalogConfig();
NodeList nodeList = catalogElement.getChildNodes();
if(nodeList != null) {
for(int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if(!(node.getNodeType() == Node.ELEMENT_NODE))
continue;
if(node.getNodeName().equals("chain")) {
Element element = (Element)node;
String name = element.getAttribute("name");
ChainConfig chainConfig = new ChainConfig();
chainConfig.setName(name);
NodeList commandList = element.getElementsByTagName("command");
if(commandList != null) {
for(int j = 0; j < commandList.getLength(); j++) {
Element commandElement = (Element)commandList.item(j);
CommandConfig commandConfig = parseCommand(commandElement);
chainConfig.addCommand(commandConfig);
}
}
catalogConfig.addCommand(chainConfig);
}
else if(node.getNodeName().equals("command")) {
Element element = (Element)node;
CommandConfig commandConfig = parseCommand(element);
catalogConfig.addCommand(commandConfig);
}
}
}
}