General Description of the Metatype Bundle
The Metatype Bundle contains the implementation of the OSGi Meta Type Service from the OSGi
Service Platform Service Compendium, Release 4. The bundle handles metatypes and adds useful
characteristics of metadata, defined in the ProSyst Metatype API which extends the OSGi Service Platform Specification, Release 3.
Contents:
Bundle Information
Bundle JAR
The JAR file of the Metatype Bundle is metatype.jar, placed
in the bundles directory.
Import
The Metatype Bundle imports the following packages:
| Package |
Exporter |
Description |
com.prosyst.mbs.services.db |
DB Bundle |
The DB service, used for persistent data storage. |
com.prosyst.util.hash |
System
Bundle/
ProSyst Util Full Bundle |
Hashtable utilities for associating long and integer values with
objects. |
com.prosyst.util.io |
Serialization utilities. |
com.prosyst.util.pcommands |
ProSyst
Util Bundle/
ProSyst Util Full Bundle |
The API for developing text commands for the Parser Service. |
com.prosyst.util.propertiesfile |
System Bundle/
ProSyst Util Full Bundle |
The ProSyst ResourceBundle model for defining and using of locale-specific .properties files.
|
com.prosyst.util.ref |
ProSyst Util Bundle/
ProSyst Util Full Bundle |
The log utility for writing log messages to the OSGi Log Service and to the Service Tracker. |
com.prosyst.util.xml |
The ProSyst API for reading and parsing XML files. |
org.mbs.services.metatype |
Metatype Bundle |
The API introduced by the Metatype Bundle. |
org.osgi.service.metatype |
OSGi Library Bundle |
The API introduced by the OSGi Metatype Service Specification. |
org.osgi.service.packageadmin |
System Bundle |
The OSGi Package Admin Service. |
|
Export
The Metatype Bundle exports the following packages to other bundles
in the OSGi framework:
| Package |
Description |
org.mbs.services.metatype |
The ProSyst Metatype API, including the Meta Data Manager service
and API for developing new metatypes. |
|
Principles of Work
The Metatype Bundle introduces an implementation of the OSGi Metatype Service specified in the OSGi
Service Platform Service Compendium, Release 4. It also provides the ProSyst Metatype API, built on top of the OSGi Metatype API defined in the OSGi Service Platform Specification, Release 3, for backward compatibility with the previous version of the Configuration Admin and with the ProSyst control unit model.
The Metatype Bundle is responsible for:
- Enabling bundles to export metatypes in the form of services or XML resources.
- Providing metadata to interested local or remote parties through the OSGi Metatype Service.
Metadata Model
The metadata management model of the OSGi Metatype Service Specification is based on definitions of object classes and of their attributes. A collection of object classes and attributes associated with
a common entity define a metatype for that entity. The structure of an object
class is described in its ObjectClassDefinition, which consists of zero or more
AttributeDefinitions for required and/or optional attributes. Metadata within
a metatype is delivered by a Metatype Provider, which holds ObjectClassDefinitions,
each identified by its Persistent IDentity (PID).
In addition, the ProSyst implementation of the Metatype Specification (from the OSGi Service Platform Specification, Release 3) associates
each Metatype Provider with ID and version.
Services
The following document chapter describes in brief the services that the Metatype Bundle registers in the OSGi framework.
OSGi Metatype Service
The OSGi Metatype Service provides a unified way to access the metatype information of bundles. It is realized according the OSGi Metatype Service Specification from the OSGi
Service Platform Service Compendium, Release 4.
A metatype information can be provided as an XML resource placed in the bundle JAR file or by registering a Metatype Provider as a service under the org.osgi.service.metatype.MetaTypeProvider interface. See the "OSGi Metatype Service" for more information about using the OSGi Metatype Service.
Metadata Manager
The Metadata Manager service is left for backward compatibility with the previous version of the Configuration Admin and for the proper work of the control unit model. It provides access to metadata of different types.
The Metadata Manager service is published under the org.mbs.services.metatype.MetaDataManager
interface in the OSGi framework. See the "How to Manage
Available Metadata" section in the "ProSyst Metatype Extension" document for more details on the Metadata Manager
service usage.
The functionality of the Metadata Manager service is fully accessible over
PMP. To enable remote applications
retrieve metadata, it should be serialized (instance of java.io.Serializable
or com.prosyst.util.io.Externalizable).
Metatype Utils
The Metatype Utils service (org.mbs.services.metatype.MetaTypeUtils)
is a helper utility for validation of metadata and for converting it into a
more comprehensive form.
Pluggable Commands
The Metatype Bundle registers a Pluggable Commands service (com.prosyst.util.pcommands.PluggableCommands),
which adds the mtp group of console commands to the Parser Service. See
the "Console Commands" chapter for more details
on the mtp commands usage.
Object Class Creator
The Object Class Creator service is published under the org.mbs.services.metatype.ObjectClassCreator interface. It is a utility for creating ObjectClassDefinition objects from a given XML metatype resource.
Console Commands
The Metatype Bundle provides a separate command group called mtp.
These commands can be invoked from the framework
runtime console or from a Telnet
client.
To enter the mtp commands, type cd mtp or mtp/.
| Command |
Shortcut |
Description |
| list <bid> [<type>[ <type>]] |
ls |
Lists the PIDs and friendly names of the metatypes, provided by
the specified bundle. |
| get <pid> |
- |
Shows information about the metatype with the specified PID. |
| listdb <option> |
lsdb |
Shows the metadata information, stored in the
database. The listdb command takes one of the following options:
| -t | -T |
Lists the types of stored metadata. The default supported types of metadata are:
- Config - For plain bundle configurations.
- FactoryConfig - For factory bundle configurations.
- Control-Unit - For control unit metadata.
|
| -i | -I |
Lists the bundle IDs, which have provided stored metadata. |
| -m | -M <bid> [type [type]] |
Shows stored metadata of the specified bundle. |
|
| delete <bid> |
del |
Deletes the metadata associated with the specified bundle. |
| aggregate <pid> |
agg |
Returns aggregated metatype provider for the specified PID. You can use this command only for the control unit type of metadata. |
| parse <location> |
ps |
Parses the metadata XML file with the specified location. |
| process <bid>[ <bid>] |
pr |
Processes the metadata of the specified bundle(s) as if the bundle
has been updated. |
| checkDebug |
chd |
Configures generation of debug information according to the mbs.mtp.debug
and mbs.mtp.console system properties. |
|
System Properties
| System Property |
Default Value |
Description |
mbs.metadata.cache |
false |
Enables caching of XML-formatted metatypes. |
mbs.metadata.configs.process |
false |
Turns on processing of metatypes associated with bundle configurations
and factory configurations by the Metadata Manager itself. This property
should be set to true in case there is no associated Metadata
Plugin such as the Configuration Admin. |
mbs.metadata.configs.store |
false |
If processing of configuration metadata is on, enables storage of
configuration metadata. |
mbs.mtp.cKeckLastModified |
false |
Indicates whether to be checked the last modified time of the bundle JAR file. If set to true and the last modified time of the bundle JAR is changed, all metatype information of this bundle is updated, regardless the version of the metatype XML file. |
mbs.mtp.debug |
false |
Turns on/off generation of debug information. |
mbs.mtp.console |
false |
When true, prints generated debug messages in the system
output. |
mbs.mtp.removeTypeTimeout |
15000 |
Specifies the timeout in milliseconds for keeping metatype information for a plug-in that has been unregistered, in case the plug-in is registered before the end of the timeout. Value of -1 implies no limit for storing metatype information for a plug-in in the database. |
|
To use successfully the above system properties, you have to specify them:
- In the default.prs file before framework startup.
- By using the set console command or the mConsole at framework runtime
before starting the Metatype Bundle. Otherwise, you should restart
the bundle to apply the changes.
For more information on using system properties, see the "System
Properties" document from "Getting Started".
References