Bundle: dirdeployer
Version 4.0.1

Directory Deployer

A bundle which scans file system directories for files that it can install, update or uninstall. The directory deployer bundle handles both bundle files and configuration files. When a file is updated the bundle / configuration will be updated and when a file is removed from the scanned directory the bundle / configuration will be removed.

This is a quite useful tool for handle bundle and configuration deployment without using any console. Just copy the file that should be installed to the deploy directory, and the directory deployer will find and activate them. When the files are removed, they are uninstalled.

Deploy method

The procedure for scanning and deploying is as follows:

  1. Check if any new files have appeared or if any already deployed files has been replaced with newer files.
  2. New files are installed into the framework.
    At the end of the scan any bundle that was installed will be started according to its activation policy. Any fragment that was installed will be attached to its host (be resolving it).
  3. Updated files (newer than a previously deployed bundle) are not installed again, instead, the installed bundle or configuration is updated from the new file.
  4. Check if there are bundles or configurations installed by the directory deployer that does not correspond to a file found during the directory scan. If any such bundle or configuration is found uninstall it.
  5. If any bundle update was performed during the scan, perform a refresh bundles operation for them using the in the framework wiring API.
  6. Start newly installed bundles that can be started, resolve newly installed fragments. Note that there will only be one start / resolve attempt made for each bundle after an install or update.
  7. Sleep a while
  8. Repeat from 1.

Deployable File Types

The Directory Deployer supports deploying of bundles and configurations:

A sample XML-file with a configuration for the Directory Deployer bundle itself can be downloaded here.

To create a CM configuration from scratch one may use the CM-tab in Knopflerfish desktop, it presents a simple GUI based on configuration meta type descriptions provided by configurable bundles. The CM-tab is not visible in the Desktop when starting with the default set of bundles, to activate it one must install and start three more bundles from the Knopflerfish distribution: metatype (OSGi Metatyp APIs), kf_metatype_all (Knopflerfish Metatyp Service implementation) and cm_desktop (the CM-tab desktop plug in itself).

To save an existing CM configuration as cm_data XML one may use the CM-tab in the Knopflerfish desktop, it provides an Export... button that will export the current configuration as a cm_data XML file. It is also possible to use the Knopflerfish console command configuration export. See CM Commands for details. Avoid writing cm_data XML files by hand since the parser for the cm_data XML documents is written for machine generated documents so it does not give usable error messages when something in the XML-document is wrong.


See metatype.xml for specification using CM. The same properties as defined by CM are also read as default values from framework properties. Thus, the bundle can be both configured by CM and using system properties.

You can set the deployment directory in metatype.xml in the bundle's resource directory (defaults to ./load). A relative deployment directory path is relative to the directory from which the framework is started.

The table below describes the framework properties that may be used to set the default values for the directory deployer configuration.
Name Description Type Default
org.knopflerfish.fileinstall.dir Set the directories that should be scanned.

The value should be a comma-separated list of directory paths.

String ./load
org.knopflerfish.fileinstall.poll Poll interval in milliseconds between directory scans. Must be at least 100 ms. long 1000

When this property is true the Directory Deployer will not set any start level for bundles it installs thus those bundles will belong to the default start level (i.e., the current initial start level according to the Framework Start Level API).

When this property is false the Directory Deployer will assign the start level given by org.knopflerfish.fileinstall.startlevel to the bundles it installs.

boolean true
org.knopflerfish.fileinstall.startlevel Bundle start level to assign to all newly installed bundles. Note that you must set org.knopflerfish.fileinstall.startlevel to false for this property to have an effect. int The initial bundle start level as returned by the StartLevel-API.
org.knopflerfish.fileinstall.uninstallOnStop If true then the directory deployer will uninstall all bundles and configurations that it has installed when it stops. boolean true

Bundle Jar docs


Exported Packages

org.knopflerfish.service.dirdeployer0.0.0dirdeployer_all-4.0.1, dirdeployer_api-4.0.1