Jump to: navigation, search

SMILA/Project Concepts/Simple configuration handler


Many of the SMILA bundles require configuration files. The org.eclipse.smila.utils.config.ConfigUtils support developers in accessing the configuration files.

By default the bundle's configuration files reside in a folder with the same name as the full qualified bundle name in a configuration folder.

For example the Jobmanager (bundle name is org.eclipse.smila.jobmanager) configuration resides in configuration/org.eclipse.smila.jobmanager and consists of several json files the Jobmanager accesses through the ConfigUtils.


To use the ConfigUtils you have to import the package org.eclipse.smila.utils.config.

The ConfigUtils class provides several convenience methods to list or access files or streams in the bundle's configuration folder. This folder can be

  • a central config folder
  • a default config delivered and deployed with the bundle (only for streams and properties, see below)

I.e. if a configuration file is requested, the central configuration folder is searched first, if there is no such file, the bundle will be examined for a fallback file and then this fallback file will be loaded, if it exists. If the requested file could not be determined or accessed, a ConfigurationLoadException will be thrown.

Configuring the configuration folder

The central configuration folder will be determined in the following order:

  • a system property of the name org.eclipse.smila.utils.config.root
  • an environment variable of the name org.eclipse.smila.utils.config.root
  • <org.eclipse.core.runtime.Platform.getInstallLocation()>/configuration (which will always yield a folder)


The ConfigUtils' JavaDoc can be found here.

Which methods have a bundle fallback and which not

Not all methods really look up the entries in the bundle if the files cannot be found in the configuration folder. The reason is that files cannot be loaded from the bundle, only streams can.

  • Lookup in the application's configuration folder only:
    • getConfigFile
    • getConfigFilePath
  • Lookup all entries from the application's configuration folder if present or (only if no such folder has been found) list fallbacks from the bundle:
    • getConfigEntries
  • First look up in the application's configuration folder, if no such file exists, look up fallback in the bundle
    • getConfigStream
    • getConfigProperties
    • getConfigContent


public static final String BUNDLE_ID = "org.eclipse.smila.jobmanager";
    final InputStream bucketsJson =
        ConfigUtils.getConfigStream(BUNDLE_ID, "buckets.json");
      try {
        final AnyMap bucketsAny = (AnyMap) _anyReader.readJsonStream(bucketsJson);
      } finally {

This snippet will load a file "buckets.json" from either the applications configuration folder config/org.eclipse.smila.jobmanager/buckets.json or if that did not exist from the same path within the bundle and converts it into an AnyMap.

public static final String BUNDLE_ID = "org.eclipse.smila.importing.state.objectstore";
    Properties props;
    try {
      props = ConfigUtils.getConfigProperties(BUNDLE_ID, "deltastore.properties");
    } catch (final Exception ex) {
      _log.info("No configuration " + BUNDLE_ID + "/" + " found, using default settings.");
      props = new Properties();

This snippet loads properties from either the applications configuration folder configuration/org.eclipse.smila.importing.state.objectstore or the same path within the bundle itself.