One bus per bundle should be enough. I guess we could also do this in DSOGi.
What you have looks good generally. Do you get any error?
Christian
On 18.07.2016 17:31, Benson Margulies wrote:
I'm hoping for a response from Christian.
I don't think that CXF-DOSGI and I are ready for each other yet -- I
can't be depending on a 2.0-SNAPSHOT. So I'm looking to clean up my
existing code that launches CXF JAX-RS services via the usual CXF API
from inside OSGi bundles from inside of Karaf 4.0.x.
Below is a typical launch. To put this into context, cxfBus is an
@Reference to a DS @Component with scope set to BUNDLE. The activator
in the component creates a new bus and calls makes sure that it has
the right class loader.
bus.setExtension(context.getBundleContext().getBundle().adapt(BundleWiring.class).getClassLoader(),
ClassLoader.class);
I took a look inside of CXF-DOSGI to improve my chances of getting
this stuff right, and I didn't see the extension getting set. I also
saw an entire bus for each service, not just one for each bundle.
Am I missing something?
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setBus(cxfBus.bus());
sf.setProvider(new JacksonJaxbJsonProvider(JsonUtils.getObjectMapper(),
JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS));
sf.setProvider(new JsonExceptionMapper());
sf.setProvider(new WebApplicationExceptionMapper());
sf.setProvider(new GenericExceptionMapper());
sf.setServiceBeans(Collections.singletonList(this));
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com