Improve JavaScript launch
authorMathieu Baudier <mbaudier@argeo.org>
Sat, 5 May 2018 20:01:54 +0000 (22:01 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Sat, 5 May 2018 20:01:54 +0000 (22:01 +0200)
dist/argeo-node/base/bin/argeo-cms
dist/argeo-node/base/bin/argeo-cms.js [new file with mode: 0644]
dist/argeo-node/base/share/argeo/cms.js
dist/osgi-boot/base/bin/a2jjs
org.argeo.osgi.boot/src/org/argeo/osgi/boot/OsgiBoot.java
org.argeo.osgi.boot/src/org/argeo/osgi/boot/OsgiBuilder.java

index 9819b7e772950d17c8671bcf8f909800dc1ede1f..a1701a3ba41b58090b673ffc3a09c19df7e019d1 100755 (executable)
@@ -128,6 +128,6 @@ case "$1" in
        status
         ;;
   *)
-        echo $"Usage: $0 {start|stop|status}"
-        exit 1
+        start
+        ;;
 esac
\ No newline at end of file
diff --git a/dist/argeo-node/base/bin/argeo-cms.js b/dist/argeo-node/base/bin/argeo-cms.js
new file mode 100644 (file)
index 0000000..01a12d7
--- /dev/null
@@ -0,0 +1,6 @@
+#!/usr/bin/a2jjs\r
+load("share/argeo/cms.js");\r
+osgi.httpPort = 8080;\r
+//osgi.conf("argeo.node.useradmin.uris", "os:///");\r
+//osgi.clean = true;\r
+osgi.launch();\r
index 1e94fec9553f93082e888b881a0965b293569fe0..75353779deedf38f9ef75bdd89316a6b26651be1 100755 (executable)
@@ -20,6 +20,8 @@ osgi.conf("org.osgi.framework.bootdelegation", "com.sun.jndi.ldap,"
 
 var homeUri = java.nio.file.Paths
                .get(java.lang.System.getProperty("user.home")).toUri().toString();
+var execDirUri = java.nio.file.Paths.get(
+               java.lang.System.getProperty("user.dir")).toUri().toString();
 if (typeof app !== 'undefined') {
        if (typeof appHome == 'undefined') {
                var appHome = homeUri + "/.a2/var/lib/" + app;
@@ -32,7 +34,11 @@ if (typeof app !== 'undefined') {
        }
        osgi.conf("osgi.configuration.area", appHome + "/state");
        osgi.conf("osgi.instance.area", appHome + "/data");
-//     System.setProperty("java.security.manager", "");
-//     System.setProperty("java.security.policy", appConf + "/" + policyFile);
+       // System.setProperty("java.security.manager", "");
+       // System.setProperty("java.security.policy", appConf + "/" + policyFile);
        System.setProperty("log4j.configuration", appConf + "/log4j.properties");
+} else {
+       osgi.conf("osgi.configuration.area", execDirUri + "/state");
+       osgi.conf("osgi.instance.area", execDirUri + "/data");
+       System.setProperty("log4j.configuration", execDirUri + "etc/argeo/log4j.properties");
 }
index 62762a8584ea670da1cc9e257d9e029d570ae03c..128bcea35fab1b7c384fb5bb0fedb1a7630916ee 100755 (executable)
@@ -1,13 +1,6 @@
 #!/bin/sh
-
-export A2_HOME=$HOME/.a2
-if [ -d "$A2_HOME/share/osgi/boot" ]; then
-       PREFIX=$A2_HOME
-else
-       PREFIX=/usr
-fi
-
-EQUINOX=$PREFIX/share/osgi/boot/org.eclipse.osgi.jar
-OSGI_BOOT=$PREFIX/share/osgi/boot/org.argeo.osgi.boot.jar
+BIN_DIR=`dirname $0`
+EQUINOX=$BIN_DIR/../share/osgi/boot/org.eclipse.osgi.jar
+OSGI_BOOT=$BIN_DIR/../share/osgi/boot/org.argeo.osgi.boot.jar
 
 /usr/bin/jjs -cp "$EQUINOX:$OSGI_BOOT" $*
index 8ca9be77bb1d3b26fdb742dda6a2bcf4189dcee3..4c3ee40f0c2095da9860af6f4ef4316a72ae5c59 100644 (file)
@@ -52,7 +52,7 @@ import org.osgi.framework.wiring.FrameworkWiring;
 public class OsgiBoot implements OsgiBootConstants {
        public final static String PROP_ARGEO_OSGI_START = "argeo.osgi.start";
        public final static String PROP_ARGEO_OSGI_SOURCES = "argeo.osgi.sources";
-       
+
        public final static String PROP_ARGEO_OSGI_BUNDLES = "argeo.osgi.bundles";
        public final static String PROP_ARGEO_OSGI_BASE_URL = "argeo.osgi.baseUrl";
        public final static String PROP_ARGEO_OSGI_LOCAL_CACHE = "argeo.osgi.localCache";
@@ -115,6 +115,10 @@ public class OsgiBoot implements OsgiBootConstants {
                }
        }
 
+       ProvisioningManager getProvisioningManager() {
+               return provisioningManager;
+       }
+
        /*
         * HIGH-LEVEL METHODS
         */
@@ -162,6 +166,7 @@ public class OsgiBoot implements OsgiBootConstants {
        public void update() {
                provisioningManager.update();
        }
+
        /*
         * INSTALLATION
         */
index 28a2604a42c6c3fc6766b81ff5a94370b07d4ae8..8c460e1161e6cdba0cfe86b59594003e382a64d4 100644 (file)
@@ -63,12 +63,15 @@ public class OsgiBuilder {
                        OsgiBootUtils.debug("OSGi starting - data: " + osgiData + " conf: " + osgiConf);
 
                OsgiBoot osgiBoot = new OsgiBoot(framework.getBundleContext());
-               // install bundles
-               for (String distributionBundle : distributionBundles) {
-                       List<String> bundleUrls = osgiBoot.getDistributionUrls(distributionBundle, baseUrl);
-                       osgiBoot.installUrls(bundleUrls);
+               if (distributionBundles.isEmpty()) {
+                       osgiBoot.getProvisioningManager().install(null);
+               } else {
+                       // install bundles
+                       for (String distributionBundle : distributionBundles) {
+                               List<String> bundleUrls = osgiBoot.getDistributionUrls(distributionBundle, baseUrl);
+                               osgiBoot.installUrls(bundleUrls);
+                       }
                }
-
                // start bundles
                osgiBoot.startBundles(startLevelsToProperties());