X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.init%2Fsrc%2Forg%2Fargeo%2Finit%2FRuntimeManagerMain.java;h=f4ed507c07b37229cd73b8ccbd376deadcef8f22;hb=c7b612ca9bd7df43b0bec37c8abcae846587c978;hp=7a3f781391f9fd72e02424fb807ff63a5ae4a025;hpb=f92ba77466d18fcd0e7a9386ae0f16b530337f9f;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.init/src/org/argeo/init/RuntimeManagerMain.java b/org.argeo.init/src/org/argeo/init/RuntimeManagerMain.java index 7a3f78139..f4ed507c0 100644 --- a/org.argeo.init/src/org/argeo/init/RuntimeManagerMain.java +++ b/org.argeo.init/src/org/argeo/init/RuntimeManagerMain.java @@ -17,11 +17,10 @@ import org.argeo.api.init.InitConstants; import org.argeo.api.init.RuntimeContext; import org.argeo.api.init.RuntimeManager; import org.argeo.init.logging.ThinLoggerFinder; +import org.argeo.init.osgi.OsgiBoot; import org.argeo.init.osgi.OsgiRuntimeContext; import org.argeo.internal.init.InternalState; -import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; import org.osgi.framework.FrameworkEvent; import org.osgi.framework.launch.Framework; @@ -59,18 +58,6 @@ public class RuntimeManagerMain implements RuntimeManager { } public void run() { -// try { -// for (Path p : Files.newDirectoryStream(Paths.get("/usr/local/lib/a2"), "*.so")) { -// try { -// System.load(p.toString()); -// } catch (UnsatisfiedLinkError e) { -// e.printStackTrace(); -// } -// } -// } catch (IOException e) { -// e.printStackTrace(); -// } - OsgiRuntimeContext managerRuntimeContext = new OsgiRuntimeContext(configuration); try { managerRuntimeContext.run(); @@ -81,16 +68,12 @@ public class RuntimeManagerMain implements RuntimeManager { BundleContext bc = managerRuntimeContext.getFramework().getBundleContext(); // uninstall init as a bundle since it will be available via OSGi system - for (Bundle b : bc.getBundles()) { - if (b.getSymbolicName().equals(SYMBOLIC_NAME_INIT)) { - b.uninstall(); - } - } + OsgiBoot.uninstallBundles(bc, SYMBOLIC_NAME_INIT); bc.registerService(RuntimeManager.class, this, new Hashtable<>(configuration)); logger.log(Level.DEBUG, "Registered runtime manager"); managerRuntimeContext.waitForStop(0); - } catch (InterruptedException | BundleException e) { + } catch (InterruptedException e) { e.printStackTrace(); System.exit(1); } @@ -149,21 +132,6 @@ public class RuntimeManagerMain implements RuntimeManager { OsgiRuntimeContext runtimeContext = loadRuntime(relPath, configCallback); runtimeContext.run(); Framework framework = runtimeContext.getFramework(); - -// for (Bundle b : framework.getBundleContext().getBundles()) { -// try { -//// if (b.getSymbolicName().startsWith("org.eclipse.swt.gtk")) { -//// b.uninstall(); -//// } -//// else if (b.getSymbolicName().startsWith("org.eclipse.jface")) { -//// b.uninstall(); -//// } -// } catch (Exception e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } - if (framework != null) {// in case the framework has closed very quickly after run framework.getBundleContext().addFrameworkListener((e) -> { if (e.getType() >= FrameworkEvent.STOPPED) {