Am 10.06.2013 um 18:03 schrieb Marshall Schor <m...@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());
}

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

Cheers,

-- Richard

Btw., are there any general guidelines when to reply to Jira-issues via Jira 
and when to simply reply on the list? 


Reply via email to