private static void parsePersistenceManagerElements(
final Element root,
final PersistenceDefinition definition) {
for (Iterator it1 = root.elementIterator("persistence-manager"); it1.hasNext();) {
PersistenceManagerDefinition pmDef = new PersistenceManagerDefinition();
final Element pm = (Element)it1.next();
for (Iterator it2 = pm.attributeIterator(); it2.hasNext();) {
Attribute attribute = (Attribute)it2.next();
String name = attribute.getName().trim();
String value = attribute.getValue().trim();
if (name.equals("class")) {
pmDef.setClassName(value);
}
else if (name.equals("active")) {
pmDef.setActive(value);
}
}
for (Iterator it2 = pm.elementIterator(); it2.hasNext();) {
Element nestedAdviceElement = (Element)it2.next();
if (nestedAdviceElement.getName().trim().equals("index-ref")) {
IndexRefDefinition indexDef = new IndexRefDefinition();
indexDef.setName(nestedAdviceElement.attributeValue("name"));
pmDef.addIndexRef(indexDef);
}
else if (nestedAdviceElement.getName().trim().equals("param")) {
ParameterDefinition paramDef = new ParameterDefinition();
paramDef.setName(nestedAdviceElement.attributeValue("name"));
paramDef.setValue(nestedAdviceElement.getText());
pmDef.addParameter(paramDef);
}
}
definition.addPersistenceManager(pmDef);
}