OPS4J
  Pax Coin - Provider - Bundle
Added by Alin Dreghiciu, last edited by Alin Dreghiciu on Jun 23, 2008  (view change)

Labels

 

Pax Coin Bundle Configuration Provider acts as an extender and will scan started bundles content of a configurable directory for configuration files and each found file (see supported file formats) will be considered as a configuration.
To see how you can use this provider take a look at the example use case.

Persistent identifier

The persistent identifier for the configuration will be determined as follow:

  • if configuration file name does not contain "$", persistent identifier will be equal with file name without the extension. This type of configuration file is considered to target a ManagedService.
    Example: for a file named "foo.properties" the persistent identifier will be "foo".
  • if configuration file name contains "$", persistent identifier will be equal with file name without extension and "$" replaced with "-", and factory persistent identifier will be equal with the left side of "$". This type of configuration is considered to target a ManagedServiceFactory.
    Example: for a file named "foo$bar.properties" the persistent identifier will be "foo-bar" and factory persistent identifier will be "foo".

File formats

This provider supports two file formats:

  • Files with a ".properties" extension will be loaded using [Properties Loader]
  • Files with a ".xml" extension will be loaded using [Apache Commons Configuration]

Scanning

This provider will watch over starting and stopping bundle. As soon as a bundle is started that contains configuration file (see configuration) the corresponding ManagedService / ManagedServiceFactory will be updated. When a bundle containing configuration files will be stopped the corresponding ManagedService / ManagedServiceFactory configurations will be deleted.

Configuration

By default this provider will look for configuration files in META-INF/config. If that's not appropriate for you, you can specify another directory by adding Configuration-Path manifest entry into your bundle (containing configurations) manifest file (META-IF/MANIFEST.MF). The value of this property should be a directory relative to the root of the bundle as for example:
Configuration-Path=/foo