+ default void startRuntime(String relPath, String props) {
+ startRuntime(relPath, (config) -> {
+ loadProperties(config, props);
+ });
+ }
+
+ static void loadProperties(Map<String, String> config, Properties properties) {
+ for (Object key : properties.keySet()) {
+ config.put(key.toString(), properties.getProperty(key.toString()));
+ }
+ }
+
+ static void loadProperties(Map<String, String> config, String props) {
+ Properties properties = new Properties();
+ try (Reader reader = new StringReader(props)) {
+ properties.load(reader);
+ } catch (IOException e) {
+ throw new IllegalArgumentException("Cannot load properties", e);
+ }
+ loadProperties(config, properties);
+ }
+
+ static void loadProperties(Map<String, String> config, InputStream in) throws IOException {
+ Properties properties = new Properties();
+ properties.load(in);
+ loadProperties(config, properties);
+ }
+
+ static void loadDefaults(Map<String, String> config) {
+ try (InputStream in = RuntimeManager.class.getResourceAsStream("defaults.ini")) {
+ loadProperties(config, in);
+ } catch (IOException e) {
+ throw new IllegalStateException("Could not load runtime defaults", e);
+ }
+ }
+
+ /**
+ * Load configs recursively starting with the parent directories, until a
+ * jvm.args file is found.
+ */
+ @Deprecated