On Tue, Sep 8, 2009 at 6:49 AM, Jörn Kottmann<[email protected]> wrote: > Marshall Schor wrote: >> >> Fabio Mancinelli wrote: >> >>> >>> Hi everybody, >>> >>> I have a quick question about UIMAJ component initialization. >>> >>> What I would like to do is to pass a Java reference to an object that >>> will be used by the "business logic" of a collection reader in the >>> context of a CPE. Since I cannot control the instantiation of the >>> collection reader, I was wondering if there is a quick and clean way >>> to pass that object reference or if this is not impossible at all >>> (like I am suspecting). >>> >> >> There is no clean way to do this in general. This is because the >> components in general could be running in other contexts, for instance, >> in a remote machine, not the same JVM, etc. >> >> There is a way to share Java objects among annotators running in the >> same machine, using external resources; see >> >> http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/html/tutorials_and_users_guides/tutorials_and_users_guides.html#ugr.tug.aae.accessing_external_resource_files >> >> While that specifically addresses creating a Java object and then >> "loading" it from an external file, the loading part is optional. >> > > What must be done to make the loading part optional ? > > If a resource is described without the fileResourceSpecifier element, > then the framework throws a NullPointerException. > > For example: > <externalResourceDependency> > <key>searchQueryProvider</key> > <interfaceName>org.apache.uima.lucas.SearchQueryProvider</interfaceName> > </externalResourceDependency> > ... > <externalResource> > <name>SampleSearchQueryProvider</name> > <implementationName>org.apache.uima.lucas.SampleSearchQueryProvider > </implementationName> > </externalResource> >
Instead of a fileResourceSpecifier you can use a customResourceSpecifier. See: http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/html/references/references.html#ugr.ref.xml.component_descriptor.custom_resource_specifiers -Adam
