|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gate.util.spring.SpringFactory
public class SpringFactory
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.
Constructor Summary | |
---|---|
SpringFactory()
|
Method Summary | |
---|---|
static FeatureMap |
createFeatureMap(Map sourceMap)
Creates a feature map from a source map. |
static Object |
loadObjectFromResource(org.springframework.core.io.Resource res)
Loads a saved application state (gapp file) from the given Spring resource. |
static URL |
resourceToUrl(org.springframework.core.io.Resource res)
Convert a Spring resource to a URL. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SpringFactory()
Method Detail |
---|
public static FeatureMap createFeatureMap(Map sourceMap) throws IOException
org.springframework.core.io.Resource
are converted to
their corresponding 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
FeatureMapFactoryBean
,
to which this method delegates.
IOException
public static Object loadObjectFromResource(org.springframework.core.io.Resource res) throws GateException, IOException
File
, and if
found the application is loaded using
loadObjectFromFile
. If the resource cannot be accessed as a file
it is accessed as a URL
and the application loaded with
loadObjectFromUrl
. This is useful as many PRs either require or function better with
file: URLs than with other kinds of URL. For an easier way to
achieve this, see SavedApplicationFactoryBean
, to which
this method delegates.
GateException
IOException
public static URL resourceToUrl(org.springframework.core.io.Resource res) throws IOException
File
, and if this succeeds then the file is converted
to a URL. If the resource cannot be accessed as a file then it is
converted directly to a URL. This is useful as many PRs either
require or function better with file: URLs than with other kinds of
URL. In a Spring configuration this method may be accessed using
the shorthand
<gate:url>WEB-INF/file.txt</gate:url>
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |