OPS4J
  Scanner - Directory
Added by Alin Dreghiciu, last edited by Alin Dreghiciu on Feb 26, 2008  (view change)

Labels

 

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.

Installation guide

This bundle is part of Pax Runner so if you are using pax runner you have nothing more to do about.
If you wanna use the bundle as a standalone bundle you could install it using the following methods:

Manual installation
Pax Runner installation

pax-run mvn:org.ops4j.pax.runner/pax-runner-scanner-dir

Source code

https://scm.ops4j.org/repos/ops4j/projects/pax/runner/pax-runner-scanner-dir ( or browse via FishEye )
This project builds with Apache Maven and uses Apache Felix's maven-bundle-plugin, and Peter Krien's bnd tool.

Unable to render {include} Couldn't find a page to include called: Pax Runner Family

See also

Pax URL - classpath — classpath: protocol handler. Provides access to classpath resources from your bundle or other bundles installed.
Pax URL - ivy — ivy: protocol handler. Provides access to Ivy artifacts. (not implemented yet)
Pax URL - mvn — mvn: protocol handler. Provide access to maven repository artifacts based on the well known groupId, artifactId, version and type
PAX URL - obr — obr: protocol handler. Make use of OBR bundle repository.
Pax URL - war — war:/war-i: protocol handlers. Automates war deployment.
Pax URL - wrap — wrap: protocol handler. Wraps "classic" jars as OSGi bundles.
Platform - Concierge — Starts up Concierge OSGi framework
Platform - Equinox — Starts up Equinox OSGI framework
Platform - Extender — Installs platform services based via a whiteboard pattern
Platform - Felix — Starts up Felix OSGi framework
Platform - Knopflerfish — Starts up Knopflerfish OSGi framework
Scanner - Bundle — Installs a bundle specified as url.
Scanner - Directory — Install bundles available in a file system directory or zip
Scanner - File — Install bundles listed in a plain text file
Scanner - Maven 2 POM — Installs bundles listed as dependencies in a maven 2 pom.xml file
Scanner - OBR — Resolves and installs bundles references listed in a plain text file