Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 73D7E200C17 for ; Fri, 10 Feb 2017 10:52:46 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 72915160B5C; Fri, 10 Feb 2017 09:52:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BB477160B5B for ; Fri, 10 Feb 2017 10:52:45 +0100 (CET) Received: (qmail 65328 invoked by uid 500); 10 Feb 2017 09:52:45 -0000 Mailing-List: contact issues-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list issues@karaf.apache.org Received: (qmail 65316 invoked by uid 99); 10 Feb 2017 09:52:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2017 09:52:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 5B670C05D7 for ; Fri, 10 Feb 2017 09:52:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.199 X-Spam-Level: X-Spam-Status: No, score=-1.199 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id SBMItZWqvbjw for ; Fri, 10 Feb 2017 09:52:43 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id C17315FE07 for ; Fri, 10 Feb 2017 09:52:42 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 3686AE031F for ; Fri, 10 Feb 2017 09:52:42 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id E34D521D65 for ; Fri, 10 Feb 2017 09:52:41 +0000 (UTC) Date: Fri, 10 Feb 2017 09:52:41 +0000 (UTC) From: "Guillaume Nodet (JIRA)" To: issues@karaf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (KARAF-4361) Allow dynamic config customization when embedding Karaf using the Main class MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 10 Feb 2017 09:52:46 -0000 [ https://issues.apache.org/jira/browse/KARAF-4361?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Guillaume Nodet resolved KARAF-4361. ------------------------------------ Resolution: Fixed Assignee: Guillaume Nodet (was: Jean-Baptiste Onofr=C3=A9) Thx for the patch ! > Allow dynamic config customization when embedding Karaf using the Main cl= ass > -------------------------------------------------------------------------= --- > > 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 > Assignee: Guillaume Nodet > Fix For: 4.0.9, 4.1.1 > > Attachments: KARAF_4361_Allow_dynamic_config_customization_when_e= mbedding_Karaf_using_the_Main_class.patch > > > We are using Karaf by embedding it and basically starting it like this := =20 > {code} > // code to setup System properties > main =3D new Main(new String[0]); > main.launch(); > {code} > The problem is that the ConfigProperties that are used to startup Karaf a= re directly created in the main.launch() method, like this: > {code} > public void launch() throws Exception { > config =3D 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 embed= ded environment this quickly becomes a necessity. For example we would like= to make it possible to have retrieve properties coming from another framew= ork 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 r= ead from the disk where here I'm talking about being able to dynamically ma= nipulate the properties once loaded. > Basically something like this would be fantastic > {code} > // code to setup System properties > main =3D new Main(new String[0]); > ConfigProperties config =3D main.getConfig(); > if (config =3D=3D null) { > config =3D 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 :=20 > {code} > public void launch() throws Exception { > if (config =3D=3D null) { > config =3D 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.15#6346)