Search code examples
osgiapache-felix

How felix console uses metatype.xml file


I want to understand the use of metatype for component.

I understand, if we keep it true than it will generate OSGI-INF/metatype/metatype.xml else it would not. Also, I'm well aware that keeping the value of attribute true will show it in Apache Felix Console, editing it will create a corresponding config save in /apps/system/config and deleting that will again bring config state in Felix console to default.

Quoting from This question's accepted answer, `

How Metatype data can be used by administrative systems or GUIs such as Felix Web Console to present a much more helpful way to configure your component?
and what is the concept of binding with bundle in terms of this configuration?

`


Solution

  • See this service : https://osgi.org/javadoc/r6/cmpn/org/osgi/service/metatype/MetaTypeService.html

    With the MetaTypeService, you can dynamically instropect a bundle and discovers metatype information about his configuration, with type, description, etc.

    The Felix WebConsole use this metatype information to show a UI more "userfriendly" for the configuration of a composant.