use of org.osgi.framework.BundleReference in project aries by apache.
the class Utils method getBundleContext.
private static BundleContext getBundleContext(ClassLoader cl2) {
ClassLoader cl = cl2;
BundleContext result = null;
while (result == null && cl != null) {
if (cl instanceof BundleReference) {
Bundle b = ((BundleReference) cl).getBundle();
result = b.getBundleContext();
if (result == null) {
try {
b.start();
result = b.getBundleContext();
} catch (BundleException e) {
}
break;
}
} else if (cl != null) {
cl = cl.getParent();
}
}
return result;
}
Aggregations