This guide describes how to specify metadata versions with an external properties file and thus to update the metadata without deleting the storage.
Concept
Metatype implementation provides support for two metadata xml formats:
Using the Bosch format allows the user to specify metadata versions. This enables metadata update without deleting the storage. This is a known limitation of OSGi metadata format and it is a good to have feature to support metadata update through versioning. Since OSGi metadata is only read from XML files and there is no version tag/header supported, there is a need for additional logic, defining metadata versions.
Solution
For the purposes of versioning, a concept of using an external properties file is used. This file follows a simple format, in which each line specifies a pair of metatype PID and a version.
There is a default location – osgi/bin/vms/mtp_versions.properties, but user may specify another file if needed. This is done via setting mbs.metatype.mtp.versions system property to point to the file.
Each line follows the format:
This gives a version to parsed OSGi metadata, both for PIDs and factory PIDs. Such behavior allows user to easily manage metadata, defined with OSGi format, aligning it with Bosch proprietary format.
OSGi metadata versioning file is loaded each time on startup of metatype bundle.