Return-Path: Delivered-To: apmail-karaf-user-archive@minotaur.apache.org Received: (qmail 69876 invoked from network); 20 Dec 2010 19:26:42 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Dec 2010 19:26:42 -0000 Received: (qmail 77535 invoked by uid 500); 20 Dec 2010 19:26:42 -0000 Delivered-To: apmail-karaf-user-archive@karaf.apache.org Received: (qmail 77504 invoked by uid 500); 20 Dec 2010 19:26:42 -0000 Mailing-List: contact user-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@karaf.apache.org Delivered-To: mailing list user@karaf.apache.org Received: (qmail 77496 invoked by uid 99); 20 Dec 2010 19:26:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Dec 2010 19:26:42 +0000 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gnodet@gmail.com designates 74.125.82.46 as permitted sender) Received: from [74.125.82.46] (HELO mail-ww0-f46.google.com) (74.125.82.46) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Dec 2010 19:26:36 +0000 Received: by wwj40 with SMTP id 40so3314865wwj.3 for ; Mon, 20 Dec 2010 11:26:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=bl/YSntZhopfMPb0uo5fJV6gxwyXDh6kSCefx0chPLc=; b=tJqpwboPRynCUdJnhVbGhXPk5J6tykz+10PlBw36xMjiFWU7lCsWmtwG56S93gcILs SxscTemYMpJ4faEhbRBzfvD6OCR9FT163r8AYxutEydPgLkkNEygOR+R44u7aeSpyjjY MIWf1zp7ZfF0F4qtoyhIiE74R5X8KsLbdrGG0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Knd6DPKrnlXBfX4FkW1uo1dmqzt/iiTJ2iB5iv01prDRS2y2UAaB4Xj2fOnF7qmbf1 17DyfhULE8gyfO8ToBjWtDFK3NCNF3oMmMS/e2MuQX7Xg/cPftpzmO/v4/nUNIcmxyaE GXZTEn0akSThAifmwTMnWRRPZKRrR6VFnaAGI= MIME-Version: 1.0 Received: by 10.227.132.206 with SMTP id c14mr2850512wbt.124.1292873175559; Mon, 20 Dec 2010 11:26:15 -0800 (PST) Received: by 10.227.132.139 with HTTP; Mon, 20 Dec 2010 11:26:15 -0800 (PST) In-Reply-To: <01fb01cba073$5a5c1b20$0f145160$@org> References: <1292621260258-2107407.post@n3.nabble.com> <4D0BD788.6040907@googlemail.com> <1292738048286-2114374.post@n3.nabble.com> <4D0E59F9.7030001@googlemail.com> <1292862616327-2121172.post@n3.nabble.com> <01fb01cba073$5a5c1b20$0f145160$@org> Date: Mon, 20 Dec 2010 20:26:15 +0100 Message-ID: Subject: Re: Managed Properties question From: Guillaume Nodet To: user@karaf.apache.org Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Or use a cm:property-placeholder in combination with the reload flag to reload the app if the config change, that's what i used inside karaf, see: http://svn.apache.org/repos/asf/karaf/trunk/shell/ssh/src/main/resources/= OSGI-INF/blueprint/shell-ssh.xml 2010/12/20 =A3ukasz Dywicki : > If you try to do managed component your configuration property name must > match field name, otherwise container will not update your bean. Both > spring-dm and aries blueprint works same. In your example the property na= med > integer have to use placeholder ${integer}. If you would like to use > different names you need to manage changes in bean (set strategy to bean > managed and callback method). > > Best regards, > Lukasz > > -----Original Message----- > From: Achim Nierbeck [mailto:bcanhome@googlemail.com] > Sent: Monday, December 20, 2010 6:00 PM > To: user@karaf.apache.org > Subject: Re: Managed Properties question > > OK, another try > > > =A0 update-strategy=3D"container-managed"/> > =A0 > > > this is the official example :) > > I think the property (named integer here) is optional. Usually all > properties which can be read through getter and setter can be set by > the configuration. > > So your problem is that you try to inject properties within another prope= rty > > > =A0 > =A0 =A0${myAppDbShowSql} > =A0 =A0${myAppDbFormatSql} > =A0 > =A0 > > All your properties you want to update need to be accessible via > getter and setter. > If you want to do this you need to make an extra bean which is > configurable (with the same pid) > and inject that one after it is initialized. you may want to make your > standard bean dependend on the "new" bean. > > 2010/12/20 karafman >> >> It still isn't working. >> >> Here's an excerpt of my .cfg file (none of the names in the file have an= y >> characters other than [a-z, A-Z]: >> myAppDbShowSql =3D false >> myAppDbFormatSql =3D false >> >> In the file where I get my service I have: >> > persistent-id=3D"myApp.data.access"/> >> ctx:property-placeholder properties-ref=3D"myAppDatabaseProperties"/> >> >> In the file where I am using the managed service I have (unnecessary bit= s >> removed): >> > class=3D"org.springframework.orm.hibernate3.LocalSessionFactoryBean" >> p:dataSource-ref=3D"myAppPoolDataSource"> >> =A0> update-strategy=3D"container-managed"/> >> =A0 >> =A0 hibernate valies >> =A0 >> =A0 >> =A0 =A0 >> =A0 =A0 ${myAppDbShowSql} >> =A0 =A0 ${myAppDbFormatSql} >> =A0 =A0 >> =A0 >> >> >> When I change the values in my .cfg file, I can see those changes being >> populated by doing a config:list. >> >> However, I get the following error in my log: >> Configuration for myApp.data.access has already been used for service >> [org.osgi.service.cm.ManagedService, id=3D127, bundle=3D89] and will be = also >> given to [org.osgi.service.cm.ManagedService, id=3D128, bundle=3D89] >> >> When I restart bundle 89, the properties are properly consumed. >> >> Anyone know what's going wrong? >> >> >> ----- >> Karafman >> Slayer of the JEE >> Pounder of the Perl Programmer >> >> -- >> View this message in context: > http://karaf.922171.n3.nabble.com/Managed-Properties-question-tp2107407p2= 121 > 172.html >> Sent from the Karaf - User mailing list archive at Nabble.com. > > --=20 Cheers, Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ Open Source SOA http://fusesource.com