gate.util.spring
Class GateResourceFactoryBean

java.lang.Object
  extended by gate.util.spring.GateAwareObject
      extended by 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 ResourceCustomisers 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 Summary
GateResourceFactoryBean()
           
 
Method Summary
 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(FeatureMap features)
           
 void setParameters(FeatureMap parameters)
           
 void setResourceClass(String resourceClass)
           
 void setResourceName(String resourceName)
           
 
Methods inherited from class gate.util.spring.GateAwareObject
ensureGateInit, setBeanFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GateResourceFactoryBean

public GateResourceFactoryBean()
Method Detail

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)