continue;
}
Element policy = (Element)node;
if ("policy".equalsIgnoreCase(policy.getTagName())) {
String policyName = policy.getAttribute("name");
PolicyInfo curr = new PolicyInfo(policyName, conf);
PolicyInfo parent = null;
NodeList policyElements = policy.getChildNodes();
PolicyInfo policyInfo = null;
for (int j = 0; j < policyElements.getLength(); j++) {
Node node1 = policyElements.item(j);
if (!(node1 instanceof Element)) {
continue;
}
Element property = (Element) node1;
String propertyName = property.getTagName();
if ("srcPath".equalsIgnoreCase(propertyName)) {
String srcPathPrefix = property.getAttribute("prefix");
if (srcPathPrefix != null && srcPathPrefix.length() > 0) {
curr.setSrcPath(srcPathPrefix);
}
} else if ("fileList".equalsIgnoreCase(propertyName)) {
String text = ((Text)property.getFirstChild()).getData().trim();
LOG.info(policyName + ".fileList = " + text);
curr.setFileListPath(new Path(text));
} else if ("codecId".equalsIgnoreCase(propertyName)) {
String text = ((Text)property.getFirstChild()).getData().trim();
LOG.info(policyName + ".codecId = " + text);
curr.setCodecId(text);
} else if ("shouldRaid".equalsIgnoreCase(propertyName)) {
String text = ((Text)property.getFirstChild()).getData().trim();
curr.setShouldRaid(Boolean.parseBoolean(text));
} else if ("description".equalsIgnoreCase(propertyName)) {
String text = ((Text)property.getFirstChild()).getData().trim();
curr.setDescription(text);
} else if ("parentPolicy".equalsIgnoreCase(propertyName)) {
String text = ((Text)property.getFirstChild()).getData().trim();
parent = existingPolicies.get(text);
} else if ("property".equalsIgnoreCase(propertyName)) {
NodeList nl = property.getChildNodes();
String pname=null,pvalue=null;
for (int l = 0; l < nl.getLength(); l++){
Node node3 = nl.item(l);
if (!(node3 instanceof Element)) {
continue;
}
Element item = (Element) node3;
String itemName = item.getTagName();
if ("name".equalsIgnoreCase(itemName)){
pname = ((Text)item.getFirstChild()).getData().trim();
} else if ("value".equalsIgnoreCase(itemName)){
pvalue = ((Text)item.getFirstChild()).getData().trim();
}
}
if (pname != null && pvalue != null) {
LOG.info(policyName + "." + pname + " = " + pvalue);
curr.setProperty(pname,pvalue);
}
} else {
LOG.info("Found bad property " + propertyName +
" policy name " + policyName +
". Ignoring.");
}
} // done with all properties of this policy
PolicyInfo pinfo;
if (parent != null) {
pinfo = new PolicyInfo(policyName, conf);
pinfo.copyFrom(parent);
pinfo.copyFrom(curr);
} else {
pinfo = curr;
}
if (pinfo.getSrcPath() != null || pinfo.getFileListPath() != null) {
all.add(pinfo);
}
existingPolicies.put(policyName, pinfo);
}
}