public class GateResourceFactoryBean extends GateAwareObject implements org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.DisposableBean
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
.Constructor and Description |
---|
GateResourceFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the resource created by this bean, by passing it to
Factory.deleteResource(gate.Resource) . |
Object |
getObject()
Create the resource specified by this bean.
|
Class<?> |
getObjectType() |
boolean |
isSingleton() |
void |
setCustomisers(List<ResourceCustomiser> customisers) |
void |
setFeatures(gate.FeatureMap features) |
void |
setParameters(gate.FeatureMap parameters) |
void |
setResourceClass(String resourceClass) |
void |
setResourceName(String resourceName) |
ensureGateInit, setBeanFactory
public Object getObject() throws Exception
getObject
in interface org.springframework.beans.factory.FactoryBean
Exception
public Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean
public void destroy() throws Exception
Factory.deleteResource(gate.Resource)
.destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
public void setResourceClass(String resourceClass)
public void setResourceName(String resourceName)
public void setParameters(gate.FeatureMap parameters)
public void setFeatures(gate.FeatureMap features)
public void setCustomisers(List<ResourceCustomiser> customisers)
Copyright © 2023 GATE. All rights reserved.