in plugins/org.apache.karaf.eik.ui/src/main/java/org/apache/karaf/eik/ui/project/KarafProjectBuilder.java [190:230]
private void buildRuntimeProperties(final IProgressMonitor monitor) throws CoreException {
final String karafHome = getKarafPlatformModel().getRootDirectory().toOSString();
final Properties combinedProperties = new Properties();
combinedProperties.put("karaf.home", karafHome);
combinedProperties.put("karaf.base", karafHome);
combinedProperties.put("karaf.data", getKarafPlatformModel().getRootDirectory().append("data").toOSString());
// Add ref to karaf.etc for karaf-3.0.0
combinedProperties.put("karaf.etc", getKarafPlatformModel().getRootDirectory().append("etc").toOSString());
for (final String filename : new String[]{"config.properties", "system.properties", "users.properties"}) {
final Properties fileProperties = KarafCorePluginUtils.loadProperties(getKarafPlatformModel().getConfigurationDirectory().toFile(), filename, true);
combinedProperties.putAll(fileProperties);
}
PropertyUtils.interpolateVariables(combinedProperties, combinedProperties);
final IFolder runtimeFolder = getKarafProject().getFolder("runtime");
if (!runtimeFolder.exists()) {
runtimeFolder.create(true, true, monitor);
}
final IPath runtimeProperties = runtimeFolder.getRawLocation().append("runtime").addFileExtension("properties");
FileOutputStream out = null;
try {
out = new FileOutputStream(runtimeProperties.toFile());
combinedProperties.store(out, "Combined interpolated runtime properties");
} catch (final IOException e) {
throw new CoreException(
new Status(IStatus.ERROR, KarafUIPluginActivator.PLUGIN_ID, "Unable to build runtime property file", e));
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ioException) {
// ignore
}
}
}