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?
-Marshall On 6/7/2013 7:14 PM, Richard Eckart de Castilho (JIRA) wrote: > [ > https://issues.apache.org/jira/browse/UIMA-2903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13678562#comment-13678562 > ] > > Richard Eckart de Castilho commented on UIMA-2903: > -------------------------------------------------- > > Is it a conscious design decisions that resources created via ResourceManager > do not know about the ResourceManager they were created in? > > *Allow access to creating ResourceManager* -- It would seem to be useful that > one registered resource could access a ResourceManager to request another > registered resource. Currently, a resource apparently gets its own > ResourceManager and does not see its fellow resources. > > *Defer call to Resource.initialize() for shared resources* -- If a resource > could see the ResourceManager that created it, it would also be useful either > to defer the invocation of the initialize() method until all non-parametrized > resources have been instantiated in ResourceManager_impl. > initializeExternalResources(), so that a resource may fetch another resource > instance (although the latter may not yet have been initialized). > > These two features might be an alternative solution to adding a > listResources() method, because uimaFIT could then invoke the > ExternalResourceInitializer in the initialize() method and wouldn't have to > try and defer that. > > >> List resources in a ResourceManager / remove hack in uimaFIT >> ------------------------------------------------------------ >> >> Key: UIMA-2903 >> URL: https://issues.apache.org/jira/browse/UIMA-2903 >> Project: UIMA >> Issue Type: Improvement >> Components: Core Java Framework, uimaFIT >> Reporter: Richard Eckart de Castilho >> >> uimaFIT currently gets a list of resources that are registered with a >> ResourceManager. This is handled via accessing the "mResourceMap" field of >> the ResourceManager_impl class via reflection. Obviously, this is not a good >> solution. >> uimaFIT iterates over the resources in the context while initializing >> resources that are referenced form other external resources. >> There may be two options: >> # add a listResources() method to the ResourceManager interface >> # get the resources that need to be initialized in some other way. I don't >> know if there is one, because if there was, I'd probably have used it. >> Looking at the @ExternalResource annotations doesn't help, because they do >> not give informations about the resource bindings. The bindings are only >> available in the ResourceManager, which takes us back to 1). >> Would it be possible to add a method allowing to list the resource bindings >> registered in a ResourceManager to the ResourceManager interface? > -- > This message is automatically generated by JIRA. > If you think it was sent incorrectly, please contact your JIRA administrators > For more information on JIRA, see: http://www.atlassian.com/software/jira >
