public class ScaServiceBeanDefinitionParser implements BeanDefinitionParser {
public BeanDefinition parse(Element element, ParserContext parserContext) {
BeanDefinitionRegistry registry = parserContext.getRegistry();
if (registry instanceof SCAGenericApplicationContext) {
SCAGenericApplicationContext context = (SCAGenericApplicationContext)registry;
SpringSCAServiceElement serviceElement =
new SpringSCAServiceElement(getAttribute(element, "name"), getAttribute(element, "target"));
serviceElement.setType(getAttribute(element, "type"));
String requires = getAttribute(element, "requires");
if (requires != null) {
List<QName> qnames = ScaNamespaceHandler.resolve(element, requires);
serviceElement.getIntentNames().addAll(qnames);
}
String policySets = getAttribute(element, "policySets");
if (policySets != null) {
List<QName> qnames = ScaNamespaceHandler.resolve(element, policySets);
serviceElement.getPolicySetNames().addAll(qnames);
}
context.addSCAServiceElement(serviceElement);
}
// do nothing, handled by Tuscany
return null;
}