01 /*
02 * SavedApplicationBeanDefinitionParser.java
03 *
04 * Copyright (c) 1995-2010, The University of Sheffield. See the file
05 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
06 *
07 * This file is part of GATE (see http://gate.ac.uk/), and is free
08 * software, licenced under the GNU Library General Public License,
09 * Version 2, June 1991 (in the distribution as file licence.html,
10 * and also available at http://gate.ac.uk/gate/licence.html).
11 *
12 * Ian Roberts, 22/Jan/2008
13 *
14 * $Id: SavedApplicationBeanDefinitionParser.java 12006 2009-12-01 17:24:28Z thomas_heitz $
15 */
16
17 package gate.util.spring.xml;
18
19 import gate.util.spring.SavedApplicationFactoryBean;
20
21 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
22 import org.springframework.beans.factory.xml.ParserContext;
23 import org.w3c.dom.Element;
24
25 /**
26 * BeanDefinitionParser for <code><gate:saved-application></code>,
27 * producing a definition for a {@link SavedApplicationFactoryBean}.
28 */
29 public class SavedApplicationBeanDefinitionParser
30 extends
31 CustomisableBeanDefinitionParser {
32 @Override
33 protected void doParse(Element element, ParserContext parserContext,
34 BeanDefinitionBuilder builder) {
35 if(element.hasAttribute("scope")) {
36 builder.setScope(element.getAttribute("scope"));
37 }
38
39 builder.addPropertyValue("location", element.getAttribute("location"));
40
41 extractCustomisers(element, parserContext, builder);
42 }
43
44 @Override
45 protected Class getBeanClass(Element element) {
46 return SavedApplicationFactoryBean.class;
47 }
48
49 }
|