* Creates a Message processor instance from given xml configuration element
* @param elem OMElement of that contain the Message processor configuration
* @return created message processor instance
*/
public static MessageProcessor createMessageProcessor(OMElement elem) {
MessageProcessor processor = null;
OMAttribute clssAtt = elem.getAttribute(CLASS_Q);
if(clssAtt != null) {
try {
Class cls = Class.forName(clssAtt.getAttributeValue());
processor = (MessageProcessor) cls.newInstance();
} catch (Exception e) {
handleException("Error while creating Message processor " + e.getMessage());
}
} else {
/**We throw Exception since there is not default processor*/
handleException("Can't create Message processor without a provider class");
}
OMAttribute nameAtt = elem.getAttribute(NAME_Q);
if (nameAtt != null) {
assert processor != null;
processor.setName(nameAtt.getAttributeValue());
} else {
handleException("Can't create Message processor without a name ");
}
OMAttribute storeAtt = elem.getAttribute(MESSAGE_STORE_Q);
if(storeAtt != null) {
assert processor != null;
processor.setMessageStoreName(storeAtt.getAttributeValue());
} else {
handleException("Can't create a message processor with out a message Store");
}
OMElement descriptionElem = elem.getFirstChildWithName(DESCRIPTION_Q);
if (descriptionElem != null) {
assert processor != null;
processor.setDescription(descriptionElem.getText());
}
assert processor != null;
processor.setParameters(getParameters(elem));
return processor;
}