Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: OSGi in Web Application

ajinkya prabhune <[email protected]> Fri, 28 Jan 2011 19:10:52 +0100
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
Hi,

i found it while searching on some forums someone had pasted this code will
try to search again...
I am not sure but stackoverflow website.....

If this is not the correct way could u please help me out then ?

Thanks

On Fri, Jan 28, 2011 at 5:02 PM, Guillaume Sauthier <
[email protected]> wrote:

>
>
> Le 28/01/2011 15:40, ajinkya prabhune a écrit :
>
> Hi,
>
> I had this question...
>
> I am using a BundleContext in servlet for ex.
>
> getServletConfig().getServletContext().getAttribute("osgi-bundlecontext");
>
>
> Where did you find this ?
> Please show me the code of your servlet, it will be easier for everybody
> ...
> --G
>
>
>
> But I am not sure whether this is the correct method or not? and is
> "osgi-bundlecontext" predefined atrribute can i change or modify it ?
>
> is thereAnother way ?
>
>
> thanks
>
>  On Fri, Jan 28, 2011 at 2:13 PM, ajinkya prabhune <
> [email protected]> wrote:
>
>> Hi,
>>
>> Great I think most of my doubts have been cleared. :-)
>> Thanks a lot...
>>
>> Regards
>> Ajinkya
>>
>>   On Fri, Jan 28, 2011 at 1:07 PM, Guillaume Sauthier <
>> [email protected]> wrote:
>>
>>> It should be the context of your webapp.
>>> Just make sure that you handle dynamism of service ...
>>> --G
>>>
>>> Le 28/01/2011 12:47, ajinkya prabhune a écrit :
>>>
>>> Hi,
>>>
>>> Great ur answers made my confusion clear...
>>>
>>> This is what I did just tell me if i am correct.
>>>
>>> Will use only one bundle and one Web app for my explanation.
>>>
>>> 1. Bundle1 was registered as a Service.
>>> 2. In the Web App i made a ServiceLocator class and using ServiceTracker
>>> found out the Service.
>>>     also made a function to return the found service
>>>
>>> 3. In the Servlet I called that method which was discovered...
>>>
>>> It all worked thanks....
>>>
>>> One thing I have doubt is the BundleContext i need to send to my
>>> ServiLocator ... which bundlecontext shud that be?
>>>
>>>
>>>
>>>
>>> On Fri, Jan 28, 2011 at 11:22 AM, Guillaume Sauthier <
>>> [email protected]> wrote:
>>>
>>>>
>>>>
>>>> Le 28/01/2011 11:15, ajinkya prabhune a écrit :
>>>>
>>>> Hi,
>>>>
>>>>  Yes the Web Application is also a OSGi web based bundle.
>>>>
>>>>
>>>> Can you show me the content of your web app bundle ?
>>>> Are you using the HttpService ?
>>>>
>>>>
>>>>
>>>> Yes the Bundle1 and Bundle2 are services which I would like to use in my
>>>> Servlet.
>>>>
>>>>
>>>>  Bundles are bundles, and services are other things, do not confuse
>>>> them.
>>>> Bundles are the modules and simply contains classes
>>>> Services are runtime instances of classes registered in the OSGi service
>>>> registry (so that they can be used by others)
>>>>
>>>>
>>>>
>>>> I am getting confused how do I discover those services ?
>>>>
>>>>
>>>>  Using the BundleContext you get in your Activator (as a normal Bundle)
>>>>
>>>>
>>>>
>>>> Do I use bundlecontext and discover or is there any other way...
>>>>
>>>>
>>>>  BundleContext is that standard way.
>>>> Otherwise, you may use a component model to bastract yourself from the
>>>> OSGi API (See http://www.ipojo.org)
>>>>
>>>> --G
>>>>
>>>>
>>>>
>>>> Thanks
>>>>
>>>>  On Fri, Jan 28, 2011 at 10:24 AM, Guillaume Sauthier <
>>>> [email protected]> wrote:
>>>>
>>>>>
>>>>>
>>>>> Le 27/01/2011 21:34, ajinkya prabhune a écrit :
>>>>>
>>>>> Hi,
>>>>>
>>>>> Sorry for the later reply was not well...
>>>>>
>>>>> Hi my query was I have a web application say MyWebApplication.
>>>>>
>>>>>
>>>>>  Is it also a bundle ?
>>>>> ie : Do it have an OSGified META-INF/MANIFEST.MF with OSGi metadata in
>>>>> it ?
>>>>>
>>>>>
>>>>>
>>>>> It has dependency on 2 osgi bundles say MyBundle1 and MyBundle2....
>>>>>
>>>>>
>>>>>  It uses classes from theses bundles ?
>>>>>
>>>>>
>>>>>
>>>>> How can I access those Bundles in my Servlet or in my WebApplication...
>>>>>
>>>>>
>>>>>  Consider that your application have a parent ClassLoader that have a
>>>>> DynamicImport-Package *, so all packages exported by bundles will be
>>>>> available to your application classes...
>>>>>
>>>>>
>>>>>
>>>>> I hope u get my query ?
>>>>>
>>>>>
>>>>>  Are you using OSGi services or just the module layer ?
>>>>>
>>>>> --G
>>>>>
>>>>>
>>>>>
>>>>> Thank you
>>>>>
>>>>> On Mon, Jan 24, 2011 at 5:57 PM, S. Ali Tokmen <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hello
>>>>>>
>>>>>> Do you have a WAR file that also is an OSGi bundle?
>>>>>>
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> S. Ali Tokmenhttp://ali.tokmen.com/
>>>>>>
>>>>>> GSM (fr):  <tel:+33664300555>+33 66 43 00 555 <tel:+33664300555> [Orange]
>>>>>> GSM (tr):  <tel:+905552665273>+90 555 266 52 73 <tel:+905552665273> [Avea]
>>>>>>
>>>>>> My AIM, ICQ, MSN Messenger and Yahoo IM
>>>>>> contact details are on http://contact.ali.tokmen.com
>>>>>>
>>>>>>
>>>>>>  On 24.01.2011 17:30, ajinkya prabhune wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> i created a web application which access a osgi bundle in JOnAS (both
>>>>>> deployed in JOnAS)
>>>>>> but I am getting a missing constarint in import-package line of Web
>>>>>> Application...
>>>>>> I have properly imported all packages....
>>>>>> What might be gng wrong ?
>>>>>> thanks
>>>>>>
>>>>>>  On Mon, Jan 24, 2011 at 9:14 AM, Guillaume Sauthier <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> What do you call a web-based OSGi bundle ?
>>>>>>> For me, this is a normal bundle that is using the HttpService, no
>>>>>>> more no less.
>>>>>>> --G
>>>>>>>
>>>>>>> Le 22/01/2011 22:10, ajinkya prabhune a écrit :
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> Got some information about the Web application with OSGi,
>>>>>>>
>>>>>>> I wanted to ask whether a web based OSGi bundle is similar to the web
>>>>>>> service that we make and use in OSGi ?
>>>>>>> Also JOnAS uses Felix so how to do I make this Web Based OSGi bundle
>>>>>>> ??? (What does Felix offers me)
>>>>>>>
>>>>>>> Thanks and Regards
>>>>>>>
>>>>>>> On Fri, Jan 21, 2011 at 9:38 AM, ajinkya prabhune <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> hello
>>>>>>>>
>>>>>>>> I am trying to imlement a web application with OSGi support.
>>>>>>>>
>>>>>>>> like -  a web application will uses the services deployed in JOnAS
>>>>>>>> .. can someone guide me with this issue
>>>>>>>>
>>>>>>>> thanks
>>>>>>>>
>>>>>>>> --
>>>>>>>> Thank you and Regards
>>>>>>>> Ajinkya Prabhune
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Thank you and Regards
>>>>>>> Ajinkya Prabhune
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thank you and Regards
>>>>>> Ajinkya Prabhune
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Thank you and Regards
>>>>> Ajinkya Prabhune
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Thank you and Regards
>>>> Ajinkya Prabhune
>>>>
>>>>
>>>
>>>
>>> --
>>> Thank you and Regards
>>> Ajinkya Prabhune
>>>
>>>
>>
>>
>> --
>> Thank you and Regards
>> Ajinkya Prabhune
>>
>>
>
>
> --
> Thank you and Regards
> Ajinkya Prabhune
>
>


-- 
Thank you and Regards
Ajinkya Prabhune