karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Serge Huber (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (KARAF-4361) Allow dynamic config customization when embedding Karaf using the Main class
Date Thu, 25 Feb 2016 15:58:18 GMT

     [ https://issues.apache.org/jira/browse/KARAF-4361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Serge Huber updated KARAF-4361:
-------------------------------
    Description: 
We are using Karaf by embedding it and basically starting it like this : 

{code}
            // code to setup System properties
            main = new Main(new String[0]);
            main.launch();
{code}

The problem is that the ConfigProperties that are used to startup Karaf are directly created
in the main.launch() method, like this:

{code}
    public void launch() throws Exception {
        config = new ConfigProperties();
{code}

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 "custom.properties" files
that could override the values of the config.properties settings so that we can offer integrators
to modify a custom file without touching the default file.

Basically something like this would be fantastic

{code}
            // 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();
{code}

The main.launch could then simply be modified to something like this : 
{code}
    public void launch() throws Exception {
        if (config == null) {
            config = new ConfigProperties();
        }
{code}

Btw we are using Karaf 4.0.x so having this in both Karaf 4.1.0 and Karaf 4.0 would be fantastic.


  was:
We are using Karaf by embedding it and basically starting it like this : 

{code}
            // code to setup System properties
            main = new Main(new String[0]);
            main.launch();
{code}

The problem is that the ConfigProperties that are used to startup Karaf are directly created
in the main.launch() method, like this:

{code}
    public void launch() throws Exception {
        config = new ConfigProperties();
{code}

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.

Basically something like this would be fantastic

{code}
            // 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();
{code}

The main.launch could then simply be modified to something like this : 
{code}
    public void launch() throws Exception {
        if (config == null) {
            config = new ConfigProperties();
        }
{code}

Btw we are using Karaf 4.0.x so having this in both Karaf 4.1.0 and Karaf 4.0 would be fantastic.



> Allow dynamic config customization when embedding Karaf using the Main class
> ----------------------------------------------------------------------------
>
>                 Key: KARAF-4361
>                 URL: https://issues.apache.org/jira/browse/KARAF-4361
>             Project: Karaf
>          Issue Type: Improvement
>          Components: karaf-core
>    Affects Versions: 4.1.0, 4.0.4
>            Reporter: Serge Huber
>         Attachments: KARAF_4361_Allow_dynamic_config_customization_when_embedding_Karaf_using_the_Main_class.patch
>
>
> We are using Karaf by embedding it and basically starting it like this : 
> {code}
>             // code to setup System properties
>             main = new Main(new String[0]);
>             main.launch();
> {code}
> The problem is that the ConfigProperties that are used to startup Karaf are directly
created in the main.launch() method, like this:
> {code}
>     public void launch() throws Exception {
>         config = new ConfigProperties();
> {code}
> 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 "custom.properties" files
that could override the values of the config.properties settings so that we can offer integrators
to modify a custom file without touching the default file.
> Basically something like this would be fantastic
> {code}
>             // 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();
> {code}
> The main.launch could then simply be modified to something like this : 
> {code}
>     public void launch() throws Exception {
>         if (config == null) {
>             config = new ConfigProperties();
>         }
> {code}
> Btw we are using Karaf 4.0.x so having this in both Karaf 4.1.0 and Karaf 4.0 would be
fantastic.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message