* @param elem the OMElement that specifies the Spring mediator configuration
* @return the Spring mediator instance created
*/
public Mediator createMediator(OMElement elem) {
SpringMediator sm = new SpringMediator();
OMAttribute bean = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "bean"));
OMAttribute cfg = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "config"));
OMAttribute src = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "src"));
if (bean == null) {
handleException("The 'bean' attribute is required for a Spring mediator definition");
} else if (cfg == null && src == null) {
handleException("A 'config' or 'src' attribute is required for a Spring mediator definition");
} else {
sm.setBeanName(bean.getAttributeValue());
if (cfg != null) {
log.debug("Creating a Spring mediator using configuration named : " + cfg.getAttributeValue());
sm.setConfigName(cfg.getAttributeValue());
} else {
log.debug("Creating an inline Spring configuration using source : " + src.getAttributeValue());
SpringConfigExtension sce = new SpringConfigExtension("inline", src.getAttributeValue());
sm.setAppContext(sce.getAppContext());
}
return sm;
}
return null;
}