Details
Description
We are using Karaf by embedding it and basically starting it like this :
// code to setup System properties main = new Main(new String[0]); main.launch();
The problem is that the ConfigProperties that are used to startup Karaf are directly created in the main.launch() method, like this:
public void launch() throws Exception { config = new ConfigProperties();
Ideally it would be great if we could either have a setter to provide the config value, so that we could manipulate it before launching. In an embedded environment this quickly becomes a necessity. For example we would like to make it possible to have retrieve properties coming from another framework such as Spring and use those to override config.properties settings in a dynamic way, without needing to dump them to a file at Karaf startup. I'm aware of the ${includes} and ${optionals} but those require files to be read from the disk where here I'm talking about being able to dynamically manipulate the properties once loaded.
Basically something like this would be fantastic
// code to setup System properties main = new Main(new String[0]); ConfigProperties config = main.getConfig(); if (config == null) { config = new ConfigProperties(); } // manipulate config in any way desired main.setConfig(config) main.launch();
The main.launch could then simply be modified to something like this :
public void launch() throws Exception { if (config == null) { config = new ConfigProperties(); }
Btw we are using Karaf 4.0.x so having this in both Karaf 4.1.0 and Karaf 4.0 would be fantastic.