One other way that I can think of is, by introducing a service component
which has references to all OSGi service we require and then accessing the
data holder via web app.

On Sat, Feb 7, 2015 at 7:24 PM, Supun Sethunga <[email protected]> wrote:

> Hi,
>
> Im trying to expose some OSGI services as REST API's. (Please refer mail
> thread "[Architecture] REST API for Machine Learner")
> For that, i want to access the Service References of the services which
> were registered in the OSGI context by their respective bundle activators,
> from the web app (.war).
>
> I tried the following methods [1] and [2], But both returns a NULL bundle
> contexts.
> (Here 'Project.class' is the web app's class name)
>
> [1] BundleContext bundleContext =
> FrameworkUtil.getBundle(Project.class).getBundleContext();
>
> [2] @Context
>       ServletContext servletContext;
>       BundleContext bundleContext = (BundleContext)
> servletContext.getAttribute("osgi-bundlecontext");
>
> AFAIU this happens because the 'Project.class' is not loaded by an OSGi
> bundle class loader, because it is bundled as an web app.
>
> Is there a different apporach to expose the OSGi servioce as REST API's?
> Can anyone please shed some light here?
>
> --
> *Supun Sethunga*
> Software Engineer
> WSO2, Inc.
> lean | enterprise | middleware
> Mobile : +94 716546324
>



-- 

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to