in plugins/org.apache.karaf.eik.ui/src/main/java/org/apache/karaf/eik/ui/project/impl/KarafRuntimePropertyBuildUnit.java [46:93]
public void build(final int kind, @SuppressWarnings("rawtypes") final Map args, 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);
// Add ref to karaf.etc for karaf-3.0.0
combinedProperties.put("karaf.etc", getKarafPlatformModel().getRootDirectory().append("etc").toOSString());
combinedProperties.put("karaf.data", getKarafPlatformModel().getRootDirectory().append("data").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");
runtimeFolder.refreshLocal(0, monitor);
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
}
}
}