Improve UI lifecycle
authorMathieu Baudier <mbaudier@argeo.org>
Sat, 3 Feb 2018 22:18:25 +0000 (23:18 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Sat, 3 Feb 2018 22:18:25 +0000 (23:18 +0100)
demo/argeo_node.js
dist/argeo-node/rpm/usr/share/node/jjs/cms.js
org.argeo.osgi.boot/src/org/argeo/osgi/boot/OsgiBuilder.java

index e2af03d17acf91ff80608efb818e92acd0cfb44c..bfc644129564d78970b3acf9bbc08bb7db6318f0 100755 (executable)
@@ -15,11 +15,12 @@ osgi.conf("org.osgi.service.http.port", 0);
 
 // osgi.conf("osgi.clean", true);
 osgi.launch();
+openUi();
 
 // wait for UI
-osgi.spring("org.argeo.cms.ui.workbench.rap");
-var appUrl = "http://localhost:" + osgi.httpPort + "/ui/node";
-$EXEC("/usr/bin/chromium-browser --app=" + appUrl);
-
-// shutdown when the windows is closed
-osgi.shutdown();
\ No newline at end of file
+//osgi.spring("org.argeo.cms.ui.workbench.rap");
+//var appUrl = "http://localhost:" + osgi.httpPort + "/ui/node";
+//$EXEC("/usr/bin/chromium-browser --app=" + appUrl);
+//
+//// shutdown when the windows is closed
+//osgi.shutdown();
\ No newline at end of file
index b78fe0b5f235a1207f55ecdcfa388e4e1e9af40e..2f3bcc436744ec3b93e4b31627816f33e4e59d6c 100755 (executable)
@@ -33,4 +33,12 @@ if (typeof app !== 'undefined') {
                        + policyFile);
        System.setProperty("log4j.configuration", "file://" + appConf
                        + "/log4j.properties");
+}
+
+function openUi(){
+       osgi.spring("org.argeo.cms.ui.workbench.rap");
+       var appUrl = "http://localhost:" + osgi.httpPort + "/ui/node";
+       $EXEC("/usr/bin/chromium-browser --app=" + appUrl);
+       // shutdown when the window is closed
+       osgi.shutdown();
 }
\ No newline at end of file
index 3dfe486d094816220b5cf448901a42bc91264849..81315cf4ede73dc542fa389330f3cb3ac7b21c06 100644 (file)
@@ -159,6 +159,12 @@ public class OsgiBuilder {
                        e.printStackTrace();
                        System.exit(1);
                }
+               try {
+                       framework.waitForStop(10 * 60 * 1000);
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+                       System.exit(1);
+               }
                System.exit(0);
        }