cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Improving JBossWS-CXF Client Side Integration
Date Tue, 21 Jul 2009 21:03:50 GMT
On Tue July 21 2009 11:25:56 am Alessio Soldano wrote:
> I'm taking this from Richard as he's busy with other things. I've just
> taken a look deep in details and I think CXF already provides us a mean
> of setting properties in the port (actually in the request context upon
> port creation).
> I've just tried leveraging the bus extensions in ServiceImpl and it
> seems to work:
>
> bus.setExtension(new ServiceRefStubPropertyConfigurer(serviceRef),
> Configurer.class);
>
> ...
>
> public class ServiceRefStubPropertyConfigurer implements Configurer
> {
> ...
>    public void configureBean(String name, Object beanInstance)
>    {
>       if (beanInstance instanceof JaxWsProxyFactoryBean)
>       {
>          ... //here we set the props in the jaxws proxy factory bean
>       }
>    }
> }
>
> The ServiceImpl gets the configurer from the bus after having created
> the jaxws proxy factory bean.
> Then my custom configurer sets the props in the JaxWSProxyFactoryBean
> which in turns copies them to the request context in method
> clientClientProxy(Client c), that is called when getting the port.
>
> Now, here are my few questions:
> - could this be considered a proper use of the Configurer?

Actually, this is EXACTLY the right use of the Configurer.   Good catch.   
It's specifically there so the container can provide configuration to the 
various beans used throughout CXF.

> I've found
> just one implementation of this interface, for something related to
> spring configuration

Our normal config mechanism is spring based.   Thus, that's the implementation 
that is used most often.   I don't know if your JBoss integration stuff 
exposes any of the spring config to the JBoss/CXF users.  If so, you may need 
to keep the Spring configurer and "wrapper" it with yours. :
Configurer orig = bus.getExtension(Configurer.class)
bus.setExtension(new ServiceRefStubPropertyConfigurer(serviceRef, orig),
Configurer.class);

and have it call the wrapped configurer as well.


> - I see Configurer has two methods:
> void configureBean(Object beanInstance);
> void configureBean(String name, Object beanInstance);
>
> I'd actually add another call for the configuration in ServiceImpl using
> the former (configureBean(Object beanInstance)) as technically speaking
> the latter seems to me to be used for configuring beans of a specific
> name and currently the ServiceImpl uses that for
> portName+".jaxws-client.proxyFactory" beans.

I'd double check that.  Instead of "adding", you MAY be able to just replace 
as I think the default of configureBean(Object beanInstance) is to call a 
getName on the instance and then call the other method.   

> Let me know what do you think, considering you said this could be of use
> also for integrations issues besides JBossWS.

Sounds perfect!

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message