You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andrei Shakirin <as...@talend.com> on 2013/07/12 13:25:22 UTC

Register PolicyInterceptorProvider using blueprint or spring context

Hi,

I use bus-extensions.txt mechanism to register PolicyInterceptorProvider under OSGi.
This works almost always correct, except the cases when the interceptor code should obtain bundle context (for example to use OSGi ConfigurationAdmin properties or other OSGi services). Under some circumstances (I guess when CXF bus in bundle is updated) bundle context is null or incorrect.
I tried to get bundle context using

a)      CXF extension: BundleContext bundleContext = bus.getExtension(BundleContext.class)

b)      OSGi:
      Bundle runtimeBundle = FrameworkUtil.getBundle(MyCustomInterceptor.class);
     BundleContext bundleContext = runtimeBundle.getBundleContext();

but both methods seems to be not robust.

The question: is there alternative way to register PolicyInterceptorProvider in OSGi using Blueprint or SpringDM context?

Regards,
Andrei.