I just tested this with the attached webapp and the OSGi service call from the webapp works as well.
On Thu, Jun 28, 2012 at 6:31 PM, Afkham Azeez <[email protected]> wrote: > After a discussion during today'd BAM REST API review, we came up with > this idea of allowing webapps, services etc. to obtain references to OSGi > services deployed in the platform using the Carbon APIs. As a result of > this, I have added the following methods to the SuperTenantCarbonContext. > > /** > * Obtain the first OSGi service found for interface or class > <code>clazz</code> > * @param clazz The type of the OSGi service > * @return The OSGi service > */ > public Object getOSGiService(Class clazz) > > > /** > * Obtain the OSGi services found for interface or class > <code>clazz</code> > * @param clazz The type of the OSGi service > * @return The List of OSGi services > */ > public List<Object> getOSGiServices(Class clazz) > > > > Usage example; > ListenerManager listenerManager = (ListenerManager) > * > SuperTenantCarbonContext.getCurrentContext().getOSGiService(ListenerManager.class) > *; > System.out.println("Is listener running: " + > !listenerManager.isStopped()); > > I have added & tested the above call in one of the Carbon kernel > integration tests. > > -- > *Afkham Azeez* > Director of Architecture; WSO2, Inc.; http://wso2.com > Member; Apache Software Foundation; http://www.apache.org/ > * <http://www.apache.org/>** > email: **[email protected]* <[email protected]>* cell: +94 77 3320919 > blog: **http://blog.afkham.org* <http://blog.afkham.org>* > twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> > * > linked-in: **http://lk.linkedin.com/in/afkhamazeez* > * > * > *Lean . Enterprise . Middleware* > > -- *Afkham Azeez* Director of Architecture; WSO2, Inc.; http://wso2.com Member; Apache Software Foundation; http://www.apache.org/ * <http://www.apache.org/>** email: **[email protected]* <[email protected]>* cell: +94 77 3320919 blog: **http://blog.afkham.org* <http://blog.afkham.org>* twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> * linked-in: **http://lk.linkedin.com/in/afkhamazeez* * * *Lean . Enterprise . Middleware*
carbon-api.war
Description: Binary data
index.jsp
Description: Binary data
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
