On 06/08/2018 11:10, Philipp Höfler wrote:
I am receiving a rest call with a system id. Based on this id I would like to 
use the appropriated config from the json file.
For example, security check is disabled for system1, but not for system2. The 
rest endpoint is the same but based on the configuration the security check is 
executed or not.
To me, the best solution for you is to use the Config Admin to query if there are any configuration created for the "system" you want.

You need to create a filter:
StringBuilder filter = new StringBuilder("(&");
        filter.append('(').append("service.factoryPid")
                .append('=').append(pFactoryPid).append(')');
        filter.append('(').append("service.pid").append('=')
                .append(pPid).append(')');

And then use cm to return a configuration (if one exists):

Configuration[] configurations = getConfigurationAdmin()
                    .listConfigurations(filter.toString());

Once you have the configuration, you can enable or disable it as you will.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to