+ if (configuration.getAttribute(ATTR_ADD_JVM_PATHS, false))
+ addVms(vmArgs);
+
+ // Add other system properties
+ for (String key : systemPropertiesToAppend.keySet())
+ addSysProperty(vmArgs, key, systemPropertiesToAppend.get(key));
+
+ vmArgs.append(" ").append(
+ configuration.getAttribute(ATTR_ADDITIONAL_VM_ARGS, ""));
+
+ configuration.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs
+ .toString());
+
+ // Program arguments
+ StringBuffer progArgs = new StringBuffer("");
+ if (dataDir != null) {
+ progArgs.append("-data ");
+ progArgs.append(surroundSpaces(dataDir));
+
+ if (configuration.getAttribute(ATTR_CLEAR_DATA_DIRECTORY, false)) {
+ File dataDirFile = new File(dataDir);
+ deleteDir(dataDirFile);
+ dataDirFile.mkdirs();
+ }
+ }
+ String additionalProgramArgs = configuration.getAttribute(
+ OsgiLauncherConstants.ATTR_ADDITIONAL_PROGRAM_ARGS, "");
+ progArgs.append(' ').append(additionalProgramArgs);
+ configuration.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ progArgs.toString());
+ }
+
+ /**
+ * Interprets special properties and register the others as system
+ * properties to append.
+ */
+ protected static void interpretProperties(Properties properties,
+ List<String> bundlesToStart,
+ Map<String, String> systemPropertiesToAppend) {
+ String argeoOsgiStart = properties
+ .getProperty(OsgiLauncherConstants.ARGEO_OSGI_START);
+ if (argeoOsgiStart != null) {
+ StringTokenizer st = new StringTokenizer(argeoOsgiStart, ",");
+ while (st.hasMoreTokens())
+ bundlesToStart.add(st.nextToken());
+ }
+
+ propKeys: for (Object keyObj : properties.keySet()) {
+ String key = keyObj.toString();
+ if (OsgiLauncherConstants.ARGEO_OSGI_START.equals(key))
+ continue propKeys;
+ else if (OsgiLauncherConstants.ARGEO_OSGI_BUNDLES.equals(key))
+ continue propKeys;
+ else if (OsgiLauncherConstants.ARGEO_OSGI_LOCATIONS.equals(key))
+ continue propKeys;
+ else if (OsgiLauncherConstants.OSGI_BUNDLES.equals(key))
+ continue propKeys;
+ else
+ systemPropertiesToAppend.put(key, properties.getProperty(key));
+ }
+
+ }
+
+ /** Adds a regular system property. */
+ protected static void addSysProperty(StringBuffer vmArgs, String key,
+ String value) {
+ surroundSpaces(value);
+ String str = "-D" + key + "=" + value;
+ // surroundSpaces(str);
+ vmArgs.append(' ').append(str);
+ }
+
+ /** Adds JVMS registered in the workspace as special system properties. */
+ protected static void addVms(StringBuffer vmArgs) {