gate.util.spring.SpringFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gate-spring Show documentation
Show all versions of gate-spring Show documentation
Helper classes to support the use of GATE within the Spring framework
/*
* SpringFactory.java
*
* Copyright (c) 1995-2012, The University of Sheffield. See the file
* COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
*
* This file is part of GATE (see http://gate.ac.uk/), and is free
* software, licenced under the GNU Library General Public License,
* Version 2, June 1991 (in the distribution as file licence.html,
* and also available at http://gate.ac.uk/gate/licence.html).
*
* Ian Roberts, 07/Oct/2006
*
* $Id: SpringFactory.java 17656 2014-03-14 08:55:23Z markagreenwood $
*/
package gate.util.spring;
import gate.FeatureMap;
import gate.util.GateException;
import gate.util.persistence.PersistenceManager;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Map;
import org.springframework.core.io.Resource;
/**
* This class contains spring-aware factory methods for useful GATE
* components. Most of these methods have now been superseded by (and
* delegate their processing to) the specific factory beans in this
* package, but are retained for compatibility with existing
* configurations.
*/
public class SpringFactory {
/**
* Creates a feature map from a source map. Any values in the source
* map that are of type
* org.springframework.core.io.Resource
are converted to
* their corresponding {@link java.net.URL}. For example:
*
*
* <bean id="feature-map" class="gate.util.spring.SpringFactory"
* factory-method="createFeatureMap">
* <constructor-arg>
* <map>
* <entry key="inputASName" value="Extra" />
* <entry key="config">
* <value type="org.springframework.core.io.Resource">path/to/config.xml</value>
* </entry>
* </map>
* </constructor-arg>
* </bean>
*
*
* For an easier way to achieve this see {@link FeatureMapFactoryBean},
* to which this method delegates.
*/
public static FeatureMap createFeatureMap(Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy