nsContext.addNamespace(NAMESPACE_PREFIX,
root.getNamespaceURI());
// Grab the message-store element to allow extraction of the
// various attributes
XPath xpath = new JDOMXPath("//" +
NAMESPACE_PREFIX + ":" +
MSS_CONFIG_MESSAGESTORE_ELEMENT);
xpath.setNamespaceContext(nsContext);
Element element = (Element) xpath.selectSingleNode(root);
// Location
config.setLocation(element.getAttributeValue(
MSS_CONFIG_LOCATION_ATTRIBUTE));
// ID Size
config.setIdSize(Integer.parseInt(element.getAttributeValue(
MSS_CONFIG_IDSIZE_ATTRIBUTE)));
// Timeout
String timeout = element.getAttributeValue(
MSS_CONFIG_TIMEOUT_ATTRIBUTE);
if (timeout.equalsIgnoreCase(UNLIMITED)) {
config.setUnlimitedTimeout(true);
} else {
config.setTimeout(Integer.parseInt(timeout));
}
// Validation
String validate = element.getAttributeValue(
MSS_CONFIG_VALIDATE_ATTRIBUTE);
config.setValidate(validate.equals("true"));
// Get the environment element and extract the log4j attribute
xpath = new JDOMXPath("//" +
NAMESPACE_PREFIX + ":" +
MSS_CONFIG_ENVIRONMENT_ELEMENT);
xpath.setNamespaceContext(nsContext);
element = (Element) xpath.selectSingleNode(root);
config.setLog4jConfigurationFile(
element.getAttributeValue(MSS_CONFIG_LOG4J_ATTRIBUTE));
} else {
handleConfigError(null);
}