A document on adding a new type of metadata resource.
Features of the Extended Metatype API
The Extended Metatype API, mainly in the com.prosyst.mbs.services.metatype Java package, enables developers to define: One or more object class instances with modified values of their attributes, inherited from a "factory" object class. These instances can be generated by a management application when metadata is initially loaded. Such an object class instance is called configuration object and it extends the appropriate ObjectClassDefinition – the configuration object inherits all attributes of the object class and may override them.
Type and Version of Metadata
Nested ObjectClassDefinitions and ObjectClassDefinition modifiers. Additional attribute characteristics, depending on the module using the resource, such as the minValue and maxValue properties for the Configuration Admin, etc. The Metatype Bundle is capable of managing metadata of different types. Usually, a metadata type represents some kind of logical entity. Each type is associated with a Metadata Plugin service, indicating the supported metadata type through a service registration property. Initially, there is a Metadata Plugin for plain and factory bundle configurations (see the Config Bundle description) and for control units (see the Control Unit Admin Bundle description). The Metatype Bundle processes only metatypes for whose metadata type there is a Metadata Plugin currently registered in the OSGi framework.
How to Add a New Metadata Type
Adding a new type of metadata resource can be achieved by implementing an com.prosyst.mbs.services.metatype.MetaDataPlugin and registering it as a service in the OSGi framework with registration property MetaDataPlugin.METADATA indicating the new metadata type(s) defined as String or String[] types.
When a bundle holding metadata of specific type is installed or updated, the Metadata Manager asks the associated Metadata Plugin whether to process the metadata or not by calling the plugin's process method. For example, this method may return false for intensively used metadata as its processing may significantly load the system and slow down its performance.