|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgate.util.spring.Init
public class Init
Helper class to support GATE initialisation via Spring. The following is a typical XML fragment to initialise GATE.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gate="http://gate.ac.uk/ns/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://gate.ac.uk/ns/spring
http://gate.ac.uk/ns/spring.xsd">
<gate:init gate-home="path/to/GATE"
site-config-file="site/gate.xml"
user-config-file="user/gate.xml">
<gate:preload-plugins>
<value>plugins/ANNIE</value>
<value>http://plugins.org/another/plugin</value>
</gate:preload-plugins>
</gate:init>
Valid attributes are gate-home,
plugins-home, site-config-file,
user-config-file and builtin-creole-dir -
Spring Resources corresponding to the equivalent static
set methods of Gate. Also, preload-plugins
is a list of Resources that will be loaded as GATE
plugins after GATE is initialised.
As well as any plugins specified using preload-plugins,
we also scan the defining bean factory for any beans of type
ExtraGatePlugin, and load the plugins they refer to. This is
useful if bean definitions are provided in several separate files, or
if you are providing additional bean definitions to a context that
already defines an Init bean definition that you cannot edit.
The equivalent definition in "normal" Spring form (without the
gate: namespace) would be:
<bean class="gate.util.spring.Init"
init-method="init">
<property name="gateHome" value="path/to/GATE" />
<property name="siteConfigFile" value="site/gate.xml" />
<property name="userConfigFile" value="user/gate.xml" />
<property name="preloadPlugins">
<list>
<value>plugins/ANNIE</value>
<value>http://plugins.org/another/plugin</value>
</list>
</property>
</bean>
Note that when using this form the init-method="init" in the above
definition is vital. GATE will not work if it is omitted.
| Constructor Summary | |
|---|---|
Init()
|
|
| Method Summary | |
|---|---|
void |
init()
Initialises GATE and loads any preloadPlugins that have been specified, as well as any defined by ExtraGatePlugin beans
in the containing factory. |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
|
void |
setBuiltinCreoleDir(org.springframework.core.io.Resource builtinCreoleDir)
|
void |
setGateHome(org.springframework.core.io.Resource gateHome)
|
void |
setPluginsHome(org.springframework.core.io.Resource pluginsHome)
|
void |
setPreloadPlugins(List<org.springframework.core.io.Resource> plugins)
|
void |
setSiteConfigFile(org.springframework.core.io.Resource siteConfigFile)
|
void |
setUserConfigFile(org.springframework.core.io.Resource userConfigFile)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Init()
| Method Detail |
|---|
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
public void setGateHome(org.springframework.core.io.Resource gateHome)
throws IOException
IOException
public void setPluginsHome(org.springframework.core.io.Resource pluginsHome)
throws IOException
IOException
public void setSiteConfigFile(org.springframework.core.io.Resource siteConfigFile)
throws IOException
IOException
public void setUserConfigFile(org.springframework.core.io.Resource userConfigFile)
throws IOException
IOException
public void setBuiltinCreoleDir(org.springframework.core.io.Resource builtinCreoleDir)
throws IOException
IOExceptionpublic void setPreloadPlugins(List<org.springframework.core.io.Resource> plugins)
public void init()
throws Exception
ExtraGatePlugin beans
in the containing factory.
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||