*
* @param fileName file name of the executor configuration
* @throws org.apache.axis2.AxisFault if an error occurs
*/
private void createPriorityConfiguration(String fileName) throws AxisFault {
OMElement definitions = null;
try {
FileInputStream fis = new FileInputStream(fileName);
definitions = new StAXOMBuilder(fis).getDocumentElement();
definitions.build();
} catch (FileNotFoundException e) {
handleException("Priority configuration file cannot be found : " + fileName, e);
} catch (XMLStreamException e) {
handleException("Error parsing priority configuration xml file " + fileName, e);
}
assert definitions != null;
OMElement executorElem = definitions.getFirstChildWithName(
new QName(ExecutorConstants.PRIORITY_EXECUTOR));
if (executorElem == null) {
handleException(ExecutorConstants.PRIORITY_EXECUTOR +
" configuration is mandatory for priority based routing");
}
executor = PriorityExecutorFactory.createExecutor(
null, executorElem, false, new Properties());
OMElement conditionsElem = definitions.getFirstChildWithName(
new QName(EvaluatorConstants.CONDITIONS));
if (conditionsElem == null) {
handleException("Conditions configuration is mandatory for priority based routing");
}
executor.init();
assert conditionsElem != null;
OMAttribute defPriorityAttr = conditionsElem.getAttribute(
new QName(EvaluatorConstants.DEFAULT_PRIORITY));
if (defPriorityAttr != null) {
parser = new Parser(Integer.parseInt(defPriorityAttr.getAttributeValue()));
} else {
parser = new Parser();