List<PluginPropertyVO> result = new ArrayList<PluginPropertyVO>();
try {
Document doc = DocumentHelper.parseText(plugin.getConfigStructure());
for (Element e : (List<Element>)doc.getRootElement().elements()) {
if (e.getName().equals("param")) {
PluginPropertyVO p = new PluginPropertyVO();
if (e.attributeValue("name") == null) {
logger.error("There must be name attribute for param tag.");
continue;
}
if (e.attributeValue("type") == null) {
logger.error("There must be type attribute for param tag.");
continue;
}
p.setName(e.attributeValue("name"));
p.setType(e.attributeValue("type"));
p.setDefaultValue(e.attributeValue("value"));
if (e.attributeValue("title") == null) {
p.setTitle(p.getName());
}
else {
p.setTitle(e.attributeValue("title"));
}
result.add(p);
}
}
return result;