# Apache Felix Framework Configuration Properties

- Overview
- Framework configuration properties
- Launcher configuration properties
- Mirgrating from earlier versions
- Feedback

## Overview

This document describes the various configuration properties related to the Apache Felix Framework. Technically, there are framework properties and launcher properties. If you are using the Felix Framework JAR file (i.e., `org.apache.felix.framework-x.y.x.jar`), then you can only use framework properties. On the other hand, if you are using the Felix Main launcher JAR (i.e., `felix.jar` or `org.apache.felix.main-x.y.z.jar`), then you can use both framework and launcher properties. This document will describe both sets of properties.

Note that the framework does not use system properties to find its configuration properties, it only consults the map passed into its constructor. In contrast to bundles, which use `BundleContext.getProperty()`, which exposes both configuration and system properties at execution time. In the case of overlap, the configuration properties override system properties. As a convenience, if you are using the Felix launcher, it will copy all configuration properties it finds in the system properties to the configuration map passed into the framework constructor, which allows you to set configuration properties on the command line. This feature is not available if you are just using the Felix framework JAR file.

## Framework configuration properties

The following configuration properties are for the framework (properties starting with "`felix`" are specific to Felix, while those starting with "`org.osgi`" are standard OSGi properties):

- `org.osgi.framework.executionenvironment` - Sets the OSGi execution environment for the framework. The framework tries to set this to a reasonable default value. If you specify a value, it overrides the framework default. Refer to the OSGi specification for appropriate execution environment values.
- `org.osgi.framework.storage` - Sets the directory to use as the bundle cache; by default the bundle cache directory is `felix-cache` in the current working directory. The value should be a valid directory name. The directory name can be either absolute or relative. Relative directory names are relative to the current working directory. The specified directory will be created if it does not exist.
- `felix.cache.rootdir` - Sets the root directory used to calculate the bundle cache directory for relative directory names. If `org.osgi.framework.storage` is set to a relative name, by default it is relative to the current working directory. If this property is set, then it will be calculated as being relative to the specified root directory.
- `org.osgi.framework.storage.clean` - Determines whether the bundle cache is flushed. The value can either be "`none`" or "`onFirstInit`", where "`none`" does not flush the bundle cache and "`onFirstInit`" flushes the bundle cache when the framework instance is first initialized. The default value is "`none`".
- `felix.cache.locking` - Enables or disables bundle cache locking, which is used to prevent concurrent access to the bundle cache. This is enabled by default, but on older/smaller JVMs file channel locking is not available; set this property to `false` to disable it.
- `felix.cache.bufsize` - Sets the buffer size to be used by the cache; the default value is 4096. The integer value of this string provides control over the size of the internal buffer of the disk cache for performance reasons.
- `org.osgi.framework.system.packages` - Specifies a comma-delimited list of packages that should be exported via the System Bundle from the framework class loader. The framework will set this to a reasonable default. If the value is specified, it replaces any default value.
- `org.osgi.framework.system.packages.extra` - Specifies a comma-delimited list of packages that should be exported via the System Bundle from the framework class loader in addition to the packages in `org.osgi.framework.system.packages`. The default value is empty. If a value is specified, it is appended to the list of default or specified packages in `org.osgi.framework.system.packages`.
- `org.osgi.framework.bootdelegation` - Specifies a comma-delimited list of packages that should be made implicitly available to all bundles from the parent class loader. It is recommended not to use this property since it breaks modularity. The default value is empty.
- `org.osgi.framework.bundle.parent` - Specifies which class loader is used for boot delegation. Possible values are: `boot` for the boot class loader, `app` for the application class loader, `ext` for the extension class loader, and `framework` for the framework's class loader. The default is `boot`.
- `felix.bootdelegation.implicit` - Specifies whether the framework should try to guess when to implicitly boot delegate to ease integration with external code. The default value is `true`.
- `felix.systembundle.activators` - A `List` of `BundleActivator` instances that are started/stopped when the System Bundle is started/stopped. The specified instances will receive the System Bundle's `BundleContext` when invoked. (This property cannot be set in the configuration file since it requires instances; it can only be passed into Felix' constructor directly.)
- `felix.log.logger` - An instance of `Logger` that the framework uses as its default logger. (This property cannot be set in the configuration file since it requires an instance; it can only be passed into Felix' constructor directly.)
- `felix.log.level` - An integer value indicating the degree of logging reported by the framework; the higher the value the more logging is reported. If zero ('0') is specified, then logging is turned off completely. The log levels match those specified in the OSGi Log Service (i.e., 1 = error, 2 = warning, 3 = information, and 4 = debug). The default value is 1.
- `org.osgi.framework.startlevel.beginning` - The initial start level of the framework once it starts execution; the default value is 1.
- `felix.startlevel.bundle` - The default start level for newly installed bundles; the default value is 1.
- `felix.service.urlhandlers` - Flag to indicate whether to activate the URL Handlers service for the framework instance; the default value is `true`. Activating the URL Handlers service will result in the `URL.setURLStreamHandlerFactory()` and `URLConnection.setContentHandlerFactory()` being called.

## Launcher configuration properties

The following configuration properties are for the launcher:

- `felix.auto.deploy.dir` - Specifies the auto-deploy directory from which bundles are automatically deployed at framework startup. The default is the `bundle/` directory of the current directory.
- `felix.auto.deploy.action` - Specifies a comma-delimited list of actions to be performed on bundle JAR files found in the auto-deploy directory. The possible actions are `install`, `update`, `start`, and `uninstall`. An undefined or blank value is equivalent to disabling auto-deploy processing; there is no default value, so this value must be defined to enable it.
- `felix.auto.install.<n>` - Space-delimited list of bundle URLs to automatically install when Felix is started, where `<n>` is the start level into which the bundle will be installed (e.g., `felix.auto.install.2`).
- `felix.auto.start.<n>` - Space-delimited list of bundle URLs to automatically install and start when Felix is started, where `<n>` is the start level into which the bundle will be installed (e.g., `felix.auto.start.2`).
- `felix.shutdown.hook` - Specifies whether the launcher should install a shutdown hook to cleanly shutdown the framework on process exit. The default value is `true`.

## Migrating from Earlier Versions

Apache Felix Framework `2.0.0` introduced significant configuration property changes. This section describes the differences from older versions of the framework.

- Removed
  - `felix.embedded.execution` - No longer needed, since the framework now never calls `System.exit()`; the creator of the framework is now always responsible for exiting the VM.
  - `felix.strict.osgi` - No longer needed, since all non-specification features have been removed.
  - `felix.cache.dir` - No longer needed, since Felix no longer uses bundle cache profiles for saving sets of bundles.
  - `felix.cache.profile` - No longer needed, since the framework no longer uses bundle cache profiles for saving sets of bundles.
  - `felix.fragment.validation` - No longer needed, since the framework supports fragments.
- Renamed
  - `felix.cache.profiledir` - The equivalent of this property is now named `org.osgi.framework.storage`.
  - `felix.startlevel.framework` - The equivalent of this property is now named `org.osgi.framework.startlevel.beginning`.
- Introduced
  - `org.osgi.framework.system.packages.extra` - New property, as described above, added to align with standard framework API.
  - `org.osgi.framework.storage.clean` - New property, as described above, added to align with standard framework API.
  - `felix.cache.rootdir` - Introduced as a result of removing bundle profiles to help resolve relative bundle cache directories.

For the most part, these changes are minor and previous behavior achieved from older configuration properties is either easily attained with the new properties or no longer necessary.

## Feedback

Subscribe to the Felix users mailing list by sending a message to users-subscribe@felix.apache.org; after subscribing, email questions or feedback to users@felix.apache.org.