uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Büscher <christoph.buesc...@neofonie.de>
Subject Re: Questions about using a "customResourceSpecifier"
Date Wed, 02 Jul 2008 14:29:29 GMT

great, this sound like it could solve my problem. I already used the "standard" 
external resource mechanism via some text-file, but now I want to try to share 
read access to a SQL database among some TAEs in a processing pipeline.
Does anyone know "best practices" for doing this? So far each TAE that needs 
read access to the database has its own set of connection parameters and needs 
to initialize a new connection. My first idea was that defining this as external 
resources might do the trick.



Adam Lally schrieb:
> On Tue, Jul 1, 2008 at 10:44 AM, Christoph Büscher
> <christoph.buescher@neofonie.de> wrote:
>> Hi,
>> I have a few questions about binding to external resources that are no file
>> resources. The documentation mentions the option to use a
>> "customResourceSpecifier" as described in
>> http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/html/references/references.html#ugr.ref.xml.component_descriptor.custom_resource_specifiers
>> I would like to use the resource mechanism to bind to an interface for read
>> access to a database. The database connection parameters would be parameters
>> in the "customResourceSpecifier".
>> I have a few questions concerning this.
>> 1. How do I include a custom resource specifier in e.g. a CPEs resource
>> binding? It's not exactly clear to me from the documentation, but I would
>> try something like:
>> <externalResource>
>>      <name>MyDBResource</name>
>>      <description>a resource that provides read access to a
>> database</description>
>>      <customResourceSpecifier>
>>          pathToCustomresourceSpecifier/myCustomResourceSpecifier.xml
>>      </customResourceSpecifier>
>> </externalResource>
>> Can I find examples for the correct syntax here somewhere in the
>> documentation?
> It should be possible to do what you want (In his email, Michael is
> referring to another use for custom resource specifiers, but they
> should work for this as well).
> This is basically right, but you need to put the
> <customResourceSpecifier> inline, like this (excuse my lack of
> indentation):
>     <externalResource>
>       <name>[String]</name>
>       <description>[String]</description>
> <customResourceSpecifier xmlns="http://uima.apache.org/resourceSpecifier">
>   <resourceClassName>[Java Class Name]</resourceClassName>
>   <parameters>
>     <parameter name="[String]" value="[String]"/>
>     <parameter name="[String]" value="[String]"/>
>   </parameters>
> </customResourceSpecifier>
>     </externalResource>
> Documentation for the <externalResouceElement> is in
> http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/html/references/references.html#ugr.ref.xml.component_descriptor.aes.primitive
> (scroll down to  I just replaced the
> <fileResourceSpecifier> with the custom resource specifier.
>> 2. The documentation mentions the implementation class must implement the
>> "Resource" interface. Is there any existing implementation of "Resource"
>> that is safe to extend to use in an external resource binding?
> You can extend Resource_ImplBase, and just override the initialize
> method.  There's a trivial example of a custom resource in the
> uimaj-core unit tests - org.apache.uima.impl.SomeCustomResource.
>  -Adam

View raw message