uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: [jira] [Commented] (UIMA-2903) List resources in a ResourceManager / remove hack in uimaFIT
Date Mon, 10 Jun 2013 18:43:45 GMT

On 6/10/2013 12:44 PM, Richard Eckart de Castilho wrote:
> Am 10.06.2013 um 18:03 schrieb Marshall Schor <msa@schor.com>:
>
>> I'm not an expert here; I took a look at the code.
>>
>> It seems that the interface Resource includes the method getResourceManager()
>> which returns the ResourceManager that was used to create this instance.
>> The implementations seem to inherit from the Resource_ImplBase which has the
>> getResourceManager method.
>> So it seems to me that Resources can find the ResourceManager they were created in?
>
> I can offer two tests and a diagnosis, and at least a suggestion for one or two fixes.
>
> == Tests ==
>
> Try this:
>
> - Set a breakpoint in TestResourceInterface_impl line 48
> - Run ResourceManager_implTest in debug mode
> - when the breakpoint is hit, inspect aData.getResourceManager() (is "null")
>
> Admittedly, the external resource is not initialized in its natural environment (within
an AE) here.
>
> Different test:
>
> - Set a breakpoint in Apache uimaFIT ExternalResourceFactoryTest$DummySharedResourceObject.load(DataResource)
line: 558 
> - Run ExternalResourceFactoryTest.testScanBind() line: 103 in debug mode
> - when the breakpoint is hit, inspect aData.getResourceManager() (is "null")
>
> == Diagnosis ==
>
> The ResourceManager_impl (line 567) would set a resource manager on the created external
resource, if one had been specified in the aResourceInitParams which are handed down all the
way from the creation of the analysis component to the resource. But if the original called
did leave it to UIMA to set up a resource manager, this internally created manager is not
passed through. Thus, Resource_ImplBase.initialize (line 88ff) creates a new resource manager
for the resource.
> This could be fixed by adding the following code in Resource_ImplBase line 176:
>
> if (aAdditionalParams == null) {
>   aAdditionalParams = new HashMap<String, Object>();
> }
> if (!aAdditionalParams.containsKey(PARAM_RESOURCE_MANAGER)) {
>   aAdditionalParams.put(PARAM_RESOURCE_MANAGER, mUimaContextAdmin.getResourceManager());
> }

This seems reasonable to me.  It says to share whatever resource manager is
passed in or created for this UIMA Context with external resource, unless a
specific additional param was passed in specifying a resource manager to use.


>
> Additionally, ConfigurableDataResource_impl seems never to call super.initialize(), so
its mUimaContextAdmin is never initialized, hence any getResourceManager() call returns null.

This will take some more investigation / code research for me to offer any
(hopefully useful) opinions...

>
> Cheers,
>
> -- Richard
>
> Btw., are there any general guidelines when to reply to Jira-issues via Jira and when
to simply reply on the list? 
Here are the guidelines I think about:
   a) Jira doesn't have nested reply capability, or the ability to reply in-line
to a previous comment (with your comments interspersed)
   b) A particular Jira can represent a cross-cutting collection of comments on
a particular topic.

So, I tend to use mailing list for discussion, but post summaries and other
things I want to be able to have longer-lasting references to, on the Jira.

-Marshall

Mime
View raw message