You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Karabo Molema <ko...@gmail.com> on 2012/11/18 20:06:22 UTC

Searching through classloaders

Hi, I am a beginner when it comes to OSGi, is it possible to search
through the different classloaders
in a container to see if certain classes are available and\or loaded
into memory?

Re: Searching through classloaders

Posted by Karabo Molema <ko...@gmail.com>.
Hi, thanks for the help. After thinking about it, I think it's best I
explore this through the api's that come with OSGi, instead of going
the classloader route

regards
karabo

On Sun, Nov 18, 2012 at 9:49 PM, David Jencks <da...@yahoo.com> wrote:
> As JB says, in osgi you should think in terms of packages rather than classes.  At a lower level than the karaf shell,   in osgi 4.3 frameworks there is the bundle wiring api and in earlier frameworks the PackageAdmin service to let you investigate this stuff programatically.
>
> thanks
> david jencks
>
> On Nov 18, 2012, at 11:43 AM, Jean-Baptiste Onofré wrote:
>
>> Hi,
>>
>> you can get the classloader from each bundle.
>> IMHO, it's not the right approach and you shouldn't do this: OSGi modules (about exported/imported packages, etc) is more interesting (including the packages version for instance). For instance, in Karaf you have packages:export and packages:import commands to see that.
>>
>> Regards
>> JB
>>
>> On 11/18/2012 08:06 PM, Karabo Molema wrote:
>>> Hi, I am a beginner when it comes to OSGi, is it possible to search
>>> through the different classloaders
>>> in a container to see if certain classes are available and\or loaded
>>> into memory?
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>

Re: Searching through classloaders

Posted by David Jencks <da...@yahoo.com>.
As JB says, in osgi you should think in terms of packages rather than classes.  At a lower level than the karaf shell,   in osgi 4.3 frameworks there is the bundle wiring api and in earlier frameworks the PackageAdmin service to let you investigate this stuff programatically.

thanks
david jencks

On Nov 18, 2012, at 11:43 AM, Jean-Baptiste Onofré wrote:

> Hi,
> 
> you can get the classloader from each bundle.
> IMHO, it's not the right approach and you shouldn't do this: OSGi modules (about exported/imported packages, etc) is more interesting (including the packages version for instance). For instance, in Karaf you have packages:export and packages:import commands to see that.
> 
> Regards
> JB
> 
> On 11/18/2012 08:06 PM, Karabo Molema wrote:
>> Hi, I am a beginner when it comes to OSGi, is it possible to search
>> through the different classloaders
>> in a container to see if certain classes are available and\or loaded
>> into memory?
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com


Re: Searching through classloaders

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

you can get the classloader from each bundle.
IMHO, it's not the right approach and you shouldn't do this: OSGi 
modules (about exported/imported packages, etc) is more interesting 
(including the packages version for instance). For instance, in Karaf 
you have packages:export and packages:import commands to see that.

Regards
JB

On 11/18/2012 08:06 PM, Karabo Molema wrote:
> Hi, I am a beginner when it comes to OSGi, is it possible to search
> through the different classloaders
> in a container to see if certain classes are available and\or loaded
> into memory?
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com