Control Your OSGi Application at Runtime

It is a common procedure to read the initial configuration of a classic Java program from a file system properties file. Once the program is up and running, changes made to the configuration will be ignored unless you deliberately watch for changes to the properties file.
OSGi runtimes provide a ConfigurationAdmin[1] to manage your initial configuration and handle changes during runtime. With
Eclipse Gemini Blueprint[2] it is possible to use POJOs like this:

public class EngineOrderTelegraph {

  private String order;

  public String getOrder() {
    return order;

  public void setOrder(String order) {
    System.out.println("Engine order changed to '" + order + "'");
    this.order = order;

If you are using Eclipse Virgo[3] you would add your preferences to the pickup directory of your server. To configure the current order of the engine order telegraph to “SLOW (ASTERN)” you’d have to add the following line:


The following blueprint configuration assumes that the properties file is named “”, and sets the initial order for the engine order telegraph to “STOP”.


With the OSGi console you can double-check the current configuration with the config command[4].

osgi> config examine labX

Factory pid:
Bundle Location: file:/.../virgo-tomcat-server-3.6.2.RELEASE/work/deployer/s/global/47/0/


There is an example of container managed and bean managed use of the ConfigurationAdmin at GitHUB[5].

You have the bridge, Number One

[1] Interface ConfigurationAdmin –
[2] Eclipse Gemini Blueprint, Compendium Services –
[3] Eclipse Virgo –
[4] Virgo User Guide, config command –

[image] engine order telegraph –

One Response to “Control Your OSGi Application at Runtime”

  1. Just a sidenode: I think handling with the config admin is always a pain especially when I have to write code to do some configuration. Recently I found Apache fileinstall which let you put your configuration in files and watches for changes out of the box.

One response so far

Written by . Published in Categories: Editors choice, Planet Eclipse, Planet OSGi

Looking for a job?

Karlsruhe / Remote
Karlsruhe / Victoria / Remote
Karlsruhe / Victoria / Remote