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:
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.
Place the file on the designated directory on the target device.
You can place the file in the default directory, configs, within the main folder of the OSGi runtime.
You can place the file in a location different from the default one. Then, specify the path to the directory through the mbs.mtp.externalDir system property prior to starting the Metatype Bundle.
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.