UIMA Class Loading Extensions
This page discusses requirements for specifying Class loaders for components.
Danai Wiriyayanyongsuk wrote:
As of UIMA 2.2, there is no way to specify classpath of a component (annotator) without using PEAR files. It'd be very useful to be able to specify the classpath of an annotator using a descriptor. Having such feature could add a great deal of flexibility of creating an isolated class loader environment for each annotator in the pipeline based on the information (descriptor) available at runtime, avoid being tied to the static, physical PEAR files on disk.
One of the possible approaches is to add a classpath element in the descriptor as shown below (credited to Michael Baessler):<delegateAnalysisEngineSpecifiers> <delegateAnalysisEngine key="(String)"> <analysisEngineDescription>...</analysisEngineDescription> | <import .../> <classpath usage="append | addfirst | override"> (String: classpath settings) </classpath> </delegateAnalysisEngine> </delegateAnalysisEngineSpecifiers>
The "classpath" element should be optional regardless of either the "analysisEngineDescription" or the "import" element is used to support backward compatibility. The "classpath" element has three optional attributes: append, addfirst and override. By default (if not specified), the attribute value would be "override".
In the case that the "import" and "classpath" element are used together, there might be two sources of classpath settings: one from the PEAR file and another one from the "classpath" element. In this case, the classpath's attribute could be used to specify the classpath resolving behavior:
- For "append", the classpath specified in the descriptor shall be appended to the one retrieved from the PEAR file.
- For "addfirst", the classpath specified in the descriptor shall be added in front of the one retrieved from the PEAR file.
- For "override", the classpath specified in the descriptor shall be used instead of the one retrieved from the PEAR file.
In the case that the "analysisEngineDescription" and "classpath" elements are used together, the classpath's attribute value shall be ignored as there is no conflict of the classpath settings.
All comments and sugguestions are very welcome.