Clarify naming.
[lgpl/argeo-commons.git] / dist / argeo-node / rpm / usr / share / node / jjs / cms.js
index 2f3bcc436744ec3b93e4b31627816f33e4e59d6c..446747f550b627d2d1fbd239f9127b73f5fffc6d 100755 (executable)
@@ -1,7 +1,8 @@
-var System = Java.type("java.lang.System")
+var System = Java.type("java.lang.System");
 var OsgiBuilder = Java.type("org.argeo.osgi.boot.OsgiBuilder");
 
 var osgi = new OsgiBuilder();
+// default bundles
 osgi.start(2, "org.eclipse.equinox.http.servlet");
 osgi.start(2, "org.eclipse.equinox.http.jetty");
 osgi.start(2, "org.eclipse.equinox.metatype");
@@ -10,35 +11,36 @@ osgi.start(2, "org.eclipse.rap.rwt.osgi");
 osgi.start(3, "org.argeo.cms");
 osgi.start(4, "org.eclipse.gemini.blueprint.extender");
 osgi.start(4, "org.eclipse.equinox.http.registry");
+// specific properties
 osgi.conf("org.eclipse.rap.workbenchAutostart", "false");
 osgi.conf("org.eclipse.equinox.http.jetty.autostart", "false");
 osgi.conf("org.osgi.framework.bootdelegation", "com.sun.jndi.ldap,"
                + "com.sun.jndi.ldap.sasl," + "com.sun.security.jgss,"
                + "com.sun.jndi.dns," + "com.sun.nio.file," + "com.sun.nio.sctp");
 
+var homeUri = java.nio.file.Paths
+               .get(java.lang.System.getProperty("user.home")).toUri().toString();
 if (typeof app !== 'undefined') {
        if (typeof appHome == 'undefined') {
-               var appHome = $ENV.HOME + "/.a2/var/lib/" + app;
+               var appHome = homeUri + "/.a2/var/lib/" + app;
        }
        if (typeof appConf == 'undefined') {
-               var appConf = $ENV.HOME + "/.a2/etc/" + app;
+               var appConf = homeUri + "/.a2/etc/" + app;
        }
        if (typeof policyFile == 'undefined') {
-               var policyFile = app + ".policy";
+               var policyFile = "node.policy";
        }
        osgi.conf("osgi.configuration.area", appHome + "/state");
        osgi.conf("osgi.instance.area", appHome + "/data");
        System.setProperty("java.security.manager", "");
-       System.setProperty("java.security.policy", "file://" + appConf + "/"
-                       + policyFile);
-       System.setProperty("log4j.configuration", "file://" + appConf
-                       + "/log4j.properties");
+       System.setProperty("java.security.policy", appConf + "/" + policyFile);
+       System.setProperty("log4j.configuration", appConf + "/log4j.properties");
 }
 
-function openUi(){
+function openWorkbench() {
        osgi.spring("org.argeo.cms.ui.workbench.rap");
-       var appUrl = "http://localhost:" + osgi.httpPort + "/ui/node";
-       $EXEC("/usr/bin/chromium-browser --app=" + appUrl);
+       var appUrl = "http://127.0.0.1:" + osgi.httpPort + "/ui/node";
+       $EXEC("chrome --app=" + appUrl);
        // shutdown when the window is closed
        osgi.shutdown();
 }
\ No newline at end of file