Previous Topic

Next Topic

Book Contents

Book Index

Store a Configuration XML File in an External Directory

A document on storing XML configurations in an external file for the purpose of easier modifications of the metadata.

You can store the metatype XML file for a configuration in the OSGi Configuration Admin in an external directory. In this way, you can easily modify the associated metadata. To use this feature, follow the steps:

  1. Name the configuration XML file after the PID of the configuration or after the FPID of the configuration factory and add the .xml extension. For example, the mbs.config.demo.pid.xml might hold the metadata of the Config Demo configuration with PID mbs.config.demo.
  2. Place the file on the designated directory on the target device.
  3. Include the Config or FactoryConfig metadata header in the manifest of the bundle including only the pid attribute and optionally the version one. For example, the Config manifest header of the Config Demo can be modified to Config: pid=mbs.config.demo.pid

Upon installing the bundle, the Metatype Bundle will read the PID and will check for the configuration XML in the specified external configuration directory.