public class ScaReferenceBeanDefinitionParser implements BeanDefinitionParser {
public BeanDefinition parse(Element element, ParserContext parserContext) {
BeanDefinitionRegistry registry = parserContext.getRegistry();
if (registry instanceof SCAGenericApplicationContext) {
SCAGenericApplicationContext context = (SCAGenericApplicationContext)registry;
SpringSCAReferenceElement referenceElement =
new SpringSCAReferenceElement(getAttribute(element, "name"), getAttribute(element, "type"));
referenceElement.setDefaultBean(getAttribute(element, "default"));
String requires = getAttribute(element, "requires");
if (requires != null) {
List<QName> qnames = ScaNamespaceHandler.resolve(element, requires);
referenceElement.getIntentNames().addAll(qnames);
}
String policySets = getAttribute(element, "policySets");
if (policySets != null) {
List<QName> qnames = ScaNamespaceHandler.resolve(element, policySets);
referenceElement.getPolicySetNames().addAll(qnames);
}
context.addSCAReferenceElement(referenceElement);
}
// do nothing, this is handled by Tuscany
return null;
}