*/
public class FeatureServiceHandlerParser extends AbstractBeanDefinitionParser {
@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
BeanDefinitionBuilder factoryBuilder = BeanDefinitionBuilder.rootBeanDefinition(FeatureServiceDirectFactory.class);
RootBeanDefinition factoryBean = (RootBeanDefinition) factoryBuilder.getBeanDefinition();
parserContext.getRegistry().registerBeanDefinition(FlipSpringAspect.FEATURE_SERVICE_FACTORY_BEAN_NAME, factoryBean);
MutablePropertyValues factoryPropertyValues = new MutablePropertyValues();
factoryBean.setPropertyValues(factoryPropertyValues);
String environmentBean = element.getAttribute("environment");
if (environmentBean != null && !environmentBean.isEmpty()) {
factoryPropertyValues.addPropertyValue("environment", new RuntimeBeanNameReference(environmentBean));
}
Element contextProvidersElement = DomUtils.getChildElementByTagName(element, "context-providers");
if (contextProvidersElement != null) {
List contextProvidersList = parserContext.getDelegate().parseListElement(contextProvidersElement, factoryBean);
if (contextProvidersList != null && !contextProvidersList.isEmpty()) {
factoryPropertyValues.addPropertyValue("contextProviders", contextProvidersList);
}
}
Element propertyReadersElement = DomUtils.getChildElementByTagName(element, "property-readers");
if (propertyReadersElement != null && propertyReadersElement.hasChildNodes()) {
List propertyReadersList = parserContext.getDelegate().parseListElement(propertyReadersElement, factoryBean);
if (propertyReadersList != null && !propertyReadersList.isEmpty()) {
factoryPropertyValues.addPropertyValue("propertyReaders", propertyReadersList);
}
}
Element propertiesElement = DomUtils.getChildElementByTagName(element, "properties");
if (propertiesElement != null && propertiesElement.hasChildNodes()) {
Properties properties = parserContext.getDelegate().parsePropsElement(propertiesElement);
if (properties != null && !properties.isEmpty()) {
factoryPropertyValues.addPropertyValue("properties", properties);
}
}
BeanDefinitionBuilder featureServiceBuilder = BeanDefinitionBuilder.genericBeanDefinition();
BeanDefinition featureServiceRawBean = featureServiceBuilder.getRawBeanDefinition();
featureServiceRawBean.setFactoryBeanName(FlipSpringAspect.FEATURE_SERVICE_FACTORY_BEAN_NAME);
featureServiceRawBean.setFactoryMethodName("createFeatureService");
parserContext.getRegistry().registerBeanDefinition(FlipSpringAspect.FEATURE_SERVICE_BEAN_NAME, featureServiceBuilder.getBeanDefinition());
return null;
}