+ /** Determines the start levels for the bundles */
+ private static void computeBundlesToStart(
+ Map<String, Integer> bundlesToStart, Properties properties,
+ Integer defaultStartLevel) {
+
+ // default (and previously, only behaviour)
+ appendBundlesToStart(bundlesToStart, defaultStartLevel,
+ properties.getProperty(OsgiLauncherConstants.ARGEO_OSGI_START,
+ ""));
+
+ // list argeo.osgi.start.* system properties
+ Iterator<Object> keys = properties.keySet().iterator();
+ final String prefix = OsgiLauncherConstants.ARGEO_OSGI_START + ".";
+ while (keys.hasNext()) {
+ String key = (String) keys.next();
+ if (key.startsWith(prefix)) {
+ Integer startLevel;
+ String suffix = key.substring(prefix.length());
+ String[] tokens = suffix.split("\\.");
+ if (tokens.length > 0 && !tokens[0].trim().equals(""))
+ try {
+ // first token is start level
+ startLevel = new Integer(tokens[0]);
+ } catch (NumberFormatException e) {
+ startLevel = defaultStartLevel;
+ }
+ else
+ startLevel = defaultStartLevel;
+
+ // append bundle names
+ String bundleNames = properties.getProperty(key);
+ appendBundlesToStart(bundlesToStart, startLevel, bundleNames);
+ }
+ }
+ }
+
+ /** Append a comma-separated list of bundles to the start levels. */
+ private static void appendBundlesToStart(
+ Map<String, Integer> bundlesToStart, Integer startLevel, String str) {
+ if (str == null || str.trim().equals(""))
+ return;
+
+ String[] bundleNames = str.split(",");
+ for (int i = 0; i < bundleNames.length; i++) {
+ if (bundleNames[i] != null && !bundleNames[i].trim().equals(""))
+ bundlesToStart.put(bundleNames[i], startLevel);
+ }
+ }
+
+ /*
+ * HACKED UTILITIES
+ */