DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = builder.parse(in);
Node root = document.getDocumentElement();
if("configuration".equals(root.getNodeName())) {
Configuration conf = new Configuration(file.getName().substring(0, file.getName().indexOf(".")));
NodeList nodes = root.getChildNodes();
for(int i=0; i<nodes.getLength(); i++) {
if(nodes.item(i).getNodeType() == Node.ELEMENT_NODE) {
if("entity".equals(nodes.item(i).getNodeName())) {
conf.setEntity(parseEntity(nodes.item(i)));
} else if("join".equals(nodes.item(i).getNodeName())) {
conf.getJoins().add(parseJoin(nodes.item(i)));
} else if("restriction".equals(nodes.item(i).getNodeName())) {
conf.getRestrictions().add(parseRestriction(nodes.item(i)));
} else if("property".equals(nodes.item(i).getNodeName())) {
Property property = parseProperty(conf, nodes.item(i));
if(property.isId()) {
if(conf.getId() == null) {
conf.setId(property);
} else {
throw new TableEngineException("found duplicate id property");
}
}
property.setAlias("alias_"+conf.getProperties().size());
property.setPosition(conf.getProperties().size());
conf.getProperties().add(property);
}
}
}
if(log.isDebugEnabled())
log.debug("add list renderer: "+conf.getName());
engines.put(conf.getName(), new TableEngine(conf));
} else {
throw new TableEngineException("invalid attribute found: '"+root.getNodeName()+"' (need: 'configuration')");
}
} catch(Exception e) {
if(in != null) {