Return-Path: Delivered-To: apmail-incubator-cxf-dev-archive@locus.apache.org Received: (qmail 6525 invoked from network); 15 Dec 2006 06:21:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Dec 2006 06:21:20 -0000 Received: (qmail 16209 invoked by uid 500); 15 Dec 2006 06:21:27 -0000 Delivered-To: apmail-incubator-cxf-dev-archive@incubator.apache.org Received: (qmail 16069 invoked by uid 500); 15 Dec 2006 06:21:27 -0000 Mailing-List: contact cxf-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-dev@incubator.apache.org Received: (qmail 16060 invoked by uid 99); 15 Dec 2006 06:21:27 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Dec 2006 22:21:27 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of achen@iona.com designates 65.223.216.181 as permitted sender) Received: from [65.223.216.181] (HELO amereast-smg1.iona.com) (65.223.216.181) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Dec 2006 22:20:52 -0800 Received: from amer-ems1.IONAGLOBAL.COM ([10.65.6.25]) by amereast-smg1.iona.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id kBF6KFHk007700 for ; Fri, 15 Dec 2006 01:20:15 -0500 (EST) Received: from [10.129.9.121] ([10.129.9.121]) by amer-ems1.IONAGLOBAL.COM with Microsoft SMTPSVC(6.0.3790.1830); Fri, 15 Dec 2006 01:20:14 -0500 Message-ID: <45823EB5.80808@iona.com> Date: Fri, 15 Dec 2006 14:20:37 +0800 From: Alex Chen User-Agent: Thunderbird 1.5.0.8 (X11/20061025) MIME-Version: 1.0 To: cxf-dev@incubator.apache.org Subject: Re: Injecting the configuration programmatically References: <45820604.1000108@iona.com> <45821651.8000800@iona.com> In-Reply-To: <45821651.8000800@iona.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 15 Dec 2006 06:20:15.0338 (UTC) FILETIME=[15AA8CA0:01C72011] X-Virus-Checked: Checked by ClamAV on apache.org Hi Willem, Could I input arguments for CXF bus using a util class directly(i.e. setter method) instead of a configuration file? thanks, --Alex Willem Jiang wrote: > Alex, > You can inject your configuration by let the SpringBusFactory do not > using the default configuration, SpringBusFactory.createBus(String > cfgFile, boolean includeDefaults), the spring bus will not try to find > other configurations as its default setting. > If you want the Bus take the effect when you are using the Jaxws-api, > you need to call SpringBusFactory.setDefaultBus(Bus bus) which will set > the SpringBusFactory's static Bus to the Bus you just create. > Here is an example of configuration file to show how to write your own > minimal size of configuration to support SOAP/HTTP. > > > > > > ... > > > Regards, > Willem. > Alex Chen wrote: > >> Hi Eoghan, >> >> Sorry for not clear in my last email, I only need SOAP/HTTP transport. >> >> Cheers, >> --Alex >> >> >> Glynn, Eoghan wrote: >> >>> >>> Well if you just want to specify a particular configuration file >>> programmatically, then the simplest way is to use the >>> SpringBusFactory.createBus(String cfgFile) API. >>> >>> If you want to *completely* replace the Spring Configurer with your >>> own implementation, then use: >>> >>> Bus.setExtension(Configurer.class, myConfigurer); >>> >>> If you want to *selectively* inject property values for some >>> particular beans (but let the other beans pick up their property >>> values from the config file as usual), then I think there's some work >>> to do. I'm no Spring expert, and Andrea would be really be person to >>> comment definitively on this. However seeing as she's on vacation, >>> I'd guess you could try down-casting the Configurer bus extension to >>> an org.springframework.beans.factory.wiring.BeanConfigurerSupport, >>> then call setBeanFactory() on this to set your own fa�ade >>> implementation of >>> org.springframework.beans.factory.config.AutowireCapableBeanFactory. >>> Then in autowireBeanProperties() and applyBeanPropertyValues(), check >>> if the bean being configured is the one you want to selectively >>> inject specific property values into. If so, go ahead and do this. If >>> not, delegate to the original bean factory. >>> >>> There may well be a simpler and better way of doing this. For example >>> to avoid getting tangled up in the Spring logic, you could just >>> extend the org.apache.cxf.configuartion.spring.ConfigurerImpl to >>> allow values for specific beans to be injected into say a local map, >>> which is then checked before configureBean() delegates to the >>> super-class implementation [i.e. >>> org.springframework.beans.factory.wiring.BeanConfigurerSupport.configureBean()]. >>> >>> >>> As always, I'm open to correction by the Spring aficionados. >>> >>> Cheers, >>> Eoghan >>> >>> >>>> -----Original Message----- >>>> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com] Sent: 14 >>>> December 2006 09:35 >>>> To: cxf-dev@incubator.apache.org >>>> Subject: Injecting the configuration programmatically >>>> >>>> Hi >>>> >>>> Is there any way to inject the configuration into the CXF runtime >>>> programmatically ? >>>> For ex, one way is to tell the runtime where the config is by >>>> pointing it to the cxf.xml (default name...). Is there any way to >>>> create a required configuration and tell the runtime that the >>>> configuration for a given bean name is available ? >>>> >>>> Thanks, Sergey >>>> >>> >> > >