Sorry, of course, Bundle.loadClass makes sense this way.

Thanks for your answer on permission checks.

--
André

-----Message d'origine-----
De : Thomas Watson [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 18 janvier 2007 19:51
À : felix-dev@incubator.apache.org
Objet : RE: Code sharing and code isolation

"BOTTARO Andre RD-MAPS-GRE" <[EMAIL PROTECTED]> wrote on 
01/18/2007 04:46:03 AM:

> 
> This is a question asked by mobile operators moving from a 
> constrained world (CLDC/MIDP) to a much more open one 
> (CDC/OMEE/OSGi)... Code sharing is attractive if the system could 
> guarantee the control of sharing and isolation mechanisms. 
> 
> I wasn't aware of the new method Bundle.loadClass(). It sounds like 
> a simple shortcut to 
Bundle.getClass().getClassLoader().loadClass(),isn't it ?
> 
> --
> André
> 

No Bundle.getClass().getClassLoader().loadClass() would just get the 
classloader used to load the org.osgi.framework.Bundle implementation 
class and then try to load a class with that classloader.  The Bundle 
object is implemented by the Framework so you would be just trying to 
load a class with the ClassLoader that is used to load the Framework.

Bundle.loadClass method loads a class from the perspective of a bundle.
Bundle.loadClass is protected by a permission check. 
Class.getClassLoader is projected by a permission check.  Also all 
constraints offered by OSGi are protected by permission checks
(Import-Package, Require-Bundle etc.).  So if a bundle is not given 
any permissions then it will only be able to load classes from itself.

HTH

Tom

Reply via email to