All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gate.util.spring.xml.ExtraGatePluginBeanDefinitionParser Maven / Gradle / Ivy

The newest version!
package gate.util.spring.xml;

import gate.util.spring.ExtraGatePlugin;
import gate.util.spring.Init;

import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;

/**
 * Bean definition parser for
 * <gate:extra-plugin>path</gate:extra-plugin>
 * producing the equivalent of
 * 
 * 
 * <bean class="gate.util.spring.ExtraGatePlugin">
 *   <property name="location" value="path" />
 * </bean>
 * 
* * Or for a Maven-style plugin <gate:extra-plugin * group-id="uk.ac.gate.plugins" artifact-id="annie" version="8.5" /> * * While the element can take an id it is not normally * necessary to provide one as the {@link Init} bean enumerates all * {@link ExtraGatePlugin} beans by type, ignoring their IDs. */ public class ExtraGatePluginBeanDefinitionParser extends AbstractSimpleBeanDefinitionParser { @Override protected void postProcess(BeanDefinitionBuilder builder, Element element) { String location = DomUtils.getTextValue(element); if(location != null && !"".equals(location)) { builder.addPropertyValue("location", location); } } @Override protected Class getBeanClass(Element element) { return ExtraGatePlugin.class; } @Override protected boolean shouldGenerateIdAsFallback() { return true; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy