-
Notifications
You must be signed in to change notification settings - Fork 780
OSGi services: Generate config xmls through annotations #5300
Comments
I like and use that feature of "Declarative Services 1.3" most of the time. There is also a simple to understand article here: http://njbartlett.name/2015/08/17/osgir6-declarative-services.html I would be more happy if we can change our minimum requirements to "OSGi Release 6", but as this does not seem to happen soon (or are there any news?)... Shouldn't we use a "non-config" package for that annotations? |
The mentioned "Configuration" class for de-marshaling is within "config.core". As soon as a service requires configuration it should depend on "config.core" anyway, I thought. |
The bundle |
@maggu2810 I have adapted the proposal. Annotations would go to core.config.annotations within the core bundle. |
I missed that feature a few days ago: https://github.com/eclipse/smarthome/pull/5231/files#diff-fffa1e559c1bd5be08121b24f97873e0R71 😉 |
@maggu2810 I know :) I have adapted the former MqttService PR (#4173) which is ready to be merged now by the way, and it does it the easier way. |
@davidgraeff If you haven't read it already and are interested in: Configuration Updater |
Thanks @maggu2810, a good read. And I read on on this topic and apparently at least bnd can generate xml files out of OSGi R6 |
Abstract
In Declarative Services 1.3 there are Configuration Property Types, so you can write:
Manual parsing of property parameters is something you wouldn't do in DS 1.3.
On DS 1.2, we can at least establish a similar pattern:
The documentation should be clear about this pattern, it might even be made mandatory for new code.
Now we do have a class that perfectly describes the full configuration. Why don't we go one step further.
Generate config xmls through annotations
If we start to annotate those configuration classes, at some point we are able to fully generate the "config-description:config-descriptions" xml files.
I suggest to add all necessary annotations to a "core.config.annotation" namespace within the
core
bundle. An annotated class could look like this:WDYT?
The text was updated successfully, but these errors were encountered: