[prev in list] [next in list] [prev in thread] [next in thread]
List: esb-java-dev
Subject: Re: [Dev] New API methods in SuperTenantCarbonContext to get hold of OSGi service references
From: Buddhika Chamith <buddhikac () wso2 ! com>
Date: 2012-06-30 5:26:16
Message-ID: CADoiKczuhvx_wCtMBzUJW5sovZn12hV-Gj04m=2+9SsrMasAAg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Yes. It's working as expected from my web app. Thanks.
Regards
Buddhika
On Fri, Jun 29, 2012 at 9:10 PM, Afkham Azeez <azeez@wso2.com> wrote:
> 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 <azeez@wso2.com> 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: **azeez@wso2.com* <azeez@wso2.com>* 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: **azeez@wso2.com* <azeez@wso2.com>* 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*
>
>
[Attachment #5 (text/html)]
Yes. It's working as expected from my web app. \
Thanks.<br><br>Regards<br>Buddhika<br><br><div class="gmail_quote">On Fri, Jun 29, \
2012 at 9:10 PM, Afkham Azeez <span dir="ltr"><<a href="mailto:azeez@wso2.com" \
target="_blank">azeez@wso2.com</a>></span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">I just tested this with the attached webapp and the OSGi \
service call from the webapp works as well.<div class="HOEnZb"> <div \
class="h5"><div><br><br><div class="gmail_quote">On Thu, Jun 28, 2012 at 6:31 PM, \
Afkham Azeez <span dir="ltr"><<a href="mailto:azeez@wso2.com" \
target="_blank">azeez@wso2.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div>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.</div>
<div><br></div><div>/**</div><div> * Obtain the first OSGi service found for \
interface or class <code>clazz</code></div><div> * @param clazz The \
type of the OSGi service</div><div> * @return The OSGi service</div>
<div> */</div><div> public Object getOSGiService(Class \
clazz)</div><div><br></div><div><br></div><div> /**</div><div> * Obtain the OSGi \
services found for interface or class <code>clazz</code></div>
<div> * @param clazz The type of the OSGi service</div><div> * @return The \
List of OSGi services</div><div> */</div><div> public List<Object> \
getOSGiServices(Class clazz)</div><div><br></div><div><br>
</div><div><br></div><div>Usage example;</div><div><div> ListenerManager \
listenerManager = (ListenerManager)</div><div> \
<b>SuperTenantCarbonContext.getCurrentContext().getOSGiService(ListenerManager.class)</b>;</div>
<div> System.out.println("Is listener running: " + \
!listenerManager.isStopped());</div><div><br></div><div>I have added & tested the \
above call in one of the Carbon kernel integration tests.</div><span><font \
color="#888888"><div>
<br></div>-- <br><b>Afkham Azeez</b><br><font face="verdana, sans-serif"><span \
style="font-size:x-small"><span style="font-family:arial;font-size:small"><font \
face="verdana, sans-serif"><span style="font-size:x-small">Director of \
Architecture</span></font>; <span style="font-size:x-small">WSO2, Inc.; </span><a \
href="http://wso2.com/" target="_blank"><span \
style="font-size:x-small">http://wso2.com</span></a></span></span></font><span \
style="font-size:x-small"><br>
<span style="font-size:small"><span style="font-size:x-small">Member; Apache Software \
Foundation; </span><span style="font-size:x-small"><a href="http://www.apache.org/" \
target="_blank">http://www.apache.org/</a></span></span><br>
</span><div><i><span style="font-size:x-small"><a href="http://www.apache.org/" \
target="_blank"></a></span></i><i><span style="font-size:x-small"><br>email: \
</span></i><a href="mailto:azeez@wso2.com" target="_blank"><i><span \
style="font-size:x-small">azeez@wso2.com</span></i></a><i><span \
style="font-size:x-small"> cell: <a href="tel:%2B94%2077%203320919" \
value="+94773320919" target="_blank">+94 77 3320919</a><br>
blog: </span></i><a href="http://blog.afkham.org" target="_blank"><i><span \
style="font-size:x-small">http://blog.afkham.org</span></i></a><i><span \
style="font-size:x-small"><br>twitter: </span></i><a \
href="http://twitter.com/afkham_azeez" target="_blank"><i><span \
style="font-size:x-small">http://twitter.com/afkham_azeez</span></i></a><i><span \
style="font-size:x-small"><br>
linked-in: </span></i><i><span style="font-size:x-small"><a \
href="http://lk.linkedin.com/in/afkhamazeez" \
target="_blank">http://lk.linkedin.com/in/afkhamazeez</a></span></i><br><div></div><div><i><br></i></div><div><i><span \
style="font-style:normal"><span style="font-size:x-small">Lean . Enterprise . \
Middleware</span></span></i></div>
</div><br>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><b>Afkham \
Azeez</b><br><font face="verdana, sans-serif"><span style="font-size:x-small"><span \
style="font-family:arial;font-size:small"><font face="verdana, sans-serif"><span \
style="font-size:x-small">Director of Architecture</span></font>; <span \
style="font-size:x-small">WSO2, Inc.; </span><a href="http://wso2.com/" \
target="_blank"><span \
style="font-size:x-small">http://wso2.com</span></a></span></span></font><span \
style="font-size:x-small"><br>
<span style="font-size:small"><span style="font-size:x-small">Member; Apache Software \
Foundation; </span><span style="font-size:x-small"><a href="http://www.apache.org/" \
target="_blank">http://www.apache.org/</a></span></span><br>
</span><div><i><span style="font-size:x-small"><a href="http://www.apache.org/" \
target="_blank"></a></span></i><i><span style="font-size:x-small"><br>email: \
</span></i><a href="mailto:azeez@wso2.com" target="_blank"><i><span \
style="font-size:x-small">azeez@wso2.com</span></i></a><i><span \
style="font-size:x-small"> cell: <a href="tel:%2B94%2077%203320919" \
value="+94773320919" target="_blank">+94 77 3320919</a><br>
blog: </span></i><a href="http://blog.afkham.org" target="_blank"><i><span \
style="font-size:x-small">http://blog.afkham.org</span></i></a><i><span \
style="font-size:x-small"><br>twitter: </span></i><a \
href="http://twitter.com/afkham_azeez" target="_blank"><i><span \
style="font-size:x-small">http://twitter.com/afkham_azeez</span></i></a><i><span \
style="font-size:x-small"><br>
linked-in: </span></i><i><span style="font-size:x-small"><a \
href="http://lk.linkedin.com/in/afkhamazeez" \
target="_blank">http://lk.linkedin.com/in/afkhamazeez</a></span></i><br><div></div><div><i><br></i></div><div><i><span \
style="font-style:normal"><span style="font-size:x-small">Lean . Enterprise . \
Middleware</span></span></i></div>
</div><br>
</div>
</div></div></blockquote></div><br>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic