Run Modes

As of Sling 6 the bundle is replaced by the new Sling Settings ( Bundle. For backwards compatibility this bundle may still exist in your environment. New code should use the API of the new Sling Settings Bundle, though.


Run modes are meant to define different sets of configuration parameters for various Sling instances.

In a web publishing environment, for example, one could use run modes like staging, production, dev, dmz or combinations of such values.

The []({{ refs. }}) bundle provides a simple way of defining and querying a list of run modes.


The run mode service is not present in the default Sling launchpad builds, to activate it install and start the bundle.


Run modes can only be configured using a system property, or via the file.

Using,bar on the JVM command-line, for example, activates the foo and bar run modes.

This command-line parameter takes precedence over a similar definition (,staging) that might be present in the file found in the Sling home directory.

Getting the current list of run modes

The [RunMode service]({{ refs. }}) provides the current list of run modes, examples:

RunMode r = ...get from BundleContext...
String [] currentRunModes = r.getCurrentRunModes();

String [] expectedRunModes = { "foo", "wii" };
if(r.isActive(expectedRunModes)) {
  // at least one of (foo,wii) run modes
  // is active

See also

The RunMode service is used by the [jcrinstall]({{ refs.jcr-installer-provider.path }}) services.

- ( Run Modes )