blob: 7d017957757eb1523e338aee44e09f860f855a65 [file] [log] [blame]
<h1>External Resources</h1>
<wiki:toc max_depth="2" />
= Context injection =
There are several issues with the context injection as it is currently implemented in uimaFIT:
* The field types supported by the parameter injection mechanism are not extensible. To address this, we imagine to support Java Bean PropertyEditors (Issue 79)
* Default parameters cannot be overwritten by sub-classes. (Issue 69)
* No warning if the context contains a parameter that the component does not know (Issue 7)
* Default names for parameters and resources should be the name of the annotated field (Issue 70, Issue 71)
* Parameters and resources should be mandatory by default (Issue 72)
== Relation to other dependency injection frameworks ==
JSR 250 defines the `@Resource` annotation. This could be used as an alternative for `@ConfigurationParameter` and `@ExternalResource`, but it does not support all the information provided by the two and provides some that we do not need in UIMA.
|| `@Resource` || `@ConfigurationParameter` || `@ExternalResource` ||
|| name || name || key ||
|| type || -- || api ||
|| shareable || -- || ||
|| mappedName || -- || -- ||
|| description || description || -- ||
|| authenticationType || -- || -- ||
|| -- || mandatory || mandatory ||
|| -- || defaultValue || -- ||
The Spring Framework defines an annotation [http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/beans/factory/annotation/Required.html @Required] which can probably be used in conjunction with `@Resource` to incidate that a value is mandatory (I didn't try this out, but I expect it should work). [http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/Required.html Apache Camel] seems to define a similar annotation.
We do not know of any substitute for defaultValue. However, this information is not used during injection, only during descriptor generation. It may be sensible to have a separate annotation (like `@Required` for 'mandatory') if a JSR 250 compatible approach is desired.