Sunday, March 4, 2012

Understanding the Runtime Properties of Apache Karaf

I often forget how I have configured a particular piece of software. If I'm not staring at the configuration data everyday it isn't worth remembering. When I finally need this information it takes much too long for me to locate it.

When the configuration is dynamic and only available at runtime my forgetfulness is even more frustrating. I resort to breakpoints, System.out.println() or other inefficient means to retrieve this information.

Apache Karaf has both kinds of configuration: runtime and static. The static information lives in $KARAF_HOME/etc and is easily discovered. The runtime configuration is a different story. The static configuration contains variables that have their values substituted at runtime based on JVM System properties, other configuration values and other sources like the OSGi framework. This contributes to a very frustrating development experience for the average Karaf application developer as well as the EIK project.

EIK recently gained the ability to "build" an Apache Karaf project. Just like a Java project builds class files so too does an Apache Karaf project build data files. In this case the interesting file is the file which contains the runtime configuration data that is ordinarily present when Karaf is running.

Upcoming versions of EIK will display basic information about the Apache Karaf project in use as seen here:

A quick glance gives the developer basic information such as the version of Karaf and where the runtime is installed.

Going one step further, EIK will also provide insight in to the running Karaf installation as seen here:

EIK has built a simulated runtime properties file and is displaying that information here. This has been useful during EIK development as I often forget what properties are available and sometimes make mistakes that omit or corrupt this important data. This is true when I'm development Karaf applications -- hopefully others will find this feature useful.