Applied patch (FELIX-250) to add support for setting Felix configuration
properties using system properties when using the standard Main
launcher.
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@519010 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/main/src/main/java/org/apache/felix/main/Main.java b/main/src/main/java/org/apache/felix/main/Main.java
index d428b83..a176d32 100644
--- a/main/src/main/java/org/apache/felix/main/Main.java
+++ b/main/src/main/java/org/apache/felix/main/Main.java
@@ -146,6 +146,9 @@
// Read configuration properties.
Properties configProps = Main.loadConfigProperties();
+ // Copy framework properties from the system properties.
+ Main.copySystemProperties(configProps);
+
// See if the profile name property was specified.
String profileName = configProps.getProperty(BundleCache.CACHE_PROFILE_PROP);
@@ -419,6 +422,21 @@
return props;
}
+ public static void copySystemProperties(Properties configProps)
+ {
+ for (Enumeration e = System.getProperties().propertyNames();
+ e.hasMoreElements(); )
+ {
+ String key = (String)e.nextElement();
+ if (key.startsWith("felix.") ||
+ key.equals("org.osgi.framework.system.packages") ||
+ key.equals("org.osgi.framework.bootdelegation"))
+ {
+ configProps.setProperty(key, System.getProperty(key));
+ }
+ }
+ }
+
private static final String DELIM_START = "${";
private static final String DELIM_STOP = "}";