Directory Scanner

Overview

The directory scanner installs bundles contained in a file folder or in a zip file.

Syntax

scan-dir:directory_url[!/filter][@start_level][@nostart][@update]

where:

  • directory_url : mandatory; is the url of a directory or a zip file containing the bundles to be installed and could be:
    • an file url (starting with file) that denotes a directory or an zip file
    • a local system file name that denotes a directory or an zip file
    • any url that denotes a zip file
  • filter : optional; is a #filter specification over the bundles that will be installed;
  • start_level : optional; an integer representing the start level of the bundles present in the pom.
    If present and OSGi Start Level Service is available then the bundle is installed with that specific start level.
    This option overwrites the startLevel #configuration property;
  • nostart : optional; this should be the hardcoded string "nostart" (not case sensitive).
    If present the bundles will not be started.
    This option overwrites the start #configuration property;
  • update : optional; the hardcoded string "update" (not case sensitive)
    If present the bundles will be updated.
    This option overwrites the update #configuration property;

The above options: start_level/nostart/update can be specified in any order.

Examples

  • scan-dir:file:/C:/my-project/my-bundles - installs all the bundles found in my-bundles directory from local drive.
  • scan-dir:C:/my-project/my-bundles - same as above.
  • scan-dir:C:/my-project/my-bundles!/** - same as above but will include also any subfolder of my-bundles folder.
  • scan-dir:C:/my-project/my-bundles!/*.jar - installs all the bundles found in my-bundles directory that have an jar extension.
  • scan-dir:my-project/my-bundles - same as above but relative to the directory from where runner is started.
  • scan-dir:. - installs all bundles found in the directory from where runner is started.
  • scan-dir:file:/C:/my-project/my-bundles.zip - installs all the bundles found in the zip file my-bundles.zip from local drive.
  • scan-dir:C:/my-project/my-bundles.zip - same as above.
  • scan-dir:http:myserver/my-bundles.zip - installs all the bundles found in the zip file downloaded from the specified url.

Filter

The provisioning url can optionaly include a filter specification. If that's the case you have to start the filter specification with !/ and then your filter string. The filter is relative to the directory or zip root and can include wildcards as:

  • * - for any characters
  • ** - recursive

Examples:

  • !/** - will select all the files from the specified directory or zip including subdirectories;
  • !/* - will select all the files from the directory or root of the zip (without any subdirectory);
  • !/mybundle.jar - will select only mybundle.jar file;
  • !/*.jar - will select all files that have zip extension;
  • !/pax*.jar - will select all files that start with pax and have a jar extension;
  • !/pax.jar - will select all files that contains pax in the name and have a jar extension;
  • !/*pax* - will select all files that contains pax in the name.

Configuration

The service can be configured in two ways: via configuration admin if available and via framework/system properties where the configuration via config admin has priority.

Option key

Description

org.ops4j.pax.runner.scanner.dir.startlevel

optional; default start level

org.ops4j.pax.runner.scanner.dir.start

optional; true/false - if installed bundles should be started ot not. Default value is true, so the bundles are started.

org.ops4j.pax.runner.scanner.dir.update

optional; true/false - if installed bundles should be updated or not. Default value is false, so the bundles will not be updated.