Programatically create OSGi configuration field

arpitv27529355 25-03-2020

Hi Folks,


Is there any way to create OSGi configuration field dynamically?

For example: create a OSGi field dropdown whose values comes as a response from some API.


Accepted Solutions (1)

Accepted Solutions (1)

theop76211228 26-03-2020

Hi Arpit  🙂


Unfortunately I don't think so because configuration are built using Java backend classes annotated with annotations from org.osgi.service.metatype.annotations such as @ObjectClassDefinition to define a configuration and @AttributeDefinition to define an attribute of that configuration 


If we look at the @AttributeDefinition documentation we can see that it is processed at compile-time and not run-time, so no possibility for the backend to call an API to populate a list of option  😕


The fronted libraries loaded on the configuration page do not come from /libs but from /system/console/res/lib, so it's not possible to override them either. 


I'm curious, what's your use-case? 

Answers (0)