Return-Path: X-Original-To: apmail-incubator-deltaspike-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltaspike-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 77CC3983D for ; Mon, 5 Mar 2012 16:24:57 +0000 (UTC) Received: (qmail 6762 invoked by uid 500); 5 Mar 2012 16:24:57 -0000 Delivered-To: apmail-incubator-deltaspike-dev-archive@incubator.apache.org Received: (qmail 6733 invoked by uid 500); 5 Mar 2012 16:24:57 -0000 Mailing-List: contact deltaspike-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltaspike-dev@incubator.apache.org Delivered-To: mailing list deltaspike-dev@incubator.apache.org Received: (qmail 6725 invoked by uid 99); 5 Mar 2012 16:24:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Mar 2012 16:24:57 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gerhard.petracek@gmail.com designates 209.85.213.175 as permitted sender) Received: from [209.85.213.175] (HELO mail-yx0-f175.google.com) (209.85.213.175) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Mar 2012 16:24:52 +0000 Received: by yenm3 with SMTP id m3so1649748yen.6 for ; Mon, 05 Mar 2012 08:24:32 -0800 (PST) Received-SPF: pass (google.com: domain of gerhard.petracek@gmail.com designates 10.236.156.34 as permitted sender) client-ip=10.236.156.34; Authentication-Results: mr.google.com; spf=pass (google.com: domain of gerhard.petracek@gmail.com designates 10.236.156.34 as permitted sender) smtp.mail=gerhard.petracek@gmail.com; dkim=pass header.i=gerhard.petracek@gmail.com Received: from mr.google.com ([10.236.156.34]) by 10.236.156.34 with SMTP id l22mr27353559yhk.118.1330964672226 (num_hops = 1); Mon, 05 Mar 2012 08:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=OMe6tBxL2na3MsA/h03H1Pzmh8EjjBvsPD2AVu6hB0s=; b=J4sP25x5Jf7gxx6VxofdVZJbhHTceNim6OBgvdiAyMGJbY0/ohRTIW7kLzWssPkBal x+EX0wyhn0VJiytuVZWOUMB8kAc1nlId/hmj9WOe3/ByG94i3oq1FKwkUhGvIfe4a4Y4 c2huBD1EhtLnWxEB7l+c0ou/yKpu+koV7ymXUIm2RXtWpGFf2PvMWuy22h7jexZMCLIx RlI2zQ/nVuQOUyEe8XALumSfwoEej9jps/oN81nWAEUbj6bo9mA8rMy2gG/qfVrWwjVq LHhSgGW0HRtAdMSL1S8Pt2+PU7sQg6Pdlqzau7q1sTTy33L34h+FaKj/WNBb1h4kFtZi eK1Q== Received: by 10.236.156.34 with SMTP id l22mr21585782yhk.118.1330964672147; Mon, 05 Mar 2012 08:24:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.146.246.19 with HTTP; Mon, 5 Mar 2012 08:24:12 -0800 (PST) In-Reply-To: <1330964239.51958.YahooMailNeo@web171403.mail.ir2.yahoo.com> References: <1330946380.89788.YahooMailNeo@web171406.mail.ir2.yahoo.com> <1330962295.22350.YahooMailNeo@web171405.mail.ir2.yahoo.com> <1330964239.51958.YahooMailNeo@web171403.mail.ir2.yahoo.com> From: Gerhard Petracek Date: Mon, 5 Mar 2012 17:24:12 +0100 Message-ID: Subject: Re: Re : Re : ConfigResolver : adding @ConfigProperty injection ? To: deltaspike-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=20cf303f6d227def9a04ba815c5d X-Virus-Checked: Checked by ClamAV on apache.org --20cf303f6d227def9a04ba815c5d Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable hi adrian, would be ok for me. regards, gerhard 2012/3/5 Adrian Gonzalez > What about having both options ? > > 1. be able to use directly @ConfigProperty > @Produces > public LoginContext > produceLoginContext(@ConfigProperty("loginConfigFile") String > loginConfigFileName, @ConfigProperty("loginModuleName") String > loginModuleName) > } > } > Handy when all config values are only used in a centralized class (e.g. > MyAppConfig). > > 2. type safe config annotations > @ConfigProperty( > name =3D "pool_size", > eager =3D true, //true is also the default value -> the value gets > converted during the bootstrapping process > converter =3D StringToIntegerConverter.class > ) > public @interface PoolSize { > } > > ----- Mail original ----- > De : Gerhard Petracek > =C0 : deltaspike-dev@incubator.apache.org > Cc : > Envoy=E9 le : Lundi 5 mars 2012 17h08 > Objet : Re: Re : ConfigResolver : adding @ConfigProperty injection ? > > hi adrian, > > @#1: > it isn't the default value of the property. > eager should be true by default -> the configured value gets converted > during bootstrapping (if the value has an invalid format the bootstrappin= g > process fails). > if eager is false, the configured value will be converted directly before > the injection (e.g. for values stored in dynamic config-sources). > > @#2: > afaik there is an upcoming jsr about it. > > regards, > gerhard > > > > 2012/3/5 Adrian Gonzalez > > > Hi Gerhard, > > > > 1. didn't understood the meaning of eager attribute > > If eager =3D default value, it should have been some integer value in y= our > > sample > > > > > > 2. StringToIntegerConverter converter > > Is there an existing conversion API (standard, in deltaspike, ...) ? > > (otherwise we're gonna need one here - and end up with another conversi= on > > API ;) ) > > > > Thanks ! > > > > ----- Mail original ----- > > De : Gerhard Petracek > > =C0 : deltaspike-dev@incubator.apache.org > > Cc : > > Envoy=E9 le : Lundi 5 mars 2012 12h57 > > Objet : Re: ConfigResolver : adding @ConfigProperty injection ? > > > > hi adrian, > > > > if we agree also on adding a bit more to allow e.g.: > > > > //... > > @ConfigProperty( > > name =3D "pool_size", > > eager =3D true, //true is also the default value -> the value gets > > converted during the bootstrapping process > > converter =3D StringToIntegerConverter.class > > ) > > public @interface PoolSize > > { > > } > > > > @Inject > > @PoolSize > > private int configuredPoolSize; > > > > then i would vote +1 > > (for sure the details need further discussions.) > > > > regards, > > gerhard > > > > > > > > 2012/3/5 Adrian Gonzalez > > > > > Hello, > > > > > > Deltaspike config module is based on ConfigResolver usage : > > > ConfigResolver.getPropertyValue("test") > > > > > > > > > Wouldn't it be interesting to add on top of it some injection > > > capacity ? (i.e. providing @ConfigProperty annotation) > > > > > > Sample usage [1] : > > > @Produces > > > public LoginContext > > produceLoginContext(@ConfigProperty("loginConfigFile") > > > String loginConfigFileName, > > > > > @ConfigProperty("loginModuleName") > > > String loginModuleName) > > > blabla > > > } > > > > > > This approach is based on Antonio's petstore application - config cod= e > is > > > available in [2] > > > > > > [1] > > > > > > https://github.com/agoncal/agoncal-application-petstore-ee6/blob/master/s= rc/main/java/org/agoncal/application/petstore/security/LoginContextProducer= .java > > > > > > [2] > > > > > > https://github.com/agoncal/agoncal-application-petstore-ee6/blob/master/s= rc/main/java/org/agoncal/application/petstore/util/ConfigProperty.java > > > > > > > > > https://github.com/agoncal/agoncal-application-petstore-ee6/blob/master/s= rc/main/java/org/agoncal/application/petstore/util/ConfigPropertyProducer.j= ava > > > > > > > > > > > > --20cf303f6d227def9a04ba815c5d--