On Fri, Aug 6, 2010 at 2:04 PM, Bertrand Delacretaz <[email protected]> wrote: > On Fri, Aug 6, 2010 at 1:40 PM, Vidar Ramdal <[email protected]> wrote: >> ...In principle, all you need to do is have a string constant annotated >> as @scr.property (or @Property if you're using the 'real' >> annotations). Then create local variables to store the property >> values. These values are fetchted from the Felix ConfigAdmin on >> component activation.... > > I just did that this morning for the bgservlets module, if you look at > [1] you'll get an example of how to make things configurable, using > the "modern" annotations.
Yeah, use the modern annotations and not the old javadoc ones (that is, use @Property, not /** @scr.property */). The modern ones are easier to maintain, as you can use Java constants as values. Refactoring support in IDEs are also much better. And, I forgot to mention, if you want a proper-looking configuration form in the Felix web console, you should supply a resources/OSGI-INF/metatype/metatypes.properties file, and specify metatype=true on your Component annotation. This also demonstrated in Bertrand's code. -- Vidar S. Ramdal <[email protected]> - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 / +47 22 00 84 76 Quando omni flunkus moritatus!
