cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin" <sbery...@progress.com>
Subject Re: Integrating JAX-RS runtime into DOSGi
Date Wed, 10 Jun 2009 11:49:41 GMT
Hi Josh

>>
>> What do you think about this idea. The factory which returns handlers
>> can check first if a given service intents include "HTTP" but no "SOAP"
>> and a frontend.jaxrs property is set, and if yes then it returns
>> JaxRSPojoConfigurationTypeHandler which will do what
>> PojoConfigurationTypeHandler but use JAXRS factories instead. The common
>> code, if any, can be refactored away into OSGIUtils.
>>
>> I agree it would be great if a common interface was there but may be we
>> will be able to get to it at some later stage and collapse handlers into
>> a single one...
>>
>> Thanks, Sergey
>>
> I can't seem to find JaxRSPojoConfigurationTypeHandler anywhere in the
> source.  I thought this was something that had been written and
> committed already.  Should I be looking in a branch for this?

Sorry, it was just an idea, there's no such handler in the source code yet.
I've just updated a cxf-minimal bundle to include a jaxrs frontend and I updated the cxf.version
in dosgi/parent to 2.3.0-SNAPHOT

(David, Eoghan - we can downgrade it easily to 2.2.2 fixes tag if DOSGi will need to be released
sooner than 2.3 does which is in 
about 3 months or so I believe, with fixes branch likely be easiler tp release earlier).

I haven't gone yet into the DOSGi code, it's been awhile since I last time worked with it.
So the idea is to basically copy&paste 
the existing PojoConfigurationHandler into JaxRSPojoConfigurationHandler and return it from
a factory if certain conditions are met 
(namely HTTP content is set, no SOAP and the the jaxrs property is also set). And then, as
the next step, see what may be refactored 
from both JaxRSPojoConfigurationHandler & PojoConfigurationHandler into OSGIUtils.

so the code for the server should be along these lines :

JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();

sf.setResourceClasses(serviceClass);

sf.setResourceProvider(serviceClass, new SingletonResourceProvider(serviceObject));

// only if aegis is needed, otherwise jaxb will be supported otb

sf.setProviders(Collections.singletonList(new AegisProvider()));

return sf.create()

for the client it should be something like

JAXRSClientFactory.create(serviceClass, Collections.singletonList(new AegisProvider()));

I'd also like to suggest that we check first if a model info is available, say in META-INF/{classname}.model,
and if yes then use

JAXRSClientFactory.createFromModel(serviceClass, Collections.singletonList(new AegisProvider()),
modelRef);

and

JAXRSServerFactoryBean.setModelRef(modelRef)

so that users who'd like to avoid pulling in JAX-RS annotations can avail of this featuer
- but this can be done later on

Let me know please if you'd like me to prototype some code there.


thanks, Sergey
>
> Thanks,
> Josh
>
> -- 
> Josh Holtzman
> Educational Technology Services, UC Berkeley
> jholtzman@berkeley.edu
> 510.529.9225
>
> 


Mime
View raw message