package org.argeo.init.osgi;
+import static java.lang.System.Logger.Level.WARNING;
+
+import java.lang.System.Logger;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.osgi.service.packageadmin.ExportedPackage;
import org.osgi.service.packageadmin.PackageAdmin;
-@SuppressWarnings("deprecation")
class OsgiBootDiagnostics {
+ private final static Logger logger = System.getLogger(OsgiBootDiagnostics.class.getName());
+
private final BundleContext bundleContext;
public OsgiBootDiagnostics(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
+
/*
* DIAGNOSTICS
*/
}
if (unresolvedBundles.size() != 0) {
- OsgiBootUtils.warn("Unresolved bundles " + unresolvedBundles);
+ logger.log(WARNING, "Unresolved bundles " + unresolvedBundles);
+ }
+
+ // try to start unresolved bundles in order to trigger diagnostics
+ // (this should not have side-effects since unresolved bundles won't be able to
+ // start)
+ for (Bundle b : unresolvedBundles) {
+ try {
+ b.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}