On 10/18/2011 5:35 PM, Jörn Kottmann wrote: > On 10/18/11 10:41 PM, Marshall Schor wrote: >> I'm thinking (outloud) here of another kind of approach. Suppose we keep the >> idea that the main "place" for parameter definitions / settings, is in the >> XML. >> Perhaps we could use injection ideas + Java annotations to simplify the Java >> code. >> >> Here's how it might work. You would define the parameters, etc., externally >> in >> the XML, as is now done. But in the Java code, you would write something >> like >> // this form if the name of the external parm differs from the variable >> name >> @uimaParameter(ExternalParmName1) >> String myStringParm; >> >> // this form if the name of the external parm is the same as the variable >> name >> @uimaParameter >> int myIntParam; > > One of the things with the current approach which always annoys me is that I > have to specify the "configurationParameters" element over and over again, > and that it can easily get out of sync with the current implementation. > > I always thought that we should cut it out, and put it in another xml > descriptor > which is included in the jar file.
Our annotators in our "addons" often package a "typical use" xml descriptor in the Jar file - so this is doable (except it doesn't address making the configuration parameters a separate "thing"). I think Adam/Eddie have proposed some thoughts on having some kind of separate "settings" file for complex sets of annotators that can collect things together in one place, maybe as a properties file - see: http://uima.markmail.org/thread/r2vrblnzkq4hdqnu ) -Marshall > > But today it might be better to use annotations to define these configuration > parameters, when they are strongly attached to the implementation. > > When I can rely on the framework to check for my configuration parameters > settings (e.g. throw an > exception when one is not provided by a user) then I don't need to do this > error checking > twice (which e.g. OpenNLP does) and therefore I have to write less code to do > the same. > > Additionally using annotations to inject parameters into instance variables > makes things > even easier and nicer to use. > > Jörn >
