Search code examples
javaconfigurationosgimetatype

OSGI Metatype representing complex configurations


Is there a clean and easy way to model Maps of Maps in OSGI Metatype. I have a fairly complex configuration need for a distributed system and the examples of Metatype I can find do not shed any definitive light on the subject.


Solution

  • No there is not. In case you need Metatype, you probably develop Components that are configurable. Instead of creating such complex configurations, try separating your component into multiple components in the way that they can wired together.

    E.g.: JGroups has pretty complex XML configuration. Instead of creating one complex JGroups component, many should be created that can be wired together.

    In case you cannot separate your logic to multiple components, you can represent your configuration as an XML, JSON or other Human readable format and set it as a text value.