*/
private void loadScheduler(ApplicationConfiguration appConfig, Document dom,
Node root) throws XPathExpressionException {
XPath xpath = XPathFactory.newInstance().newXPath();
ThreadSchedulerConfiguration tsConfig = appConfig.getThreadSchedulerConfiguration();
Node ndScheduler = (Node) xpath.evaluate("scheduler", root,
XPathConstants.NODE);
if (ndScheduler == null) {
return;
}
// primary parameters
tsConfig.setActive(Val.chkBool(xpath.evaluate("@active", ndScheduler), false));
tsConfig.setCorePoolSize(Val.chkInt(xpath.evaluate("@corePoolSize",
ndScheduler), 0));
// threads
NodeList nlThreads = (NodeList) xpath.evaluate("thread", ndScheduler,
XPathConstants.NODESET);
for (int i = 0; i < nlThreads.getLength(); i++) {
Node ndThread = nlThreads.item(i);
String sClass = Val.chkStr(xpath.evaluate("@class", ndThread));
String sDelay = Val.chkStr(xpath.evaluate("@delay", ndThread));
String sPeriod = Val.chkStr(xpath.evaluate("@period", ndThread));
String sAt = Val.chkStr(xpath.evaluate("@at", ndThread));
// read parameters
StringAttributeMap parameters = new StringAttributeMap();
populateParameters(parameters, ndThread);
// add definition
tsConfig.addDefinition(sClass, sDelay, sPeriod, sAt, parameters);
}
}