uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: Accessing DAO's and other objects from an Annotator.
Date Wed, 21 Jul 2010 15:03:21 GMT
 Annotators are designed to be re-usable, re-deployable components.  By this, we
mean, that a future user of the component might want to "scale it out" as a
service running in separate JVMs, etc.  The UIMA framework's component
"isolation" is designed to enable this kind of separation of concerns.

Having said that, there is a way to gain access to sharable, arbitrary Java
things in an annotator - by using "resources".  These are essentially any Java
class you write; they are instantiated by the framework and can be made
available to multiple annotators, but only within the same running JVM (so using
it may reduce your component's reusability in future scenarios).

One note: although the resources APIs are written with a common use-case - that
of having initialization "load" an external resource - you don't need to do that
if it isn't part of the use-case you're addressing.


On 7/20/2010 9:08 AM, Alex wrote:
> I was curious as to everyone's approach to accessing DAOs and other Java objects
> within a JCas Annotator (a Java object extending JCasAnnotator_ImplBase).
> Since there is no way to pass objects as parameters through the process method
> (ie via an Object[]), the only thing I can think of doing is initializing DAOs
> through the initialize method by pulling Spring bean names from a resource file
> stored in the UimaContext and getting the objects through Spring's
> ApplicationContext.
> Also, how do we pass dynamic objects that are not of an existing CAS Type to an
> Annotator?  Just for example, say I have a java.util.regex.Pattern object that
> is created before calling annotator.process(JCas) and I want to pass and use
> that object in the annotator without recreating it in the annotator (ie I don't
> want to attach the String value of the Pattern as a uima.cas.String to the JCas
> object and recompile it as a Pattern in the annotator).

View raw message