sudeep87 / uimafit

Automatically exported from code.google.com/p/uimafit
0 stars 0 forks source link

ExternalResourceFactory fails to bind a resource class twice with different parameters #56

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently it is not possible to bind a resource class to different keys with 
different parameters. Example:

bindResource(desc, DummyAE.RES_KEY_1, ConfigurableResource.class,
        ConfigurableResource.PARAM_VALUE, "1");
bindResource(desc, DummyAE.RES_KEY_2, ConfigurableResource.class,
        ConfigurableResource.PARAM_VALUE, "2");

The problem is that the internal external resource specifier uses the resource 
class as name, so that in the created bindings are (RES_KEY_1, 
ConfigurableResource.class.getName()) and (RES_KEY_2, 
ConfigurableResource.class.getName()). Thus only the resource configured first 
is then actually bound to the component - and bound to both keys.

Original issue reported on code.google.com by richard.eckart on 13 Feb 2011 at 6:48

GoogleCodeExporter commented 8 years ago
ExternalResourceFactory uses in internal AtomicLong do generate a 
disambiguation ID for the specifiers. This is thread safe and pretty much 
guaranteed to be unique. I thought about using a hashCode() of the parameters 
list, but I'm slightly paranoid about hash collisions.

Original comment by richard.eckart on 13 Feb 2011 at 6:54

GoogleCodeExporter commented 8 years ago

Original comment by richard.eckart on 7 Apr 2011 at 12:12

GoogleCodeExporter commented 8 years ago
Added the disambiguation in another bindResource() method which internally 
creates a resource description in rev 599.

Original comment by richard.eckart on 17 Apr 2011 at 4:31

GoogleCodeExporter commented 8 years ago

Original comment by richard.eckart on 8 May 2011 at 10:44