in main/src/main/java/org/apache/servicemix/kernel/main/Main.java [744:814]
private Properties loadConfigProperties() throws Exception {
// The config properties file is either specified by a system
// property or it is in the conf/ directory of the Felix
// installation directory. Try to load it from one of these
// places.
ArrayList<File> bundleDirs = new ArrayList<File>();
// See if the property URL was specified as a property.
URL configPropURL = null;
URL startupPropURL = null;
try {
File file = new File(new File(servicemixBase, "etc"), CONFIG_PROPERTIES_FILE_NAME);
configPropURL = file.toURL();
file = new File(new File(servicemixBase, "etc"), STARTUP_PROPERTIES_FILE_NAME);
startupPropURL = file.toURL();
if (servicemixBase.equals(servicemixHome)) {
bundleDirs.add(new File(servicemixHome, "system"));
} else {
bundleDirs.add(new File(servicemixBase, "system"));
bundleDirs.add(new File(servicemixHome, "system"));
}
}
catch (MalformedURLException ex) {
System.err.print("Main: " + ex);
return null;
}
Properties configProps = loadPropertiesFile(configPropURL);
Properties startupProps = loadPropertiesFile(startupPropURL);
String locations = configProps.getProperty(BUNDLE_LOCATIONS);
if (locations != null) {
StringTokenizer st = new StringTokenizer(locations, "\" ", true);
if (st.countTokens() > 0) {
String location = null;
do {
location = nextLocation(st);
if (location != null) {
File f = new File(location);
if (f.exists() && f.isDirectory()) {
bundleDirs.add(f);
} else {
System.err.println("Bundle location " + location
+ " does not exist or is not a directory.");
}
}
}
while (location != null);
}
}
// Perform variable substitution for system properties.
for (Enumeration e = configProps.propertyNames(); e.hasMoreElements();) {
String name = (String) e.nextElement();
configProps.setProperty(name,
substVars(configProps.getProperty(name), name, null, configProps));
}
// Mutate properties
Main.processConfigurationProperties(configProps, startupProps, bundleDirs);
return configProps;
}