[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] org.osgi.framework.Bundle from java.lang.Class

I would like to know, from outside the framework, which bundle a particular class belongs to. I can use the following code snippet

                ClassLoader loader = clazz.getClassLoader();
                BaseClassLoader baseClassLoader = (BaseClassLoader)loader;
                Bundle bundle = baseClassLoader.getClasspathManager().getBaseData().getBundle();

but I get "Discouraged access ..." warnings because the org.eclipse.osgi.baseadaptor package is x-internal. Is there another way to do it?

Thanks in advance.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx