OPS4J
  Scanner - File
Added by Alin Dreghiciu, last edited by Alin Dreghiciu on Jan 15, 2008  (view change)

Labels

 

Overview

The file scanner handles a set of bundles listed in plain text file(s).

Syntax

scan-file:file_url[@start_level][@nostart][@update]

where:

  • file_url : mandatory; is the url of the file containing the list of bundles to 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

File Format

Files containing bundles to be installed must be plain text files containing url's of the bundles to be installed on separate line, one bundle per line and/or system properties. If system properties are present, those will be carried into the OSGi platform.
The syntax of an bundle reference is as follow:

bundle_url[@start_level][@nostart][@update]

where:

  • bundle_url : mandatory; is the url of the bundle to be installed. It can be any valid url (see also Pax Runner Handler for custom url handlers);
  • start_level : optional; an integer representing the start level of the bundle. If present and OSGi Start Level Service is available then the bundle is installed with that specific start level;
  • nostart : optional; this should be the hardcoded string "nostart" (not case sensitive); if present the bundle will not be started. Default, if the value is not present the bundle will be started depending on the service configuration.
  • update : optional; this should be the hardcoded string "update" (not case sensitive); if present and the bundle was already installed before, the bundle will be updated. Default, if the value is not present the bundle will be updated or not depending on the service configuration.

The syntax of a property is as follow:

-Dproperty-name=propertyvalue

where

  • property-name : the key of the property
  • property-value : the value of the property. The value can contain place holders as ${name} where name is the name of the property the ${name} placeholder will be replaced with.

The file can contain empty lines or lines starting with #, case when those lines will be skipped. This allows nice separation and comments.

File Examples
# and bundle from the local hard drive with no specific start level that is installed and started
file:/C:/localRepository/org/ops4j/pax/web/bundles/service/0.2.0/service-0.2.0.jar

# a maven artifact bundle installed with start level = 5 and started
mvn:org.ops4j.pax.web.bundles/service@5

# an bundle installed from http with no specific start level that is just installed and not started
http://repository.ops4j.org/maven2/org/ops4j/pax/web/bundles/service/0.2.0/service-0.2.0.jar@nostart

# a maven artifact bundle that will be updated if installed before and started
mvn:org.ops4j.pax.web.bundles/service@update

# properties for http service ports
-Dorg.osgi.service.http.port=2080
-Dorg.osgi.service.http.port.secure=2443

Note that, as stated by the maven handler, if you use an mvn: url, you could use in your url the repository from where the bundle could be downloaded.

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.file.startlevel optional; default start level
org.ops4j.pax.runner.scanner.file.start optional; true/false - if installed bundles should be started or not. Default value is true, so the bundles are started.
org.ops4j.pax.runner.scanner.file.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-file

Source code

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

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