/* 138 */ return units;
/* */ }
/* */
/* */ private static PersistenceMetadata parsePersistenceUnit(Element top, PersistenceUnitTransactionType defaultTransactionType) throws Exception
/* */ {
/* 143 */ PersistenceMetadata metadata = new PersistenceMetadata();
/* 144 */ String puName = top.getAttribute("name");
/* 145 */ if (StringHelper.isNotEmpty(puName)) {
/* 146 */ log.trace("Persistent Unit name from persistence.xml: " + puName);
/* 147 */ metadata.setName(puName);
/* */ }
/* 149 */ PersistenceUnitTransactionType transactionType = getTransactionType(top.getAttribute("transaction-type"));
/* */
/* 151 */ transactionType = transactionType != null ? transactionType : defaultTransactionType;
/* 152 */ metadata.setTransactionType(transactionType);
/* 153 */ NodeList children = top.getChildNodes();
/* 154 */ for (int i = 0; i < children.getLength(); i++) {
/* 155 */ if (children.item(i).getNodeType() == 1) {
/* 156 */ Element element = (Element)children.item(i);
/* 157 */ String tag = element.getTagName();
/* */
/* 164 */ if (tag.equals("non-jta-data-source")) {
/* 165 */ metadata.setNonJtaDatasource(XmlHelper.getElementContent(element));
/* */ }
/* 167 */ else if (tag.equals("jta-data-source")) {
/* 168 */ metadata.setJtaDatasource(XmlHelper.getElementContent(element));
/* */ }
/* 170 */ else if (tag.equals("provider")) {
/* 171 */ metadata.setProvider(XmlHelper.getElementContent(element));
/* */ }
/* 173 */ else if (tag.equals("class")) {
/* 174 */ metadata.getClasses().add(XmlHelper.getElementContent(element));
/* */ }
/* 176 */ else if (tag.equals("mapping-file")) {
/* 177 */ metadata.getMappingFiles().add(XmlHelper.getElementContent(element));
/* */ }
/* 179 */ else if (tag.equals("jar-file")) {
/* 180 */ metadata.getJarFiles().add(XmlHelper.getElementContent(element));
/* */ }
/* 182 */ else if (tag.equals("exclude-unlisted-classes")) {
/* 183 */ metadata.setExcludeUnlistedClasses(true);
/* */ }
/* 185 */ else if (tag.equals("properties")) {
/* 186 */ NodeList props = element.getChildNodes();
/* 187 */ for (int j = 0; j < props.getLength(); j++) {
/* 188 */ if (props.item(j).getNodeType() == 1) {
/* 189 */ Element propElement = (Element)props.item(j);
/* 190 */ if ("property".equals(propElement.getTagName())) {
/* 191 */ String propName = propElement.getAttribute("name").trim();
/* 192 */ String propValue = propElement.getAttribute("value").trim();
/* 193 */ if (StringHelper.isEmpty(propValue))
/* */ {
/* 195 */ propValue = XmlHelper.getElementContent(propElement, "");
/* */ }
/* 197 */ metadata.getProps().put(propName, propValue);
/* */ }
/* */ }
/* */ }
/* */ }
/* */ }