gate.util.spring
Class GateResourceFactoryBean
java.lang.Object
gate.util.spring.GateAwareObject
gate.util.spring.GateResourceFactoryBean
- All Implemented Interfaces:
- org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean
public class GateResourceFactoryBean
- extends GateAwareObject
- implements org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.DisposableBean
Spring factory bean to create a GATE resource (LR, PR, controller).
Generally used via the gate:
extension namespace,
e.g.:
<gate:resource id="doc" scope="prototype"
resource-class="gate.corpora.DocumentImpl"
resource-name="News document">
<gate:parameters>
<entry key="sourceUrl">
<value type="org.springframework.core.io.Resource">resources/doc.xm</value>
</entry>
<entry key="preserveOriginalContent" value="true" />
</gate:parameters>
<gate:features>
<entry key="genre" value="news" />
</gate:features>
<gate:customisers>
<!-- optional list of ResourceCustomiser
s applied to the resource after creation -->
</gate:customisers>
</gate:resource>
The gate:parameters
and gate:features
elements are FeatureMaps giving the init-time parameters and features
for the resource respectively. Any Spring Resource values in these
maps are converted to URLs, so the rest of the GATE code does not
need to know about Spring. For details of how to declare the
gate
namespace, see Init
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GateResourceFactoryBean
public GateResourceFactoryBean()
getObject
public Object getObject()
throws Exception
- Create the resource specified by this bean.
- Specified by:
getObject
in interface org.springframework.beans.factory.FactoryBean
- Throws:
Exception
getObjectType
public Class getObjectType()
- Specified by:
getObjectType
in interface org.springframework.beans.factory.FactoryBean
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interface org.springframework.beans.factory.FactoryBean
destroy
public void destroy()
throws Exception
- Destroy the resource created by this bean, by passing it to
Factory.deleteResource(gate.Resource)
.
- Specified by:
destroy
in interface org.springframework.beans.factory.DisposableBean
- Throws:
Exception
setResourceClass
public void setResourceClass(String resourceClass)
setResourceName
public void setResourceName(String resourceName)
setParameters
public void setParameters(FeatureMap parameters)
setFeatures
public void setFeatures(FeatureMap features)
setCustomisers
public void setCustomisers(List<ResourceCustomiser> customisers)